Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 639092 - lxd cannot start the containers
Summary: lxd cannot start the containers
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Joonas Niilola
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-28 19:02 UTC by Luca Barbato
Modified: 2020-12-15 07:21 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Barbato gentoo-dev 2017-11-28 19:02:56 UTC
relevant ebuilds
[ebuild   R    ] app-emulation/lxc-2.0.8::gentoo  USE="seccomp -cgmanager -doc -examples -lua -python (-selinux)" PYTHON_TARGETS="python3_4 -python3_5 -python3_6" 0 KiB
[ebuild   R    ] app-emulation/lxd-2.18::gentoo  USE="daemon dnsmasq ipv6 nls {-test}" 0 KiB

testcase

lxd started by openrc after lxd init as suggested by the wiki

localhost ~ # lxc launch images:gentoo
Creating the container
Container name is: present-pipefish
Starting present-pipefish
error: Failed to run: /usr/sbin/lxd forkstart present-pipefish /var/lib/lxd/containers /var/log/lxd/present-pipefish/lxc.conf:
Try `lxc info --show-log local:present-pipefish` for more info
localhost ~ # lxc info --show-log local:present-pipefish
Name: present-pipefish
Remote: unix://
Architecture: x86_64
Created: 2017/11/28 18:42 UTC
Status: Stopped
Type: persistent
Profiles: default

Log:

            lxc 20171128184309.403 ERROR    lxc_start - start.c:lxc_spawn:1182 - Failed to set up id mapping.
            lxc 20171128184309.289 WARN     lxc_conf - conf.c:lxc_delete_network:3095 - Failed to remove "veth83FCE2" from host: Invalid argument.
            lxc 20171128184309.293 ERROR    lxc_start - start.c:__lxc_start:1354 - Failed to spawn container "present-pipefish".
            lxc 20171128184309.572 ERROR    lxc_conf - conf.c:run_buffer:408 - Script exited with status 1.
            lxc 20171128184309.572 ERROR    lxc_start - start.c:lxc_fini:546 - Failed to run lxc.hook.post-stop for container "present-pipefish".
            lxc 20171128184309.572 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:177 - Command get_cgroup failed to receive response: Connection reset by peer.
            lxc 20171128184309.572 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:177 - Command get_cgroup failed to receive response: Connection reset by peer.
            lxc 20171128184309.576 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.576 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/openrc//lxc/present-pipefish
            lxc 20171128184309.580 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.580 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpuset//lxc/present-pipefish
            lxc 20171128184309.584 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.584 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpu//lxc/present-pipefish
            lxc 20171128184309.589 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.589 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpuacct//lxc/present-pipefish
            lxc 20171128184309.595 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.595 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/blkio//lxc/present-pipefish
            lxc 20171128184309.600 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.600 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/memory//lxc/present-pipefish
            lxc 20171128184309.605 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.605 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/devices//lxc/present-pipefish
            lxc 20171128184309.610 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.610 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/freezer//lxc/present-pipefish
            lxc 20171128184309.615 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.615 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/net_cls//lxc/present-pipefish
            lxc 20171128184309.619 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.619 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/perf_event//lxc/present-pipefish
            lxc 20171128184309.624 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171128184309.624 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/hugetlb//lxc/present-pipefish
            lxc 20171128184309.628 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
lxc 20171128184309.628 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/pids//lxc/present-pipefish


lxc-create -t gentoo -n builder -f /etc/lxc/default.conf
lxc-start -n builder
lxc-attach -n builder

just work fine.

kernel 4.14.2-gentoo
Comment 1 Aaron W. Swenson gentoo-dev 2017-11-29 12:36:40 UTC
app-emulation/lxd-2.19 has just been added.

After upgrading, are you still affected?
Comment 2 Virgil Dupras (RETIRED) gentoo-dev 2017-11-30 18:58:03 UTC
I have been struggling to make LXD work with openrc recently. Something about cgroup namespace hierarchy. Work with systemd though.
Comment 3 Luca Barbato gentoo-dev 2017-12-12 12:55:08 UTC
            lxc 20171212125405.670 ERROR    lxc_start - start.c:lxc_spawn:1182 - Failed to set up id mapping.
            lxc 20171212125405.670 ERROR    lxc_start - start.c:__lxc_start:1354 - Failed to spawn container "xenial".
            lxc 20171212125405.691 ERROR    lxc_conf - conf.c:run_buffer:408 - Script exited with status 1.
            lxc 20171212125405.691 ERROR    lxc_start - start.c:lxc_fini:546 - Failed to run lxc.hook.post-stop for container "xenial".
            lxc 20171212125405.691 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:177 - Command get_cgroup failed to receive response: Connection reset by peer.
            lxc 20171212125405.691 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:177 - Command get_cgroup failed to receive response: Connection reset by peer.
            lxc 20171212125405.691 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.691 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/openrc//lxc/xenial
            lxc 20171212125405.692 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.692 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpuset//lxc/xenial
            lxc 20171212125405.692 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.692 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpu//lxc/xenial
            lxc 20171212125405.692 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.692 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/cpuacct//lxc/xenial
            lxc 20171212125405.692 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.692 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/blkio//lxc/xenial
            lxc 20171212125405.692 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.692 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/memory//lxc/xenial
            lxc 20171212125405.692 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.692 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/devices//lxc/xenial
            lxc 20171212125405.693 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.693 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/freezer//lxc/xenial
            lxc 20171212125405.693 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.693 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/net_cls//lxc/xenial
            lxc 20171212125405.693 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.693 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/perf_event//lxc/xenial
            lxc 20171212125405.693 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.693 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/net_prio//lxc/xenial
            lxc 20171212125405.693 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.693 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/hugetlb//lxc/xenial
            lxc 20171212125405.693 ERROR    lxc_conf - conf.c:userns_exec_1:4600 - Error setting up child mappings
            lxc 20171212125405.693 ERROR    lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1288 - Error destroying /sys/fs/cgroup/pids//lxc/xenial

