Snap refresh lxd does not restart lxd services correct

Hi all,

after snap has refreshed lxd all users (except root user) get permission denied when calling any lxc commands (like lxc ls).
This still exists when calling snap restart lxd.
When calling snap stop lxd && snap start lxd all works again as expected.
How can we solve or workaround this problem?

Regards
Pascal

1 Like

Can you show systemctl --failed and systemctl -a | grep lxd?

Normally the snap.lxd.activate job takes care of fixing the permissions so it suggests that in your case this unit may be broken/disabled.

systemctl --failed

  UNIT                     LOAD   ACTIVE SUB    DESCRIPTION
â—Ź amsd.service             loaded failed failed Agentless Management Service daemon
â—Ź cpqiScsi.service         loaded failed failed cpqiScsi MIB handler.
â—Ź zfs-import-cache.service loaded failed failed Import ZFS pools by cache file

systemctl -a | grep lxd

  sys-devices-virtual-net-lxdbr0.device                                                            loaded    active   plugged   /sys/devices/virtual/net/lxdbr0
  sys-subsystem-net-devices-lxdbr0.device                                                          loaded    active   plugged   /sys/subsystem/net/devices/lxdbr0
  run-snapd-ns-lxd.mnt.mount                                                                       loaded    active   mounted   /run/snapd/ns/lxd.mnt
  snap-lxd-22754.mount                                                                             loaded    active   mounted   Mount unit for lxd, revision 22754
  snap-lxd-22826.mount                                                                             loaded    active   mounted   Mount unit for lxd, revision 22826
  var-snap-lxd-common-ns-mntns.mount                                                               loaded    active   mounted   /var/snap/lxd/common/ns/mntns
  var-snap-lxd-common-ns-shmounts.mount                                                            loaded    active   mounted   /var/snap/lxd/common/ns/shmounts
  var-snap-lxd-common-ns.mount                                                                     loaded    active   mounted   /var/snap/lxd/common/ns
  snap.lxd.daemon.service                                                                          loaded    active   running   Service for snap application lxd.daemon
  snap.lxd.user-daemon.service                                                                     loaded    inactive dead      Service for snap application lxd.user-daemon
  snap.lxd.workaround.service                                                                      loaded    active   exited    /bin/true
  snap.lxd.daemon.unix.socket                                                                      loaded    active   running   Socket unix for snap application lxd.daemon
  snap.lxd.user-daemon.unix.socket                                                                 loaded    active   listening Socket unix for snap application lxd.user-daemon

Maybe this is more of interest:

Feb 23 08:49:54 skynet-test systemd[1]: Starting Service for snap application lxd.activate...
Feb 23 08:50:24 skynet-test lxd.activate[2509392]: sanity timeout expired: Interrupted system call
Feb 23 08:50:42 skynet-test lxd.activate[2509370]: cannot send command 1 to helper process: Broken pipe
Feb 23 08:50:42 skynet-test systemd[1]: snap.lxd.activate.service: Main process exited, code=exited, status=1/FAILURE
Feb 23 08:50:42 skynet-test systemd[1]: snap.lxd.activate.service: Failed with result 'exit-code'.
Feb 23 08:50:42 skynet-test systemd[1]: Failed to start Service for snap application lxd.activate.
Feb 23 08:50:42 skynet-test systemd[1]: snap.lxd.activate.service: Consumed 52.352s CPU time.

But this is from the journal log and quite old… Not from todays problem

While looking into some logs I’ve seen that snap.lxd.activate.service was not restarted after snap refresh. Maybe this can help to find our problem?

snap.lxd.activate isn’t even listed at all in your systemctl -a so that’s likely the issue.

What does snap services lxd show you?

1 Like

snap services lxd

Service          Startup   Current   Notes
lxd.activate     disabled  inactive  -
lxd.daemon       enabled   active    socket-activated
lxd.user-daemon  enabled   inactive  socket-activated

I’ve activated the lxd.activate service. Let’s see if this solves the problem…
Is there a reason why this service was not activated on our machine?

Most likely a snapd bug. The snap comes with all services enabled. Something must have caused snapd to fail to generate it or enable it either at install time or during an update.

Thanks for all your help.