Downgrade lxd from snap from edge to stable

Ubuntu 18.04. I had installed lxd from snap edge:

snap switch --channel edge lxd 
snap install lxd

# lxc info | grep version
api_version: "1.0"
  driver_version: 3.1.0 (devel)
  kernel_version: 4.15.0-52-generic
  server_version: "3.14"
  storage_version: 0.8.1-0york1~18.04

Now I want to switch to snap stable:

snap switch --channel stable lxd 
snap refresh

lxc info | grep version
api_version: "1.0"
  driver_version: 3.1.0
  kernel_version: 4.15.0-52-generic
  server_version: "3.14"
  storage_version: ""

And lxc list shows empty list of containers. Switched back to edge and containers are available again.

How to correct downgrade lxd from edge to stable channel?

LXD downgrades aren’t supported. If you’re lucky our database hasn’t changed and they work, but as is the case right now, edge was moved to a completely different database backend than what’s in stable, so there’s no way back from edge to stable.

The only time where you can safely jump from edge back to stable is immediately after a new release hits stable as at that one specific time, they’re both equal and it’s therefore not a downgrade.

So in your case, it should be safe to switch to stable on Monday after we push LXD 3.15 to stable (assuming no delays due to last minute issues).

I performed the downgrade from edge to stable about a week ago and got the same issue (empty container list, no configuration).
I performed the recovery steps found in the documentation and wrote about it in some detail at

Can you shed some light into this, why ‘I had’?

@stgraber I successfully updated from edge to 3.15 with

snap switch --channel candidate lxd 
snap refresh

Now everything looks fine.

Then I did

apt remove --purge lxd lxd-client liblxc1 lxcfs

as recommended on https://github.com/lxc/lxd/issues/4757

Should I install something from snap now? How to be sure everything is correct?

# ps -ef | grep lxcfs
root      2036     1  0 05:07 ?        00:00:00 lxcfs /var/snap/lxd/common/var/lib/lxcfs -p /var/snap/lxd/common/lxcfs.pid

# file /var/snap/lxd/common/var/lib/lxcfs
/var/snap/lxd/common/var/lib/lxcfs: broken symbolic link to /var/snap/lxd/common/shmounts/lxcfs

# lxcfs --version
-bash: lxcfs: command not found

Is this ok?

Also (not sure if I should lxd.migrate but looks not ok)

# lxd.migrate
=> Connecting to source server
error: Unable to connect to the source LXD: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory

lxd.migrate can only be used prior to removing the deb version of LXD, so assuming you didn’t have any data prior to switching to the snap, you don’t need to do anything with that.

lxcfs not being an available command is perfectly normal, it’s a service and is hidden away in the LXD snap, so that should work just fine.