Subject: lxc-start ERROR and segfault

From: Stefan Hartmann <[email-masked]>
Date: Fri, 20 Nov 2020 18:52:07 +0100

Hi,

I am trying to set up LXC on a Alpine Host 3.12.1 (for testing purposes 
on VMw Wokstation 15, vHw 11)

The error apperars on Alpine >= 3.11, it works on 
alpine-extended-3.10.5-x86_64.iso!

For narrowing the issue I did a fresh install from 
alpine-extended-3.11.0-x86_64.iso
with setup-alpine and sys setup.

Then apk add lxc lxc-doc lxc-download

apk -v info | grep ...
     musl-1.1.24-r3
     musl-utils-1.1.24-r3

     lxc-libs-3.2.1-r2
     lxc-3.2.1-r2
     lxc-openrc-3.2.1-r2
     lxc-doc-3.2.1-r2
     lxc-download-3.2.1-r2

Then rc-update add cgroups && reboot

Then /usr/share/lxc/templates/lxc-download --list

and lxc-create -t /usr/share/lxc/templates/lxc-download -n CONTVM1 -- -d 
alpine -r 3.11 -a amd64

sucessfully created a container.

But starting ...

# lxc-start -n CONTVM1
     lxc-start: CONTVM1: lxccontainer.c: wait_on_daemonized_start: 864 
No such file or directory - Failed to receive the container state
     lxc-start: CONTVM1: tools/lxc_start.c: main: 329 The container 
failed to start
     lxc-start: CONTVM1: tools/lxc_start.c: main: 332 To get more 
details, run the container in foreground mode
     lxc-start: CONTVM1: tools/lxc_start.c: main: 334 Additional 
information can be obtained by setting the --logfile and --logpriority 
options

# lxc-start -n CONTVM1  -F -l DEBUG -o /tmp/$$.log
lxc-start: CONTVM1: cgroups/cgfsng.c: mkdir_eexist_on_last: 1279 File 
exists - Failed to create directory 
"/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1"

       lxc-start: CONTVM1: cgroups/cgfsng.c: 
monitor_create_path_for_hierarchy: 1300 Failed to create cgroup 
"/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1"
                                               lxc-start: CONTVM1: 
cgroups/cgfsng.c: cgfsng_monitor_create: 1389 Failed to create cgroup 
"/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1"

                                     Segmentation fault

# in the logfile
lxc-start CONTVM1 20201120171101.110 INFO     start - 
start.c:lxc_init:932 - Container "CONTVM1" is initialized
lxc-start CONTVM1 20201120171101.110 ERROR    cgfsng - 
cgroups/cgfsng.c:mkdir_eexist_on_last:1279 - File exists - Failed to 
create directory "/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1"
lxc-start CONTVM1 20201120171101.110 ERROR    cgfsng - 
cgroups/cgfsng.c:monitor_create_path_for_hierarchy:1300 - Failed to 
create cgroup "/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1"
lxc-start CONTVM1 20201120171101.111 ERROR    cgfsng - 
cgroups/cgfsng.c:cgfsng_monitor_create:1389 - Failed to create cgroup 
"/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1"
lxc-start CONTVM1 20201120171101.111 ERROR    cgfsng - 
cgroups/cgfsng.c:mkdir_eexist_on_last:1279 - File exists - Failed to 
create directory "/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1-1"
lxc-start CONTVM1 20201120171101.111 ERROR    cgfsng - 
cgroups/cgfsng.c:monitor_create_path_for_hierarchy:1300 - Failed to 
create cgroup "/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1-1"
lxc-start CONTVM1 20201120171101.112 ERROR    cgfsng - 
cgroups/cgfsng.c:cgfsng_monitor_create:1389 - Failed to create cgroup 
"/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1-1"
lxc-start CONTVM1 20201120171101.112 ERROR    cgfsng - 
cgroups/cgfsng.c:mkdir_eexist_on_last:1279 - File exists - Failed to 
create directory "/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1-2"
lxc-start CONTVM1 20201120171101.112 ERROR    cgfsng - 
cgroups/cgfsng.c:monitor_create_path_for_hierarchy:1300 - Failed to 
create cgroup "/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1-2"
lxc-start CONTVM1 20201120171101.112 ERROR    cgfsng - 
cgroups/cgfsng.c:cgfsng_monitor_create:1389 - Failed to create cgroup 
"/sys/fs/cgroup/openrc//lxc.monitor/CONTVM1-2"

# Debug with strace
# strace /usr/bin/lxc-start -n CONTVM1 -F
...
stat("/sys/devices/system/cpu/isolated", {st_mode=S_IFREG|0444, 
st_size=4096, ...}) = 0

                     open("/sys/devices/system/cpu/isolated", O_RDONLY) = 9
                                         read(9, "\n", 1024) 
         = 1
 
            read(9, "", 1024)                       = 0
 
                                                       close(9) 
                       = 0

                          stat("/sys/devices/system/cpu/offline", 
{st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
      open("/sys/devices/system/cpu/offline", O_RDONLY) = 9
                                                           read(9, 
"1-127\n", 1024)                = 6
 
                              read(9, "", 1024)                       = 0

close(9)                                = 0

open("/sys/fs/cgroup/cpuset//lxc.monitor/cpuset.cpus", 
O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 9
                                      fcntl(9, F_SETFD, FD_CLOEXEC) 
      = 0
 
         write(9, "0\n", 2)                      = 2
 
                                                    close(9) 
                    = 0

                       --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, 
si_addr=NULL} ---

                  +++ killed by SIGSEGV +++
         Segmentation fault

#alpine3110:~# CONFIG=/boot/config-lts lxc-checkconfig
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
newuidmap is not installed
newgidmap is not installed
Network namespace: enabled

--- Control groups ---
Cgroups: enabled

Cgroup v1 mount points:
/sys/fs/cgroup/openrc
/sys/fs/cgroup/cpuset
/sys/fs/cgroup/cpu
/sys/fs/cgroup/cpuacct
/sys/fs/cgroup/blkio
/sys/fs/cgroup/memory
/sys/fs/cgroup/devices
/sys/fs/cgroup/freezer
/sys/fs/cgroup/net_cls
/sys/fs/cgroup/net_prio
/sys/fs/cgroup/hugetlb
/sys/fs/cgroup/pids

Cgroup v2 mount points:
/sys/fs/cgroup/unified

Cgroup v1 systemd controller: missing
Cgroup v1 clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled, not loaded
Macvlan: enabled, not loaded
Vlan: enabled, not loaded
Bridges: enabled, not loaded
Advanced netfilter: enabled, not loaded
CONFIG_NF_NAT_IPV4: missing
CONFIG_NF_NAT_IPV6: missing
CONFIG_IP_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_IP6_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, not loaded
CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, not loaded
FUSE (for use with lxcfs): enabled, not loaded

--- Checkpoint/Restore ---
checkpoint restore: missing
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: enabled
CONFIG_INET_DIAG: enabled
CONFIG_PACKET_DIAG: enabled
CONFIG_NETLINK_DIAG: enabled
File capabilities:

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

Nb: the output is the same as for a functional Alpine 3.10.5 installation.

# Q?
Is there some adjustment necessary?
eg CPU?

Or is this a know lib incompatibility?

Interestingly it works without any problems with Alpine <= 3.10.5!

Perhaps I will try a physical install.

Nb
I really enjoy Alpine Linux as a perfect small system for a low-level 
virtualization HOST, it works like a charm with qemu-kvm, but not yet 
with lxc withour downgrading :-(

--
Stefan Hartmann