Lxc commands not working - command lxc not found

Hello,

Today, i was trying to list my containers and suddenly after trying to execute “lxc list” the output.

Command ‘lxc’ not found, but can be installed with:

snap install lxd # version 4.10, or
apt install lxd-client

See ‘snap info lxd’ for additional versions.

Server thinks that lxc is not installed and i’m not sure what might have happened. Thank you in advance for your help!

Have you checked whether lxd is still installed?

Run ‘snap info lxd’.

Also what are you exactly trying to do?
Do you run the command on the server directly?
Or do you want to run the lxc on a seperate computer to connect to a server?

Hi @toby63,

lxd is still install via snap. I’m trying to run lxc commands from the host but the output is as posted above. Also, installing lxd-client doesn’t help.

Ok, very strange.

It could be possible that the command is not linked correctly.
I guess you can look up the correct path to lxc in the snap documentation.

Also, installing lxd-client doesn’t help.

Don’t install that; the lxd client (lxc) is installed along with snap install lxd.

It looks like lxd somehow was disabled.

snap list outputs this:

Name Version Rev Tracking Publisher Notes
core 16-2.48.2 10583 latest/stable canonical✓ core
core18 20201210 1944 latest/stable canonical✓ base
glances 3.1.5 902 latest/stable nicolargo -
lxd 4.10 18884 latest/stable canonical✓ disabled

and snap changes outputs this:

ID Status Spawn Ready Summary
65 Doing 2 days ago, at 16:11 EST - Auto-refresh snap “lxd”

I’ve tried so far:
1.- snap refresh lxd
error: cannot refresh “lxd”: refreshing disabled snap “lxd” not supported
2.- snap enable lxd
error: snap “lxd” has “auto-refresh” change in progress

3.- snap refresh core
snap “core” has no updates available

4.- snap install core
snap “core” is already installed, see ‘snap help refresh’

5.- snap refresh core --edge
“this has been spinning at least 10 mins”

It looks like something happend during the auto-refresh of snapd but i’m not sure about this.

Try:

sudo snap start --enable lxd.daemon

via: https://snapcraft.io/docs/service-management
(I admit, it is a bit hidden, docs could have a slightly better structure)

I’m not sure why this happened yet but after rebooting everything is back. I just accessed my container from the host using lxc command. But this might be a temporary fix and i will keep an eye on this.

Thanks for your help @toby63

1 Like