The LXD tutorials of Simos



I gave this a try, running LXD as a snap.
It appears that it cannot find the character device, and it might be related to the fact that /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 is a symbolic link?

$ ls -l /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
lrwxrwxrwx 1 root root 13 Σεπ  28 14:59 /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 -> ../../ttyUSB0

$ lxc config device add esp32 ttyUSB0 unix-char source=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 path=/dev/ttyUSB0 major=188 minor=0 uid=0 gid=20 mode=666
Error: not found
Exit 1

(Stéphane Graber) #22

Hmm, odd, I have this working fine on a few systems, I’ll have to take a look at what may be wrong in this case.


Sorry for this. I just realized that I had used the wrong container name. The not found apparently refers here to container not found rather than source not found.

$ lxc config device add esp32gui ttyUSB0 unix-char source=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 path=/dev/ttyUSB0 major=188 minor=0 uid=0 gid=20 mode=666
Device ttyUSB0 added to esp32gui

Recently there was another case of a user that got the Error: not found message and got similarly confused. Would you accept patches to change the error message to something more verbose? Either one of the two following message formats:

  1. Error: container not found
  2. Error: container esp32 not found

I would opt for the second, as it also shows what is considered to be the bad name.

(Stéphane Graber) #24

For a long time we couldn’t do this because the server only had one constant NotFound return value which didn’t let us provide additional context, but this has recently been fixed by @monstermunchkin so in theory the right NotFound(nil) could be tracked down in the code base and the error message be tweaked to something more sensible.


Added the following four-part series on running LXD on, on the AMD EPYC 24-core baremetal server (48 threads).

  1. A closer look at AMD EPYC baremetal servers at
  2. Booting up the AMD EPYC baremetal server at
  3. Configuring LXD on the AMD EPYC baremetal server at
  4. Benchmarking LXD on an AMD EPYC server at

The third post is about setting up LXD on the server. I tried here LXD 3.0.2 (from bionic-backports).

The fourth post is about benchmarking LXD with lxd-benchmark.

Some interesting LXD information:

  1. Creating more than 1024 containers (with networking) is a problematic issue. There is a Linux kernel hard limit to the number of IP address on a bridge. To bypass the limit, you need to recompile, or not use a bridge.
  2. If you create too many containers than your computer can handle (memory, perhaps CPU), then you cause this type of kernel error. The memory was exhausted but it could also be an issue with too many processes for the scheduler to handle. Would need to perform again in order to grab some useful logs.
[ 1450.993972] INFO: task systemd:1 blocked for more than 120 seconds.
[ 1451.000279] Tainted: P O 4.15.0-36-generic #39-Ubuntu
[ 1451.007094] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1451.014957] systemd D 0 1 0 0x00000000
[ 1451.014960] Call Trace:
[ 1451.014969] __schedule+0x291/0x8a0
[ 1451.014971] schedule+0x2c/0x80
[ 1451.014973] schedule_preempt_disabled+0xe/0x10
[ 1451.014974] __mutex_lock.isra.2+0x18c/0x4d0
[ 1451.014976] __mutex_lock_slowpath+0x13/0x20
[ 1451.014978] ? __mutex_lock_slowpath+0x13/0x20
[ 1451.014979] mutex_lock+0x2f/0x40
[ 1451.014982] proc_cgroup_show+0x4c/0x2a0
[ 1451.014985] proc_single_show+0x56/0x80
[ 1451.014988] seq_read+0xe5/0x430
[ 1451.014990] __vfs_read+0x1b/0x40
[ 1451.014991] vfs_read+0x8e/0x130
[ 1451.014992] SyS_read+0x55/0xc0
[ 1451.014995] do_syscall_64+0x73/0x130
[ 1451.014997] entry_SYSCALL_64_after_hwframe+0x3d/0xa2


Added tutorial on distrobuilder,

It’s an introduction to distrobuilder, shows how to install it and then create a container image for Ubuntu.

It expands a bit on the content found in at


In this tutorial we see how we create a minimal configuration file that can be used to generate a container image.

Sort of like a HelloWorld for distrobuilder.

The generated container image is based on Alpine Linux, and takes a couple of seconds to get generated.