Installing from a chroot results in missing files

I am aware that snapd does not works in a chroot but that’s not what I am trying to achive.

I have 2 Ubuntu installations and what I am trying to do is mounting the second Ubuntu installation, then chroot and just install snapd on it. The installation occurs and snapd is there when I boot from that installation but the following appears when trying to use it:

error: cannot communicate with server: Post "http://localhost/v2/snaps/firefox": dial unix /run/snapd.socket: connect: connection refuse

the snapd systemd unit does not show any useful log, while the apparmor unit does:

Dec 25 15:02:08 vanilla apparmor.systemd[592]: AppArmor parser error for /etc/apparmor.d/nvidia_modprobe in profile /etc/apparmor.d/tunables/global at line 15: Could not open 'tunables/home'
Dec 25 15:02:08 vanilla apparmor.systemd[598]: AppArmor parser error for /etc/apparmor.d/sbin.dhclient in profile /etc/apparmor.d/tunables/global at line 15: Could not open 'tunables/home'
Dec 25 15:02:08 vanilla apparmor.systemd[605]: AppArmor parser error for /etc/apparmor.d/usr.bin.man in profile /etc/apparmor.d/tunables/global at line 15: Could not open 'tunables/home'
Dec 25 15:02:08 vanilla apparmor.systemd[606]: AppArmor parser error for /etc/apparmor.d/usr.lib.snapd.snap-confine.real in profile /etc/apparmor.d/tunables/global at line 15: Could not open 'tunables/home'
Dec 25 15:02:08 vanilla apparmor.systemd[611]: AppArmor parser error for /etc/apparmor.d/usr.sbin.cupsd in profile /etc/apparmor.d/tunables/global at line 15: Could not open 'tunables/home'

I copied the home file from another installation and everything started working with no issues.

How is that file created? And why was not there?

Thanks for the help and merry Christmas!

1 Like

It looks like /etc/apparmor.d/tunables/home and tunables/global are both installed with the apparmor deb file:

lengau@hyperion:~$ dpkg -S /etc/apparmor.d/tunables/home
apparmor: /etc/apparmor.d/tunables/home
lengau@hyperion:~$ dpkg -S /etc/apparmor.d/tunables/global 
apparmor: /etc/apparmor.d/tunables/global

Not sure why it’s missing in the first place, but if you delete it again and run sudo apt install --reinstall apparmor it should reappear. If it doesn’t, that’s probably the course to go down for debugging.