Hello! I’m trying to get snap packages to work inside a privileged LXD container.
Here is essentially what I’m doing:
lxc launch ubuntu:focal -c security.privileged=true c1
lxc exec c1 -- snap install hello-world
I get the following error:
error: too early for operation, device not yet seeded or device model not acknowledged
In an unprivileged container I have no issues whatsoever.
I have seen this discussion, but it didn’t help.
Here are some further logs etc.:
root@c1:~# journalctl -u snapd
-- Logs begin at Tue 2022-03-29 13:37:00 UTC, end at Tue 2022-03-29 13:37:33 UTC. --
Mar 29 13:37:03 c1 systemd[1]: Starting Snap Daemon...
Mar 29 13:37:03 c1 snapd[340]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network
Mar 29 13:37:04 c1 snapd[340]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network
Mar 29 13:37:04 c1 snapd[340]: patch.go:63: Patching system state level 6 to sublevel 1...
Mar 29 13:37:04 c1 snapd[340]: patch.go:63: Patching system state level 6 to sublevel 2...
Mar 29 13:37:04 c1 snapd[340]: patch.go:63: Patching system state level 6 to sublevel 3...
Mar 29 13:37:04 c1 snapd[340]: daemon.go:246: started snapd/2.54.4 (series 16; classic; devmode) ubuntu/20.04 (amd64) linux/5.16.13-arch1-1.
Mar 29 13:37:04 c1 snapd[340]: daemon.go:339: adjusting startup timeout by 45s (pessimistic estimate of 30s plus 5s per snap)
Mar 29 13:37:05 c1 systemd[1]: Started Snap Daemon.
Mar 29 13:37:06 c1 snapd[340]: taskrunner.go:271: [change 1 "Run install hook of \"lxd\" snap if present" task] failed: run hook "install": cannot perform operation: mount --make-rshared /snap: Permission denied
Mar 29 13:37:08 c1 snapd[340]: api_snaps.go:307: Installing snap "hello-world" revision unset
Mar 29 13:37:08 c1 snapd[340]: copydata.go:82: Cannot remove common data directories for "lxd": unlinkat /var/snap/lxd/common/var/lib/lxcfs/proc/cpuinfo: function not implemented
Mar 29 13:37:08 c1 snapd[340]: taskrunner.go:271: [change 1 "Copy snap \"lxd\" data" task] failed: unlinkat /var/snap/lxd/common/var/lib/lxcfs/proc/cpuinfo: function not implemented
Mar 29 13:37:08 c1 systemd[1]: snapd.service: Got notification message from PID 732, but reception only permitted for main PID 340
Mar 29 13:37:08 c1 snapd[340]: taskrunner.go:271: [change 1 "Mount snap \"lxd\" (22526)" task] failed: systemctl command [stop snap-lxd-22526.mount] failed with exit status 1: Job failed. See "journalctl -xe" for details.
Mar 29 13:37:08 c1 systemd[1]: snapd.service: Got notification message from PID 734, but reception only permitted for main PID 340
Mar 29 13:37:08 c1 snapd[340]: handlers.go:644: Reported install problem for "lxd" as 95ad9b84-af65-11ec-a265-fa163ef35206 OOPSID
Mar 29 13:37:09 c1 systemd[1]: snapd.service: Got notification message from PID 738, but reception only permitted for main PID 340
Mar 29 13:37:09 c1 snapd[340]: taskrunner.go:271: [change 1 "Mount snap \"core20\" (1376)" task] failed: systemctl command [stop snap-core20-1376.mount] failed with exit status 1: Job failed. See "journalctl -xe" for details.
Mar 29 13:37:09 c1 snapd[340]: handlers.go:644: Reported install problem for "core20" as 96398d2c-af65-11ec-a265-fa163ef35206 OOPSID
Mar 29 13:37:09 c1 snapd[340]: daemon.go:509: gracefully waiting for running hooks
Mar 29 13:37:09 c1 snapd[340]: daemon.go:511: done waiting for running hooks
Mar 29 13:37:09 c1 systemd[1]: snapd.service: Got notification message from PID 743, but reception only permitted for main PID 340
Mar 29 13:37:09 c1 snapd[340]: taskrunner.go:271: [change 1 "Setup snap \"snapd\" (15177) security profiles" task] failed: cannot reload udev rules: exit status 1
Mar 29 13:37:09 c1 snapd[340]: udev output:
Mar 29 13:37:09 c1 snapd[340]: Failed to send reload request: No such file or directory
Mar 29 13:37:10 c1 systemd[1]: snapd.service: Got notification message from PID 745, but reception only permitted for main PID 340
Mar 29 13:37:10 c1 snapd[340]: taskrunner.go:271: [change 1 "Mount snap \"snapd\" (15177)" task] failed: systemctl command [stop snap-snapd-15177.mount] failed with exit status 1: Job failed. See "journalctl -xe" for details.
Mar 29 13:37:10 c1 systemd[1]: snapd.service: Got notification message from PID 747, but reception only permitted for main PID 340
Mar 29 13:37:10 c1 snapd[340]: handlers.go:644: Reported install problem for "snapd" as 96aea97c-af65-11ec-a265-fa163ef35206 OOPSID
Mar 29 13:37:10 c1 systemd[1]: snapd.service: Succeeded.
Mar 29 13:37:10 c1 systemd[1]: snapd.service: Consumed 3.141s CPU time.
Mar 29 13:37:10 c1 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 1.
Mar 29 13:37:10 c1 systemd[1]: Stopped Snap Daemon.
Mar 29 13:37:10 c1 systemd[1]: snapd.service: Consumed 3.141s CPU time.
Mar 29 13:37:10 c1 systemd[1]: Starting Snap Daemon...
Mar 29 13:37:10 c1 snapd[750]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network
Mar 29 13:37:10 c1 snapd[750]: patch.go:63: Patching system state level 6 to sublevel 1...
Mar 29 13:37:11 c1 snapd[750]: patch.go:63: Patching system state level 6 to sublevel 2...
Mar 29 13:37:11 c1 snapd[750]: patch.go:63: Patching system state level 6 to sublevel 3...
Mar 29 13:37:11 c1 snapd[750]: daemon.go:246: started snapd/2.54.3+20.04.1ubuntu0.2 (series 16; classic; devmode) ubuntu/20.04 (amd64) linux/5.16.13-arch1-1.
Mar 29 13:37:11 c1 snapd[750]: daemon.go:339: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Mar 29 13:37:11 c1 systemd[1]: Started Snap Daemon.
root@c1:~# systemctl status snapd
● snapd.service - Snap Daemon
Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-03-29 13:37:11 UTC; 3min 52s ago
TriggeredBy: ● snapd.socket
Main PID: 750 (snapd)
Tasks: 16 (limit: 19013)
Memory: 15.9M
CPU: 721ms
CGroup: /system.slice/snapd.service
└─750 /usr/lib/snapd/snapd
Mar 29 13:37:10 c1 systemd[1]: Starting Snap Daemon...
Mar 29 13:37:10 c1 snapd[750]: AppArmor status: apparmor is enabled but some kernel features are missing: dbus, network
Mar 29 13:37:10 c1 snapd[750]: patch.go:63: Patching system state level 6 to sublevel 1...
Mar 29 13:37:11 c1 snapd[750]: patch.go:63: Patching system state level 6 to sublevel 2...
Mar 29 13:37:11 c1 snapd[750]: patch.go:63: Patching system state level 6 to sublevel 3...
Mar 29 13:37:11 c1 snapd[750]: daemon.go:246: started snapd/2.54.3+20.04.1ubuntu0.2 (series 16; classic; devmode) ubuntu/20.04 (amd64) linux/5.16.13-arch1-1.
Mar 29 13:37:11 c1 snapd[750]: daemon.go:339: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Mar 29 13:37:11 c1 systemd[1]: Started Snap Daemon.
root@c1:~# systemctl status snapd.seeded
● snapd.seeded.service - Wait until snapd is fully seeded
Loaded: loaded (/lib/systemd/system/snapd.seeded.service; enabled; vendor preset: enabled)
Active: activating (start) since Tue 2022-03-29 13:37:05 UTC; 4min 9s ago
Main PID: 540 (snap)
Tasks: 13 (limit: 19013)
Memory: 34.0M
CPU: 711ms
CGroup: /system.slice/snapd.seeded.service
└─540 /usr/bin/snap wait system seed.loaded
Mar 29 13:37:05 c1 systemd[1]: Starting Wait until snapd is fully seeded...
Un/reinstalling snapd
also fails/hangs at 60%:
root@c1:~# apt purge -y snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfreetype6 squashfs-tools
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
snapd*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 147 MB disk space will be freed.
(Reading database ... 31896 files and directories currently installed.)
Removing snapd (2.54.3+20.04.1ubuntu0.2) ...
dpkg: warning: while removing snapd, unable to remove directory '/snap': Device or resource busy - directory may be a mount point?
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
(Reading database ... 31811 files and directories currently installed.)
Purging configuration files for snapd (2.54.3+20.04.1ubuntu0.2) ...
Stopping snap-core20-1376.mount
Stopping unit snap-core20-1376.mount
Waiting until unit snap-core20-1376.mount is stopped [attempt 1]
Waiting until unit snap-core20-1376.mount is stopped [attempt 2]
Waiting until unit snap-core20-1376.mount is stopped [attempt 3]
Waiting until unit snap-core20-1376.mount is stopped [attempt 4]
Waiting until unit snap-core20-1376.mount is stopped [attempt 5]
Waiting until unit snap-core20-1376.mount is stopped [attempt 6]
Waiting until unit snap-core20-1376.mount is stopped [attempt 7]
Waiting until unit snap-core20-1376.mount is stopped [attempt 8]
Waiting until unit snap-core20-1376.mount is stopped [attempt 9]
Waiting until unit snap-core20-1376.mount is stopped [attempt 10]
Waiting until unit snap-core20-1376.mount is stopped [attempt 11]
Waiting until unit snap-core20-1376.mount is stopped [attempt 12]
Waiting until unit snap-core20-1376.mount is stopped [attempt 13]
Waiting until unit snap-core20-1376.mount is stopped [attempt 14]
Waiting until unit snap-core20-1376.mount is stopped [attempt 15]
Waiting until unit snap-core20-1376.mount is stopped [attempt 16]
Waiting until unit snap-core20-1376.mount is stopped [attempt 17]
Waiting until unit snap-core20-1376.mount is stopped [attempt 18]
Waiting until unit snap-core20-1376.mount is stopped [attempt 19]
Waiting until unit snap-core20-1376.mount is stopped [attempt 20]
Removing snap core20 and revision 1376
rm: cannot remove '/snap/core20/1376': Device or resource busy
dpkg: error processing package snapd (--purge):
installed snapd package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
snapd
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@c1:~# apt install snapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
Suggested packages:
zenity | kdialog
The following NEW packages will be installed:
snapd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 34.3 MB of archives.
After this operation, 147 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 snapd amd64 2.54.3+20.04.1ubuntu0.2 [34.3 MB]
Fetched 34.3 MB in 1s (46.2 MB/s)
(Reading database ... 31807 files and directories currently installed.)
Preparing to unpack .../snapd_2.54.3+20.04.1ubuntu0.2_amd64.deb ...
Unpacking snapd (2.54.3+20.04.1ubuntu0.2) ...
Setting up snapd (2.54.3+20.04.1ubuntu0.2) ...
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.
Trying to restart snapd.service
doesn’t change anything either.
Any idea what I’m missing? Please let me know if I can provide any further information. Thanks a lot!