LXC Containers LXD How to Install and Configure Tutorial Ubuntu Debian Mint

If you are using mint, delete the preference that stops snap from installing (as it is required for lxc)

sudo rm /etc/apt//preferences.d/nosnap.pref
 

1. Install lxd:

sudo apt install lxd

Issues install lxd or errors? Click here

 2. Configure lxd

lxd init

#defaults are normally fine

You may want to consider changing storage backend to use "dir" which literally means in the existing userspace, rather than relying on loopback devices with a fixed size (eg. like 30GB we made below).

3.) List Available Images for LXC

#note the colon : at the end below, it is needed or it won't show the available images, but rather images on your machine already which will be none at this point

lxc image list images:

This will show ALL images but perhaps it's not what you want, maybe you just want to see what Debian or Ubuntu is available?

lxc image list images:debian:

There's still a lot of images, let's just say we wanted only Debian 10 images shown?

lxc images list:debian/10

 

4.) Create our first Debian 10 container!

lxc launch images:debian/10 gluster01
Creating gluster01
Starting gluster01        
                  

The above creates a container called "gluster01" with the image "debian/10"

5.) Working with lxc

How can we see what containers are running and what their IPs are?

lxc list

 

Now you can enter and work with gluster01 like this:

Replace gluster01 with your container name.

lxc exec gluster01 bash

 

 

How to Make Config Changes to LXC Containers?

The command below is going to edit the config of container "gluster01" and enable the features security.nesting and security.privileged for more features for other applications like docker.

lxc config set gluster01 security.nesting=1 security.privileged=1
 

 

Issues installing lxd?

Make sure that you use the 4.0 or newer track, as 3.0/older is usually not supported/non-existent and will cause the install to fail:

==> Installing the LXD snap from the 3.0 track for ubuntu-20.2
error: requested a non-existing branch on 3.0/stable for snap "lxd": ubuntu-20.2

Manually install with snap like this to fix it/solution:

snap install lxd --channel=latest/stable

2022-05-20T14:12:05-07:00 INFO Waiting for automatic snapd restart...
lxd 5.1-1f6f485 from Canonical✓ installed



Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  snapd
The following NEW packages will be installed:
  lxd snapd
