Skip to content

Unprivileged container: Failed to mount rootfs #3669

Description

@r10r

Required information

  • Distribution: archlinux
  • git describe --long: lxc-4.0.0-1004-g46ad3c97a
  • uname -a: Linux 5.9.11-arch2-1 Prefix tests with lxc-test- #1 SMP PREEMPT Sat, 28 Nov 2020 02:07:22 +0000 x86_64 GNU/Linux
  • cat /proc/cmdline BOOT_IMAGE=../vmlinuz-linux root=/dev/xvda1 rw systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all initrd=../initramfs-linux.img
  • cat /proc/self/cgroup : 0::/user.slice/user-0.slice/session-98.scope

Issue description

I want to start an unprivileged container but startup fails with the following errors.

 cgroup2_devices - cgroups/cgroup2_devices.c:bpf_program_load_kernel:356 - Operation not permitted - Failed to load bpf program: 
 dir - storage/dir.c:dir_mount:153 - Permission denied - Failed to mount "/usr/local/var/lib/lxc/test-systemd3/rootfs" on "/usr/local/lib/lxc/rootfs"
 conf - conf.c:lxc_mount_rootfs:1284 - Failed to mount rootfs "/usr/local/var/lib/lxc/test-systemd3/rootfs" onto "/usr/local/lib/lxc/rootfs" with options "(null)"
 conf - conf.c:lxc_setup_rootfs_prepare_root:3260 - Failed to setup rootfs for
 conf - conf.c:lxc_setup:3395 - Failed to setup rootfs
 start - start.c:do_start:1261 - Failed to setup container "test-systemd3"
 sync - sync.c:sync_wait:36 - An error occurred in another process (expected sequence number 5)
 start - start.c:__lxc_start:2069 - Failed to spawn container "test-systemd3"
[root@k8s-cluster8-controller /]# cat /etc/subuid 
root:10000:100
[root@k8s-cluster8-controller /]# cat /etc/subgid 
root:10000:100

The container start just fine if I remove lxc.idmap settings.

# Template used to create this container: /usr/local/share/lxc/templates/lxc-download
# Parameters passed to the template: --dist ubuntu --release focal --arch amd64
# Template script checksum (SHA-1): cc9fb79513ac24572cd765110fc7811c708fe0f8
#
lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed

lxc.arch = linux64
lxc.net.0.type = empty
lxc.rootfs.path = dir:/usr/local/var/lib/lxc/test-systemd3/rootfs
lxc.uts.name = test-systemd3

lxc.cgroup2.devices.deny = a
lxc.cgroup2.devices.allow = c *:* rwm
lxc.cgroup2.devices.allow = b *:* rwm

lxc.apparmor.profile = unconfined

lxc.log.file = /tmp/lxc.log
lxc.log.level = TRACE

lxc.idmap = u 0 10000 50
lxc.idmap = g 0 10000 50

Metadata

Metadata

Assignees

Labels

DocumentationDocumentation needs updatingEasyGood for new contributorsExternalIssue is about a bug/feature in another project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions