Issues setting up LXD 3.0.1

I’m trying to set up LXD on Ubuntu 18.04 (clean install, no prior LXC/D) but am running into some issues.

I ran sudo lxd init with limited success:

  • bridge creation failed with Failed to automatically find an unused IPv6 subnet, manual configuration required, so I did that manually with ipv6.address=none.

  • Btrfs subvolume does NOT get created for the user, as the storage prompts (imo) suggest. I had to do it manually, i.e.

    # Btrfs
    sudo btrfs subvolume create /path/to/btr-store/lxc
    sudo lxc storage create lxc btrfs source=/path/to/btr-store/lxc

Now I still have the following roadblocks:

  • ~/.config/lxc is owned by root with rwxr-x--- permissions. Is that correct? It means that I cannot invoke lxc without superuser permissions.
  • Creating a container, I get Error: Failed container creation: No root device could be found.

Any suggestions welcome.

The permission issue for ~/.config/lxc is because lxd init was run through sudo.
sudo chown -R your-user:your-user ~/.config/lxc should fix that.

The IPv6 error suggests that you had an odd IPv6 route at the time which was covering the entirety of the ULA range, making LXD fail to find an unused one for you. When that happens you either need to choose one by hand or indeed use none to just disable IPv6 on the bridge.

The storage issue is odd and is something we’ve not seen anyone report before. It’d be great if you could show the entire output of that lxd init run. If you are to run this again on a similar system, please record that output as well as the YAML that it offers to show you at the end.

To fix your storage for now, you can do:

lxc profile device add default root disk path=/ pool=lxc

Which will tie your manually created storage pool with the default profile.

Hello Stéphane, thanks for the fast reply.

I’ll chown back to my $USER. Generally speaking, should one run lxd init with sudo or better not? I presume if one wishes to use the init script to set up bridge, storage, routing, then that’s required.

Regarding storage, is path relative to the default storage backend, so that path=/ implies path=/path/to/btr-store (btrfs top-level) and pool refers the subvolume?

Here’s is how my default profile looks like now:

$ lxc profile show default 

config: {}
description: Default LXD profile
    nictype: bridged
    parent: lxcbr0
    type: nic
    name: eth0
    nictype: bridged
    parent: lxcbr0
    type: nic
root:   # newly added now
  path: /
  pool: lxc
  type: disk
name: default
used_by: []

Any idea about the eth0 entry? My only nic is eno1 and lxc network list shows:

| eno1   | physical | NO      |             | 0       |
| lxcbr0 | bridge   | YES     |             | 0       |

lxd init talks over the LXD API, it doesn’t perform any system change itself and so doesn’t require sudo privileges. At least that’s true for LXD 3.0 and higher, this was different with LXD 2.0.

path=/ means that the container’s root will be stored on that storage pool, so it has to be path=/ for this device.

As for network, you should be removing that eno1 device from your default profile, the eth0 one looks correct assuming you do want to use your existing lxcbr0 bridge.

Are you sure? Is eth0 representative of the first nic in LXD? On my host, my physical nic is named eno1 as I mentioned.

Edit: It was able to delete the eno1 entry through lxc profile device remove default eno1. I had tried the wrong command before.

eth0 here is the name that’ll be used inside the container and is generally what containers expect it to be called.
That doesn’t need to match the name of the device on the host.

1 Like

Still having issues, presumably with storage:

$ lxc launch images:alpine/3.8 a1
Creating a1
Error: Failed container creation: no such file or directory

$ lxc storage show lxc
  source: /media/adrian/btr-store/lxc
  volatile.initial_source: /media/adrian/btr-store/lxc
description: ""
name: lxc
driver: btrfs
- /1.0/containers/a1
- /1.0/profiles/default
status: Created
- none

$ lxc launch images:alpine/3.8 a1
Creating a1
Error: Failed container creation: UNIQUE constraint failed:

Do I need to add these properties manually? The lxc subvolume is owned by my user.

You know what, I’ll reinstall LXD fresh and start over. I suspect the fact that lxd init didn’t run smoothly had some configuration side-effects that made things harder. I’ll start a new topic.