User Tools

Site Tools


lxd

LXD

I've had problems getting containers to exist on my local lan, meaning I can ssh to them and they can ssh to other systems on the lan, ever since OpenVZ stopped being available on Ubuntu. It was automatic with OpenVZ. It just worked. Lxc, lxd, kvm and others requires big hoops and I fought for sometimes weeks to get it working. I followed instructions from many sources with some (eventual) success. So the other day I embarked on doing it yet again. This time I'm documenting it. I had a bunch of false starts.

I started with a fresh install of Mint 21 on a spare system. I first used timeshift to create a backup of the system, which really worked well. I had a number of failures that I rectified by restoring the timeshift snapshot.

What finally worked, after a fashion was following the instructions in this link: https://www.heiko-sieger.info/define-a-network-bridge-using-ubuntus-linux-mints-network-manager-application/

Step 7 (see the page) showed different information but it worked never the less.

That actually built a bridge that eventually let me generate a container on the lan. Here are the steps following the successful bridge building.

Lxd is apparently only available by using snap to install it. Mint really doesn't like snap. Unless you plan on compiling snap from source the only way I know of to get it installed is using the following:

rm /etc/apt/preferences.d/nosnap.pref
apt install snapd

With that done, we can install lxd

snap install lxd

We have to initialize lxd via:

root@MSI:~# lxd init

Would you like to use LXD clustering? (yes/no) [default=no]: Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: 
Name of the storage backend to use (btrfs, dir, lvm, zfs, ceph) [default=zfs]: 
Create a new ZFS pool? (yes/no) [default=yes]: 
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: 
Size in GB of the new loop device (1GB minimum) [default=30GB]: 
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: bridge0
Would you like the LXD server to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]: 
Port to bind LXD to [default=8443]: 
Trust password for new clients: 
Again: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: 
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: 

In the above exchange I used the “bridge0” bridge name since that's what the bridge was called when I followed the bridge construction post I mentioned earlier. The bridge question was the only deviation from default in the above exchange.

I then installed Ubuntu 22.04.

lxc launch ubuntu:22.04
Creating the instance
Instance name is: evident-jaguar              
Starting evident-jaguar
root@MSI:~# lxc list           
+----------------+---------+----------------------+----------+-----------+-----------+
|      NAME      |  STATE  |         IPV4         |  IPV6    |   TYPE    | SNAPSHOTS |
+----------------+---------+----------------------+----------+-----------+-----------+
| evident-jaguar | RUNNING | 192.168.2.181 (eth0) |   <del>  | CONTAINER | 0         |
+----------------+---------+----------------------+----------+-----------+-----------+

Lo and behold, the container appears to have a ip on the lan! Success. Further testing showed it was truly working on the lan.

lxd.txt · Last modified: 2022/08/20 14:50 by admin