So zfs was alrady mounted for all. I had to recreate some profiles (like X11). Around half of the containers recovered fine, but some didn’t. I see no pattern there. The error is the same (the instance’s dir appears to be empty) but I can confirm that there are all files as expected in /var/snap/lxd/common/lxd/storage-pools/default/containers/mycontainer
lxd init is a wizard that guides you to create a baseline configuration so that you can create containers straight away. If something is missing, like lxdbr0, then you can just create it using lxc network. No need to run lxd init again.
Here is how to re-create lxdbr0, if none exists.
ubuntu@mycontainer:~$ sudo lxc network list
+------+------+---------+-------------+---------+
| NAME | TYPE | MANAGED | DESCRIPTION | USED BY |
+------+------+---------+-------------+---------+
ubuntu@mycontainer:~$ sudo lxc network create lxdbr0
Network lxdbr0 created
ubuntu@mycontainer:~$ sudo lxc network list
+--------+--------+---------+-------------+---------+
| NAME | TYPE | MANAGED | DESCRIPTION | USED BY |
+--------+--------+---------+-------------+---------+
| lxdbr0 | bridge | YES | | 0 |
+--------+--------+---------+-------------+---------+
ubuntu@mycontainer:~$
$ lxc launch ubuntu-minimal:bionic test
Creating test
Error: Failed instance creation: Create instance: Create instance: Invalid devices: Failed detecting root disk device: No root device could be found
I fear there is somethig seriously wrong. I will do a backup of all the containers using `lxc export. Would it then be possible to remove all lxd and zfs and reinstall again (so that the containers keep working incl. services like networking? If that would work, it would be perhaps a good point to get rid of blocked deleted images in zfs eating up my storage.
The first error on the networking says that LXD could not find an unused IPv6 subnet. This is somewhat weird as the address space for IPv6 is rather big. If you do not use IPv6 anyway, you can create lxdbr0 without IPv6 in any case.
The second error says that your default profiles does not mention a storage pool.
Show us the output of
lxc profile show default
Then, run the following to show what storage is there in LXD.
Okay, your profile is missing the two necessary devices as follows.
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
First, you need to create the lxdbr0 network device.
Try with the following,
lxc network create lxdbr0 ipv6.address=none
Then, the storage. The following should show the details of the ZFS pool.
lxc storage show default
Once you have both the lxdbr0 network device running, and the default storage pool, then you can complete the configuration of the default profile, and all should be working.
You need to add both the info about the network and the storage to the default profile.
When you lxc profile show default, you should get an output similar to what I showed above.
Here are the commands to add them to your default LXD profile.
lxc profile device add default eth0 nic nictype=bridged parent=lxdbr0
lxc profile device add default root disk pool=default path="/"