Sudo apt-get upgrade : errors

Hi, this is very similar to

But with a few differences.
The error is

Setting up snapd (2.39.2+19.04) ...
md5sum: /etc/apparmor.d/usr.lib.snapd.snap-confine: No such file or directory
snapd.failure.service is a disabled or a static unit, not starting it.
snapd.snap-repair.service is a disabled or a static unit, not starting it.

Where it hangs until I stop the process. Following the help on the above thread, I get the same until I try sudo apt upgrade again, where I get

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

So I killed the original process, and then I get

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

snap list gives:

Name  Version  Rev   Tracking  Publisher   Notes
core  16-2.38  6673  stable    canonicalâś“  core

sudo dpkg -P snapd gives:

dpkg: error: dpkg database lock is locked by another process

Am new to Ubuntu, so am a bit stuck. Can anyone help?
Cheers

In case anyone else has similar problems. I had to do the following:
sudo apt --purge remove snapd

Then the apt upgrade and update completed successfully.
Then re-installed snapd