0 upgraded, 2 newly installed, 0 to remove and 377 not upgraded.
Need to get 34.3 MB of archives.
After this operation, 147 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 snapd amd64 2.54.3+20.04.1ubuntu0.3 [34.3 MB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 lxd all 1:0.10 [5,532 B]
Fetched 34.3 MB in 3s (12.0 MB/s)
Preconfiguring packages ...
Selecting previously unselected package snapd.
(Reading database ... 422832 files and directories currently installed.)
Preparing to unpack .../snapd_2.54.3+20.04.1ubuntu0.3_amd64.deb ...
Unpacking snapd (2.54.3+20.04.1ubuntu0.3) ...
Setting up snapd (2.54.3+20.04.1ubuntu0.3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.apparmor.service → /lib/systemd/system/snapd.apparmor.service.
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.autoimport.service → /lib/systemd/system/snapd.autoimport.service.
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.core-fixup.service → /lib/systemd/system/snapd.core-fixup.service.
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.recovery-chooser-trigger.service → /lib/systemd/system/snapd.recovery-chooser-trigger.service.
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.seeded.service → /lib/systemd/system/snapd.seeded.service.
Created symlink /etc/systemd/system/cloud-final.service.wants/snapd.seeded.service → /lib/systemd/system/snapd.seeded.service.
Created symlink /etc/systemd/system/multi-user.target.wants/snapd.service → /lib/systemd/system/snapd.service.
Created symlink /etc/systemd/system/timers.target.wants/snapd.snap-repair.timer → /lib/systemd/system/snapd.snap-repair.timer.
Created symlink /etc/systemd/system/sockets.target.wants/snapd.socket → /lib/systemd/system/snapd.socket.
Created symlink /etc/systemd/system/final.target.wants/snapd.system-shutdown.service → /lib/systemd/system/snapd.system-shutdown.service.
snapd.failure.service is a disabled or a static unit, not starting it.
snapd.snap-repair.service is a disabled or a static unit, not starting it.
Selecting previously unselected package lxd.
(Reading database ... 422929 files and directories currently installed.)
Preparing to unpack .../archives/lxd_1%3a0.10_all.deb ...
=> Installing the LXD snap
==> Checking connectivity with the snap store
==> Installing the LXD snap from the 3.0 track for ubuntu-20.2
error: requested a non-existing branch on 3.0/stable for snap "lxd": ubuntu-20.2
dpkg: error processing archive /var/cache/apt/archives/lxd_1%3a0.10_all.deb (--unpack):
 new lxd package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/lxd_1%3a0.10_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

 


Tags:

lxc, containers, lxd, install, configure, tutorial, ubuntu, debian, mintif, mint, delete, preference, installing, sudo, rm, etc, apt, preferences, nosnap, pref, errors, init, defaults, backend, quot, dir, existing, userspace, relying, loopback, devices, eg, gb, images, colon, container, gluster, creating, creates, ips, exec, bash, newer, supported, existent, requested, manually, info, snapd, restart, canonical, installed, lists, dependency, additional, packages, upgraded, newly, mb, archives, disk, http, archive, focal, updates, amd, fetched, preconfiguring, selecting, previously, unselected, database, directories, currently, preparing, unpack, snapd_, _amd, deb, unpacking, symlink, systemd, multi, user, apparmor, rarr, lib, autoimport, fixup, chooser, seeded, timers, repair, timer, sockets, socket, shutdown, disabled, static, lxd_, _all, connectivity, dpkg, processing, var, cache, installation, subprocess, encountered, usr, bin,

Latest Articles

  • ssh Too many authentication failures not prompting for password
  • LightDM Mint Ubuntu Debian won't start errors Nvidia Graphics
  • WARNING: Unable to determine the path to install the libglvnd EGL vendor library config files. Check that you have pkg-config and the libglvnd development libraries installed, or specify a path with --glvnd-egl-config-path. Linux Ubuntu Mint Debian E
  • How To Upgrade Linux Mint 18.2 to 18.3 to 19.x and 20.x
  • MP3s Won't Play / ID3 Version 2.4 Issues in Cars and Other MP3 Players/CDs/DVDs Solution
  • LXC Containers LXD How to Install and Configure Tutorial Ubuntu Debian Mint
  • GlusterFS HowTo Tutorial For Distributed Storage in Docker, Kubernetes, LXC, KVM, Proxmox
  • Ubuntu Mint audio output not working pulseaudio "pulseaudio[13710]: [pulseaudio] sink-input.c: Failed to create sink input: too many inputs per sink."
  • How To Shrink Dynamically Allocated VM QEMU KVM VMware Disk Image File
  • How To Enable Linux Swapfile Instead of Partition Ubuntu Mint Debian Centos
  • 404 Not Found [IP: 151.101.194.132 80] apt update Debian 11 Bullseye Solution The repository 'http://security.debian.org bullseye/updates Release' does not have a Release file.
  • WARNING: Can't download daily.cvd from db.local.clamav.net freshclam clamav error solution
  • (firefox:9562): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory) Solution
  • Debian Mint Ubuntu Which Package Provides missing top, ps and w Solution
  • Vbox Virtualbox DNS NAT Network Mode NOT working
  • Docker Tutorial HowTo Install Docker, Use and Create Docker Container Images Clustering Swarm Mode Monitoring Service Hosting Provider
  • Zoom Password Error 'That passcode was incorrect' - Solution Wrong Passcode Wrong Meeting Name
  • How To Startup and Open Remote/Local Folder/Directory in Ubuntu Linux Mint automatically upon login
  • How To Reset Windows Server Password 2019, 2022, 7, 8, 10, 11 Recovery and Removal Guide Using Linux Ubuntu Mint Debian
  • How To Create OpenVPN Server for Secure Remote Corporate Access in Linux Debian/Mint/Ubuntu with client public key authentication