Can't remove Chromium or install VSCode

So I just updated to Ubuntu 20.04 from 19.10. Doing so resulted in me being unable to start both the Snaps I manually installed (VSCode/Code and Chromium). Starting either resulted in

snap-confine has elevated permissions and is not confined but should be. Refusing to continue to avoid permission escalation attacks: Operation not permitted

To fix that issue I thought about a simple reinstallation of both. I removed VSCode but now I’m unable to install again getting the error:

snap install --classic code 
error: cannot perform the following tasks:
- Setup snap "code" (31) security profiles (cannot setup profiles for snap "code": cannot load apparmor profiles: exit status 1
apparmor_parser output:
AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap.code.url-handler in /etc/apparmor.d/tunables/home.d/ubuntu at line 7: Found unexpected character: ''
AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap-update-ns.code in /etc/apparmor.d/tunables/home.d/ubuntu at line 7: Found unexpected character: ''
AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap.code.code in /etc/apparmor.d/tunables/home.d/ubuntu at line 7: Found unexpected character: ''
)

While unable to install VSCode again I also can’t uninstall Chromium:

snap remove --purge chromium
error: cannot perform the following tasks:
- Disconnect chromium:gtk-3-themes from gtk-common-themes:gtk-3-themes (cannot setup profiles for snap "chromium": cannot load apparmor profiles: exit status 1
apparmor_parser output:
AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap-update-ns.chromium in /etc/apparmor.d/tunables/home.d/ubuntu at line 7: Found unexpected character: ''
AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap.chromium.chromedriver in /etc/apparmor.d/tunables/home.d/ubuntu at line 7: Found unexpected character: ''
AppArmor parser error for /var/lib/snapd/apparmor/profiles/snap.chromium.chromium in /etc/apparmor.d/tunables/home.d/ubuntu at line 7: Found unexpected character: ''
)

All those issues point to the same files but I don’t know how to fix this… would appreciate any help :slight_smile:

What is the contents of the file /etc/apparmor.d/tunables/home.d/ubuntu ?

1 Like

It is:

# This file is auto-generated. It is recommended you update it using:
# $ sudo dpkg-reconfigure apparmor
#
# The following is a space-separated list of where additional user home
# directories are stored, each must have a trailing '/'. Directories added
# here are appended to @{HOMEDIRS}.  See tunables/home for details.
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@

Guess I will try the command given here.

That’s quite unexpected to see that, my file has this (comments removed):

#@{HOMEDIRS}+=

and I upgraded from eoan to focal as well (though I upgraded before the final focal release).

@jdstrand thoughts on how that file could have gotten into such a state? This smells more like an apparmor bug than a snapd bug to me.

1 Like

Yep, that did it. As all my home directories are in the default /home-dir, I just entered nothing in the prompt that comes up with sudo dpkg-reconfigure apparmor which resulted in a file that has the same “out-commented” line as yours. Now I was able to successfully uninstall chromium and reinstall both, chromium and vscode. Guess I could have come up with just checking the file myself :smiley: Thanks for the quick help anyway!