[LXD 4.1] Reset LXD init


I unsucessfuly tried to reset lxd after making an error on the lxd init process. How can I do that ?

What do you want changed?

lxd init is only a convenient way to do a bunch of commands at once:

  • lxc config set
  • lxc network create
  • lxc storage create
  • lxc profile device add

So it’s often far easier to undo and reconfigure the bits you need than wipe everything clean and run init again.

Oh cool. I have an issue at this time with my first container tested. I doesn’t have an IPv4 and just an IPv6…
But It is my first test an I think is probably due to a bad typo filled during the lxd init.

Thanks for this anwser. I going to check that. :slight_smile:

lxc network show lxdbr0

Also, can you show:

  • ps fauxww
  • iptables -L -n -v

If I had to guess, your lxd init went fine but you have docker or firewalld messing with your firewall blocking DHCP from your container.

the ps fauxww and iptables command will be from the container or from the host ?

From the host.


Better like this:

Is that Fedora 32?

Yes it is. The installation is from the lxd snap

Ok, so I suspect firewalld is the issue here and it’s preventing traffic from the LXD containers, in this case your DHCP traffic.

We have a section on how to convince firewalld to play nice here:

Ok. Thanks I give you a feeback after testing that :+1:

I had seen the purposed article to fix firewalld issues. It is explain that the problem is because lxd daemon start before the firewall. But is it more better to fix that by forcing the daemon to start after the firewalld ?

The firewall service may get restarted at a later point and break LXD again, so its better to fix the rules themselves.

1 Like

Right. Thank you for this anwser. I had missed this posibility :man_facepalming:

Not for a newcomer, I guess. When I create a storage, which options should I specify?.. When add a device to a profile?..

Do you want to remove lxd and reinstall?

I stuck to the defaults when doing lxd init, but then realized that btrfs storage is size-constrained. So I wanted to replace it with a dir storage (which supposedly doesn’t run out of space as long as your host volume doesn’t). And I probably did, I’m just not sure about the options when doing lxc storage create and lxc profile device add.

P.S. Knowing how to reinstall would be of benefit as well.

You can remove LXD (including all container and VM instances!) by running:

sudo snap remove lxd --purge

You can add a new dir storage pool using:

lxc storage add mypool dir

This will use the /var/lib/lxd/storage-pools/mypool directory for instances.
If you want to use a different directory add the source=/path/to/dir argument to the command above.

Then you can create instances using that pool using:

lxc launch ... -s mypool

If you want that pool to be the default pool for new instances you can modify the default profile using:

lxc profile device set default root pool=mypool
1 Like

Any suggestions for non-snap installs? In my case that would be Arch Linux:

$ pacman -Rs lxd
$ rm -rf /var/{lib,cache}/lxd


And to replace the default pool:

$ lxc storage create newpool dir
$ lxc profile device set default root pool=newpool
$ lxc storage delete prvpool


What I did is supposedly:

$ lxc profile device remove default root
$ lxc storage delete default
$ lxc storage create default dir
$ lxc profile device add default root disk pool=default path=/

This way the pool name is preserved (for what it’s worth).