LXD snap broke on my Debian 10 Host

Hi All,

I’m new here so forgive me if I don’t explain my situation too well. Firstly I’ve really been enjoying LXD via the SNAP packages on my Debian 10 server. It’s been running solid for over a 8 months but yesterday it went sour for me. I simply rebooted my Debian 10 server as it had been up for sometime (no updates installed before this reboot). Normally the system comes back and I don’t even have to think about it. However on this occasion something nasty happened and I couldn’t get LXC to work. It was trying to bind to the wrong IP address, even though the host server has a static address in interfaces.conf.

After a lot of reading and troubleshooting late into the night I made the decision that lxd or some component was borked and I would have to reinstall. I’ve reinstalled LXD via snap with success but now face an issue importing my existing containers. I have the directory for each container but can’t seem to work out how one imports these.

Any help would be greatly appreciated,

Kind Regards
James

A sysadmin who’s run out of ideas!

Hi!

First, have a look at https://blog.simos.info/reconnecting-your-lxd-installation-to-the-zfs-storage-pool/

My guess is that you have another service binding on port 53 on lxdbr0. Your other dns service should not bind on lxdbr0.

Hi Simos,

Thank you for coming back to me. I should have mentioned that the storage pool is a directory type.

Please can you describe the directory layout for your storage pool, where is it located?

Hi Tomp,

Thank you.

The directory is as such:
/var/lib/lxc which is mount point from a dataset of my ZFS setup. So the Host OS deals with ZFS and LXC sees /var/lib/lxc as a directory.

Please can you give the output of:

lxc storage ls

Sure, please see below.

:/var/lib/lxc# lxc storage list
+---------+-------------+--------+---------------+---------+
|  NAME   | DESCRIPTION | DRIVER |    SOURCE     | USED BY |
+---------+-------------+--------+---------------+---------+
| default |             | dir    | /var/lib/lxc/ | 0       |
+---------+-------------+--------+---------------+---------+

Contents of that path:
/var/lib/lxc# ls
containers containers-snapshots custom custom-snapshots images virtual-machines virtual-machines-snapshots

Cool, and does the container directory have your containers in it still?

If so, you should be able to do:

sudo lxd import <ctname>

Tomp,

Thank you, they do however this happens.

lxc import sweeping-bear
Error: open /var/lib/snapd/hostfs/var/lib/lxc/sweeping-bear: no such file or directory

Contents of containers:
/var/lib/lxc/containers# ls
boss-akita eager-yeti happy-gar pleasant-wahoo sweeping-bear

lxd import, not lxc import.

1 Like

Oh my dear lord, I’m so sorry to have wasted your time. Thank you for pointing that out! That works, a final question if I may?

I’d like to attach my publicip profile to a network interface so my router can hand out the IP’s. I can’t for the life of me remember how to do that:

lxc network attach-profile publicip eth0 enp1s0f0

doesn’t work for me.

No problem, its easy to miss :slight_smile:

Can I see the publicip profile in question please? Also how are you handing out IPs to your containers from the router?

I think the issue here is that lxc network attach-profile is for attaching an LXD managed network to a profile with a specific interface name.

So in this case, publicip is the network name, and eth0 is the profile name, and enp1s0f0 is the interface name inside the profile, which doesn’t look right.

See https://stgraber.org/2016/10/27/network-management-with-lxd-2-3/

1 Like

Tomp,

Thank you for all your help so far. It’s been a long 24 hours for me. Essentially I have a VLAN for my public IP space. Each container has a static IP assigned within the /etc/network/interfaces file. I then used to just pass through the physical interface on the host machine (it has several nics).

I seem to remember somehow assigning the physical interface to the profile.

Currently the publicip profile looks like this:
lxc profile show publicip 
    config: {}
    description: ""
    devices: {}
    name: publicip
    used_by:
    - /1.0/instances/sweeping-bear

I think you would either need to create a bridge to your vlan interface and attach each container to the bridge, or use a macvlan device type that parents off of the vlan interface.

1 Like

Tomp,

Thank you for all your help. I owe you many beers! I’ve used the following:

  eth0:
  name: eth0
  nictype: macvlan
  parent: enp1s0f0
  type: nic

All is working as it did before. Thank you for your patience.

Have a great day!