Same problem with the latest version, btw the go dependency should be bumped.
Comment 4 Virgil Dupras (RETIRED) gentoo-dev 2017-12-12 13:09:49 UTC
I have recently updated both LXC and LXD wiki pages to describe the workaround I had to go through to make LXC and LXD work under both systemd and openrc. At the core, it involved disabling the recently-introduced cgroups v2. Have you tried this?
Comment 5 Luca Barbato gentoo-dev 2017-12-19 15:25:46 UTC
lxc works just fine on that system, I'll look at disabling cgroups v2 now.
Comment 6 Luca Barbato gentoo-dev 2017-12-19 15:28:11 UTC
I wonder if upstream has a systemd-only codepath instead of probing for cgroups v2 and that is causing the issue...
Comment 7 Luca Barbato gentoo-dev 2018-06-04 17:22:11 UTC
Rehashing after the 3.0 release:

Now it still fails but for a completely different reason:

lxc 20180604171225.737 INFO     lxc_conf - conf.c:run_script_argv:368 - Executing script "/usr/sbin/lxd callhook /var/lib/lxd 2 start" for container "alpine-test", config section "lxc"
lxc 20180604171225.884 INFO     lxc_start - start.c:lxc_init:846 - Container "alpine-test" is initialized
lxc 20180604171225.920 INFO     lxc_network - network.c:instantiate_veth:171 - Retrieved mtu 1500 from lxdbr0
lxc 20180604171225.921 INFO     lxc_network - network.c:instantiate_veth:197 - Attached "vethEVNXWW" to bridge "lxdbr0"
lxc 20180604171225.921 INFO     lxc_cgroup - cgroups/cgroup.c:cgroup_init:60 - cgroup driver cgfsng initing for alpine-test
lxc 20180604171225.928 INFO     lxc_start - start.c:lxc_spawn:1614 - Cloned CLONE_NEWUSER
lxc 20180604171225.928 INFO     lxc_start - start.c:lxc_spawn:1614 - Cloned CLONE_NEWNS
lxc 20180604171225.928 INFO     lxc_start - start.c:lxc_spawn:1614 - Cloned CLONE_NEWPID
lxc 20180604171225.928 INFO     lxc_start - start.c:lxc_spawn:1614 - Cloned CLONE_NEWUTS
lxc 20180604171225.928 INFO     lxc_start - start.c:lxc_spawn:1614 - Cloned CLONE_NEWIPC
lxc 20180604171225.946 ERROR    lxc_conf - conf.c:lxc_map_ids:2886 - newuidmap failed to write mapping "": newuidmap 4686 0 1000000 1000000000
lxc 20180604171225.946 ERROR    lxc_start - start.c:lxc_spawn:1634 - Failed to set up id mapping.
lxc 20180604171225.966 INFO     lxc_network - network.c:lxc_delete_network_priv:2573 - Removed interface "eth0" with index 8
lxc 20180604171225.967 WARN     lxc_network - network.c:lxc_delete_network_priv:2591 - Failed to remove interface "vethEVNXWW" from "lxdbr0": Invalid argument
lxc 20180604171225.968 ERROR    lxc_container - lxccontainer.c:wait_on_daemonized_start:824 - Received container state "ABORTING" instead of "RUNNING"
lxc 20180604171225.968 ERROR    lxc_start - start.c:__lxc_start:1866 - Failed to spawn container "alpine-test"
lxc 20180604171225.971 ERROR    lxc_conf - conf.c:lxc_map_ids:2886 - newuidmap failed to write mapping "": newuidmap 4719 0 1000000 1000000000 1000000000 0 1
lxc 20180604171225.971 ERROR    lxc_conf - conf.c:userns_exec_1:4132 - Error setting up {g,u}id mappings for child process "4719"
lxc 20180604171225.972 WARN     lxc_cgfsng - cgroups/cgfsng.c:cgfsng_destroy:1651 - Failed to destroy cgroups
lxc 20180604171225.972 WARN     lxc_commands - commands.c:lxc_cmd_rsp_recv:130 - Connection reset by peer - Failed to receive response for command "get_cgroup"
lxc 20180604171225.972 INFO     lxc_conf - conf.c:run_script_argv:368 - Executing script "/usr/sbin/lxd callhook /var/lib/lxd 2 stop" for container "alpine-test", config section "lxc"
Comment 8 Joonas Niilola gentoo-dev 2020-11-13 06:21:12 UTC
Hey, 

is this still an issue?
Comment 9 Joonas Niilola gentoo-dev 2020-12-15 07:21:36 UTC
I believe some version bump somewhere has fixed this issue, please re-open if you're still having troubles with current versions in the tree.