[pkg-lxc-devel] Bug#1039737: reportbug: lxc-copy --ephemeral always fails
Valentin Vidic
vvidic at debian.org
Wed Jun 28 20:38:46 BST 2023
Package: lxc
Version: 1:5.0.2-1
Severity: normal
Dear Maintainer,
After the upgrade to bookworm starting ephemeral container with lxc-copy
command always fails with an error:
# lxc-copy -n autopkgtest-sid -e -l TRACE
Created autopkgtest-sid_uFBocY as clone of autopkgtest-sid
lxc-copy: autopkgtest-sid: ../src/lxc/lxccontainer.c: wait_on_daemonized_start: 878 Received container state "ABORTING" instead of "RUNNING"
lxc-copy: autopkgtest-sid: ../src/lxc/af_unix.c: lxc_abstract_unix_recv_fds_iov: 218 Connection reset by peer - Failed to receive response
lxc-copy: autopkgtest-sid: ../src/lxc/commands.c: lxc_cmd_rsp_recv_fds: 128 Failed to receive file descriptors for command "get_state"
lxc-copy: autopkgtest-sid: ../src/lxc/utils.c: _recursive_rmdir: 160 No such file or directory - Failed to delete "/var/lib/lxc/autopkgtest-sid_uFBocY/overlay/delta/etc"
lxc-copy: autopkgtest-sid: ../src/lxc/utils.c: _recursive_rmdir: 160 No such file or directory - Failed to delete "/var/lib/lxc/autopkgtest-sid_uFBocY/overlay/delta"
lxc-copy: autopkgtest-sid: ../src/lxc/lxccontainer.c: container_destroy: 3007 Error destroying rootfs for autopkgtest-sid_uFBocY
The log contains some more information:
lxc-copy autopkgtest-sid 20230628192725.772 DEBUG storage - ../src/lxc/storage/storage.c:get_storage_by_name:209 - Detected rootfs type "overlay"
lxc-copy autopkgtest-sid 20230628192725.772 ERROR conf - ../src/lxc/conf.c:lxc_rootfs_init:569 - Bad file descriptor - Failed to open "overlay:/var/lib/lxc/autopkgtest-sid/rootfs:/var/lib/lxc/autopkgtest-sid_uFBocY/overlay/delta"
lxc-copy autopkgtest-sid 20230628192725.772 ERROR start - ../src/lxc/start.c:__lxc_start:2079 - Failed to handle rootfs pinning for container "autopkgtest-sid_uFBocY"
lxc-copy autopkgtest-sid 20230628192725.772 TRACE start - ../src/lxc/start.c:lxc_serve_state_socket_pair:544 - Sent container state "ABORTING" to 5
lxc-copy autopkgtest-sid 20230628192725.772 TRACE start - ../src/lxc/start.c:lxc_serve_state_clients:483 - Set container state to ABORTING
lxc-copy autopkgtest-sid 20230628192725.772 TRACE start - ../src/lxc/start.c:lxc_serve_state_clients:486 - No state clients registered
lxc-copy autopkgtest-sid 20230628192725.772 TRACE start - ../src/lxc/start.c:lxc_serve_state_clients:483 - Set container state to STOPPING
lxc-copy autopkgtest-sid 20230628192725.772 TRACE start - ../src/lxc/start.c:lxc_serve_state_clients:486 - No state clients registered
lxc-copy autopkgtest-sid 20230628192725.772 ERROR lxccontainer - ../src/lxc/lxccontainer.c:wait_on_daemonized_start:878 - Received container state "ABORTING" instead of "RUNNING"
lxc-copy autopkgtest-sid 20230628192726.369 WARN cgfsng - ../src/lxc/cgroups/cgfsng.c:cgfsng_payload_destroy:555 - Uninitialized limit cgroup
lxc-copy autopkgtest-sid 20230628192726.643 TRACE cgfsng - ../src/lxc/cgroups/cgfsng.c:__cgroup_tree_create:727 - Created 10(lxc.pivot) cgroup
lxc-copy autopkgtest-sid 20230628192726.644 TRACE cgfsng - ../src/lxc/cgroups/cgfsng.c:__cgroup_tree_create:742 - Opened newly created cgroup lxc.pivot as 4
lxc-copy autopkgtest-sid 20230628192726.113 WARN cgfsng - ../src/lxc/cgroups/cgfsng.c:cgfsng_monitor_destroy:926 - Device or resource busy - Failed to destroy 10(lxc.monitor.autopkgtest-sid_uFBocY)
lxc-copy autopkgtest-sid 20230628192726.113 TRACE start - ../src/lxc/start.c:lxc_end:963 - Closed command socket
lxc-copy autopkgtest-sid 20230628192726.113 ERROR af_unix - ../src/lxc/af_unix.c:lxc_abstract_unix_recv_fds_iov:218 - Connection reset by peer - Failed to receive response
lxc-copy autopkgtest-sid 20230628192726.113 TRACE start - ../src/lxc/start.c:lxc_end:974 - Set container state to "STOPPED"
lxc-copy autopkgtest-sid 20230628192726.113 ERROR commands - ../src/lxc/commands.c:lxc_cmd_rsp_recv_fds:128 - Failed to receive file descriptors for command "get_state"
lxc-copy autopkgtest-sid 20230628192726.113 DEBUG storage - ../src/lxc/storage/storage.c:get_storage_by_name:209 - Detected rootfs type "overlay"
lxc-copy autopkgtest-sid 20230628192726.113 TRACE commands - ../src/lxc/commands.c:lxc_cmd:521 - Opened new command socket connection fd 5 for command "get_state"
lxc-copy autopkgtest-sid 20230628192726.113 DEBUG storage - ../src/lxc/storage/storage.c:get_storage_by_name:209 - Detected rootfs type "overlay"
lxc-copy autopkgtest-sid 20230628192726.113 ERROR utils - ../src/lxc/utils.c:_recursive_rmdir:118 - No such file or directory - Failed to stat "/var/lib/lxc/autopkgtest-sid_uFBocY/overlay/delta/etc/hosts"
lxc-copy autopkgtest-sid 20230628192726.113 ERROR utils - ../src/lxc/utils.c:_recursive_rmdir:160 - No such file or directory - Failed to delete "/var/lib/lxc/autopkgtest-sid_uFBocY/overlay/delta/etc"
lxc-copy autopkgtest-sid 20230628192726.113 ERROR start - ../src/lxc/start.c:lxc_destroy_container_on_signal:2236 - Error destroying rootfs for container "autopkgtest-sid_uFBocY"
lxc-copy autopkgtest-sid 20230628192726.113 ERROR utils - ../src/lxc/utils.c:_recursive_rmdir:160 - No such file or directory - Failed to delete "/var/lib/lxc/autopkgtest-sid_uFBocY/overlay/delta"
lxc-copy autopkgtest-sid 20230628192726.114 ERROR lxccontainer - ../src/lxc/lxccontainer.c:container_destroy:3007 - Error destroying rootfs for autopkgtest-sid_uFBocY
The problem seems to be in the container value of bdev_type that is not
initialized properly for the overlay case. The following simple patch is
probably not the correct fix but it shows that rootfs->bdev_type is NULL
and if initalized properly the container starts up correctly.
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -555,6 +555,10 @@
if (userns)
return log_trace(0, "Not pinning because container runs in user namespace");
+ DEBUG("rootfs->bdev_type: %s", rootfs->bdev_type);
+ if (!rootfs->bdev_type && strstr(rootfs->path, "overlay:") == rootfs->path) {
+ rootfs->bdev_type = "overlay";
+ }
if (rootfs->bdev_type) {
if (strequal(rootfs->bdev_type, "overlay") ||
strequal(rootfs->bdev_type, "overlayfs"))
-- System Information:
Debian Release: 12.0
APT prefers stable-security
APT policy: (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.1.0-9-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages lxc depends on:
ii debconf [debconf-2.0] 1.5.82
ii dnsmasq-base [dnsmasq-base] 2.89-1
ii iproute2 6.1.0-3
ii iptables 1.8.9-2
ii libapparmor1 3.0.8-3
ii libc6 2.36-9
ii libcap2 1:2.66-4
ii libgcc-s1 12.2.0-14
ii liblxc-common 1:5.0.2-1
ii liblxc1 1:5.0.2-1
ii libseccomp2 2.5.4-1+b3
ii libselinux1 3.4-1+b6
ii lsb-base 11.6
ii nftables 1.0.6-2
ii sysvinit-utils [lsb-base] 3.06-4
Versions of packages lxc recommends:
ii apparmor 3.0.8-3
ii debootstrap 1.0.128+nmu2
ii dirmngr 2.2.40-1.1
ii gnupg 2.2.40-1.1
pn libpam-cgfs <none>
ii lxc-templates 3.0.4.48.g4765da8-1
pn lxcfs <none>
ii openssl 3.0.9-1
ii rsync 3.2.7-1
ii uidmap 1:4.13+dfsg1-1+b1
ii wget 1.21.3-1+b2
Versions of packages lxc suggests:
ii btrfs-progs 6.2-1
ii lvm2 2.03.16-2
ii python3-lxc 1:5.0.0-1+b1
-- Configuration Files:
/etc/lxc/default.conf changed:
lxc.net.0.type = veth
lxc.net.0.link = virbr0
lxc.net.0.flags = up
lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
-- debconf information:
* lxc/auto_update_config: true
More information about the Pkg-lxc-devel
mailing list