11

I'd like to remove Snap from my system entirely, but have a smallish problem:

1st, I removed all snap packages:

sudo snap remove $(snap list | tail -n +2 | cut -d" " -f1 | grep -v core | tr "/n" " ")

Then I removed snapd, and the gnome snap plugin

sudo apt remove -y snapd gnome-software-plugin-snap

The problem is that at reboot, Apparmor is looking for a profile for snap, and fails parsing snap configuration files:

Feb 21 21:40:47 dad apparmor[698]: AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap-confine.core.5662 in /var/lib/snapd/apparmor/profiles/snap-confine.core.5662 at line 11: Could not open '/var/lib/snapd/apparmor/snap-confine'

which leaves me with a running system, and no apparmor!

Charles Green
  • 21,339

1 Answers1

9

The AppArmor profile is located in /etc/apparmor.d/usr.lib.snapd.snap-confine.real file, which came from snapd package.

So you should use apt purge instead apt remove (see man apt for details):

sudo apt purge snapd

Small note: for me the snippet below looks better -

snap remove $(snap list | awk '{print $1}' | egrep -v "Name|core")
N0rbert
  • 99,918
  • I ran with purge, and there's a line that prints specifically stating that it has removed the apparmor profiles! – Charles Green Feb 22 '19 at 20:43
  • That worked well. I'm going to look at the difference between 'remove' and 'purge', but then I think I should find sudo apt remove snap and modify those answers – Charles Green Feb 22 '19 at 20:48
  • 1
    Great! The differences are indicated in man apt. It seems that Dobey did this right :) – N0rbert Feb 22 '19 at 20:51
  • I thought about using ASK for the little code, but I saw the otherone a few days back, and it made me learn a bit more about the shell. – Charles Green Feb 22 '19 at 20:53
  • If you've already removed snapd, but still need to remove snapd leftovers, you can do so by performing 'sudo dpkg --purge snapd' which should remove the problematic AppArmor profile, as noted here: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1773515/comments/8 – Davidou Jan 15 '24 at 11:55