In the process of writing a multi-node containerized management system/daemon & have mainly replacing my Docker implementation with LXC & have ran into a few issue when spawning a few container instances during my integration tests.
OS: Fedora Workstation 37
Kernel: 6.5.10
LXC Version: 4.0.12
So far I have written that my deamon software runs the following line on the node to create a new container. This completes successful with a new container.
// Will later remove --template download with a local copy.
// Written software picks rockylinux 8
sudo lxc-create --template download --name test-container
After the following the application will run this.
sudo lxc-start --daemon --name test-container -f $HOME/.config/lxc/default.conf --logfile ./log
lxc-start
throws an error stating the following in the logfile
lxc-start test-container 20231204203657.326 ERROR conf - conf.c:bind_mount_console:1942 - No such file or directory - Failed to open "/dev/pts/4"
lxc-start test-container 20231204203657.327 ERROR conf - conf.c:lxc_setup_dev_console:1996 - No such file or directory - Failed to mount "10(/dev/pts/4)" on "25"
lxc-start test-container 20231204203657.327 ERROR conf - conf.c:lxc_setup_console:2152 - No such file or directory - Failed to setup console
lxc-start test-container 20231204203657.327 ERROR conf - conf.c:lxc_setup:4429 - Failed to setup console
lxc-start test-container 20231204203657.327 ERROR start - start.c:do_start:1275 - Failed to setup container "test-container"
lxc-start test-container 20231204203657.327 ERROR sync - sync.c:sync_wait:34 - An error occurred in another process (expected sequence number 4)
lxc-start test-container 20231204203657.327 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:877 - Received container state "ABORTING" instead of "RUNNING"
lxc-start test-container 20231204203657.327 ERROR lxc_start - tools/lxc_start.c:main:306 - The container failed to start
lxc-start test-container 20231204203657.327 ERROR lxc_start - tools/lxc_start.c:main:309 - To get more details, run the container in foreground mode
lxc-start test-container 20231204203657.327 ERROR lxc_start - tools/lxc_start.c:main:311 - Additional information can be obtained by setting the --logfile and --logpriority options
lxc-start test-container 20231204203657.327 ERROR start - start.c:__lxc_start:2074 - Failed to spawn container "test-container"
I am extremely confused as to why this is happening, I really can’t find any information in the man pages or even the documentation if you can even call it that. I see that the conf.c:bind_mount_console:1924
is throwing the error about no directory /dev/pts/4
.
My assumption was that adding the line lxc.autodev = 1
would create this directory for me.
Running LXC as my underlying containerized application runtime has proven to be a bit harder than expected. I only chose this path since I was unsure if I wanted to write a raw implementation using chroot jail
type of application isolation approach.
Best regards !
__
My default config consists of the following lines; along with other configs for LXC
default.conf
# Setup
lxc.arch = amd64
lxc.ephemeral = 0
lxc.net.0.type = veth
lxc.net.0.veth.mode = bridge
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
lxc.autodev = 1
# Mounting points
lxc.mount.auto = proc:rw sys:rw cgroup-full:rw
/etc/lxc/lxc-usernet
proxy001 veth virbr0 25