Lxd from snap doesn't work any longer

moving this issue over from the linuxcontainers forum where I was advised this problem to be a not normal behavior of snapd rather then the lxd snap itself.

the entire issue started with not being able to enable the LXD snap any longer

error: cannot perform the following tasks:
- Start snap "lxd" (11381) services ([start snap.lxd.activate.service] failed with exit status 1: Job for snap.lxd.activate.service failed because the control process exited with error code.
See "systemctl status snap.lxd.activate.service" and "journalctl -xe" for details.
)

refreshing the snap does not work obviously because it is in a disabled status. So I am kind of stuck.


**systemctl status snap.lxd.activate.service**

● snap.lxd.activate.service
   Loaded: not-found (Reason: No such file or directory)
   Active: failed (Result: exit-code) since Thu 2019-08-01 06:47:02 CEST; 24min ago
 Main PID: 23486 (code=exited, status=1/FAILURE)
      CPU: 122ms

**sudo journalctl -xe**

-- 
-- Unit UNIT has begun starting up.
Aug 01 07:08:34 debian dbus-daemon[3207]: Successfully activated service 'org.freedesktop.Notifications'
Aug 01 07:08:34 debian systemd[3185]: Started XFCE notifications service.
-- Subject: Unit UNIT has finished start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit UNIT has finished starting up.
-- 
-- The start-up result is done.
Aug 01 07:08:34 debian xfce4-notifyd[24993]: Failed to set text 'Profil aktualisieren & Nachfrage steigern from Betreut.de
                                             Das sind unsere Tipps für ein aussagekrä' from markup due to error parsing markup: Error on line 1: Enti
Aug 01 07:09:01 debian CRON[24997]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 01 07:09:01 debian CRON[24998]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean
Aug 01 07:09:01 debian CRON[24997]: pam_unix(cron:session): session closed for user root
Aug 01 07:09:10 debian systemd[1]: Starting Clean php session files...
-- Subject: Unit phpsessionclean.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit phpsessionclean.service has begun starting up.
Aug 01 07:09:12 debian systemd[1]: Started Clean php session files.
-- Subject: Unit phpsessionclean.service has finished start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit phpsessionclean.service has finished starting up.
-- 
-- The start-up result is done.
Aug 01 07:13:03 debian sudo[25055]:   manolo : TTY=pts/1 ; PWD=/home/[myusername] ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 01 07:13:03 debian sudo[25055]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 01 07:13:18 debian sudo[25055]: pam_unix(sudo:session): session closed for user root
Aug 01 07:13:24 debian sudo[25063]:   manolo : TTY=pts/1 ; PWD=/home/[myusername] ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 01 07:13:24 debian sudo[25063]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 01 07:13:50 debian sudo[25063]: pam_unix(sudo:session): session closed for user root
Aug 01 07:14:02 debian sudo[25086]:   manolo : TTY=pts/1 ; PWD=/home/[myusername] ; USER=root ; COMMAND=/bin/journalctl -xe
Aug 01 07:14:02 debian sudo[25086]: pam_unix(sudo:session): session opened for user root by (uid=0)

any ideas where to go from here? The logs above do not tell me much I’m afraid

after another restart of my machine I could actually enable the lxd snap. But am getting an error when trying to execute any lxc command

Error: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

trying to refresh the snap I thought

sudo snap refresh lxd

seems to play nice at the beginning but freezes up at

Start snap "lxd" (11405) services

Can you post the output of snap version please?

Also, can you show us the output of systemctl status snap-lxd*.mount?

snap    2.39.3
snapd   2.39.3
series  16
debian  9
kernel  4.9.0-9-amd64
● snap-lxd-11353.mount - Mount unit for lxd, revision 11353
   Loaded: loaded (/etc/systemd/system/snap-lxd-11353.mount; enabled; vendor preset: enabled)
   Active: active (mounted) since Thu 2019-08-01 16:46:01 CEST; 17min ago
    Where: /snap/lxd/11353
     What: /dev/loop4
  Process: 472 ExecMount=/bin/mount /var/lib/snapd/snaps/lxd_11353.snap /snap/lxd/11353 -t squashfs -o nodev,ro,x-gdu.hide (code=exited, status=0/SUC
    Tasks: 0 (limit: 4915)
   Memory: 40.0K
      CPU: 4ms
   CGroup: /system.slice/snap-lxd-11353.mount

● snap-lxd-11381.mount - Mount unit for lxd, revision 11381
   Loaded: loaded (/etc/systemd/system/snap-lxd-11381.mount; enabled; vendor preset: enabled)
   Active: active (mounted) since Thu 2019-08-01 16:46:00 CEST; 17min ago
    Where: /snap/lxd/11381
     What: /dev/loop19
  Process: 439 ExecMount=/bin/mount /var/lib/snapd/snaps/lxd_11381.snap /snap/lxd/11381 -t squashfs -o nodev,ro,x-gdu.hide (code=exited, status=0/SUC
    Tasks: 0 (limit: 4915)
   Memory: 44.0K
      CPU: 4ms
   CGroup: /system.slice/snap-lxd-11381.mount
lines 1-21/21 (END)

none of the above really speaks to me. also I have seen that other snaps on my system seem to run as usual

@zyga-snapd ^ is this the same thing we saw on my laptop today?

sudo cat /var/snap/lxd/common/lxd/logs/lxd.log

shows one problem

t=2019-08-01T16:46:42+0200 lvl=eror msg="Failed to start the daemon: Failed to start dqlite server: run failed with 13")

which was discussed in the linuxcontainers forum quite recently. Maybe there is a solution in there (which I haven’t quite got to yet)

solution I got in the linked Topic was to

  1. backup /var/snap/lxd/common/lxd/database/
  2. rm /var/snap/lxd/common/lxd/database/global/32824-32868(the name of the file will be different in any instance)
  3. sudo snap refresh lxd --stable