LXC config problem...Need Help

Hi LXC group. I need some help with a problem.
I currently run 28 containers on a Ubuntu 18.10 server.
I downgraded my Ubuntu version from 18.10 to 18.04LTS
All went fine. During my downgrade, I made a mistake and selected to update certain files to package maintainers version.
I now cannot use lxc list or any other commands as the system does not think it has any containers.
I know they are still there and working because I can view them all through my lxdui interface.
I just cannot access them from cli any more.
Perhaps my downgrade erased a lxd/lxc config file?
How can I get back to seeing and accessing my containers through cli?
Any help would be appreciated.
Currently, all my containers are installed here:
root@oieieio:/var/snap/lxd/common/lxd

You need to uninstall the lxc client tools, @simos probably has a guide

1 Like

Hiya!

Most likely you got the deb package of LXD (3.0.1) installed during the downgrade, therefore when you run lxc list, you are invoking the lxc from the deb package and not from the snap.

To verify if what I say holds water, both of the following should work on your system.

LXD_SOCKET=/var/snap/lxd/common/lxd/unix.socket lxc list
/snap/bin/lxc list
1 Like

Fantastic! Both those commands worked like a charm.
Thank you very very much.

Is their an easy way to get back to using the standard commands or migrate the snap containers so I can use lxc from deb package?

My intent is to learn more about containers and their many wonderful setups. I am very happy with the platform and it really has changed the way I work and develop software. LXC containers are awesome!

You had LXD 3.18 as a snap package and when you downgraded to Ubuntu 18.04, you still have LXD 3.18 (snap) and happened to install the deb package of the server (lxd) and the client (lxd-client). But those last packages are not used or required.

If you decided to migrate from snap package to deb package, you would mess up LXD very badly. Because you would be doing a big downgrade from 3.18 to 3.0, and as far as I remember there have been some extensive changes in database files and elsewhere. The fact that you could use the deb version of the lxc client over to the snap version of the LXD server is just a result of the API for listing being the same. Other things probably changed.

So, what can you do now? You can remove the package lxd-client and the the client from the snap will take precedence in the $PATH. You may have to logout and login again, if your shell does caching for the available executables.

You can also remove the lxd deb package. It is not used. Once you perform both removals, do sudo apt autoremove to clear up other unneeded packages.

1 Like

Ok, thanks again…I still have the snap package…works great!

I’ll remove the deb package installed during the downgrade and clear up the path.

lxd/bionic,now 3.0.0-0ubuntu4 amd64 [installed]
lxd-client/bionic,now 3.0.0-0ubuntu4 amd64 [installed,automatic]

I appreciate your help Simos

apt-get remove lxd
apt-get remove lxd-client
apt update && apt upgrade
apt autoremove

then logged out of server and logged back in.

Your solution worked perfectly…again!

All hail Simos :wink:

root@oieieio:~# lxc profile list
±--------±--------+
| NAME | USED BY |
±--------±--------+
| default | 28 |
±--------±--------+
root@oieieio:~# lxd version
3.18

1 Like

Thank you for reaching out.

Your certainly pointed me in the right direction! :slight_smile:

1 Like