-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LXD 5.0.3/5.19 fail to start nested LXC container with lxc.rootfs.options = ro
#12473
Comments
Thanks for so detailed report and provided access to the VM with reproducer, Simon! I did some tracing yesterday, and found interesting that the |
Suspicious change is 6a88b8a We did an experiment with Simon and changed rootfs mount flags from "ro" to "ro,noatime" to be consistent with:
As we can see from this mount list zfs was mounted with "noatime" mount option. Then, during the LXC container setup LXC tries to use
Explanation is that after this fix 6a88b8a ZFS started to be mounted with |
…ption" This reverts commit a56e5c5. Related to canonical#12473 Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
@mihalicyn can we close this now that #12492 is merged for stable-5.0 so as not introduce new behavior in the LTS, but for main branch is it still a bug or we can close? |
For the |
It should be in 5.0/edge by now to be tested. |
Ah except the doc tests are blocking the build on stable-5.0 branch https://github.com/canonical/lxd/actions/runs/6731001457
@ru-fu is there a PR from main branch we need to back port to fix this? If not, would you mind seeing what needs done to get thus unblocked? Thanks |
Thanks! Please could you open a PR to stable-5.0 branch? |
Sure: #12497 |
@mihalicyn @morphis @simondeziel please can you let me know if fixed in 5.0/edge, thanks. |
@tomponline Yes, this is fixed in 5.0/edge. We also landed detection logic in Anbox Cloud to make things work for 5.x |
Required information
6.2.0-35-generic #35~22.04.1-Ubuntu
git-7f8a581
(from 5.0/edge)zfs
Issue description
Starting with what is currently in
5.0/edge
and5.19
we see in Anbox Cloud our nested Android container failing to start. The problem cannot be reproduced with the same kernel and host OS and LXD 5.0.2 which makes it highly likely that a regression has been introduced in either LXC or LXD.The log of the nested LXC container:
Attaching with strace on the process using liblxc to start the container I can see that the
mount_setattr
syscall receivesEPERM
:1432 mount_setattr(20, "", AT_EMPTY_PATH|AT_RECURSIVE, {attr_set=MOUNT_ATTR_RDONLY, attr_clr=MOUNT_ATTR_NOATIME|MOUNT_ATTR_STRICTATIME|0x40, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EPERM (Operation not permitted)
Doing the same on a container running on LXD 5.0.2 I see the same syscall succeeding:
2348 mount_setattr(20, "", AT_EMPTY_PATH|AT_RECURSIVE, {attr_set=MOUNT_ATTR_RDONLY, attr_clr=MOUNT_ATTR_NOATIME|MOUNT_ATTR_STRICTATIME|0x40, propagation=0 /* MS_??? */, userns_fd=0}, 32) = 0
The configuration of the nested container looks like this:
lxc.container.conf
``` lxc.mount.auto = proc:rw sys:rw cgroup:mixed:force lxc.hook.mount = /usr/lib/x86_64-linux-gnu/anbox/lxc/mount-hook lxc.autodev = 1 lxc.pty.max = 1024 lxc.tty.max = 0 lxc.uts.name = localhost lxc.signal.halt = SIGPWR lxc.hook.version = 1 lxc.hook.post-stop = /usr/bin/anbox call-hook --id=0 --hook=stop lxc.hook.start-host = /usr/bin/anbox call-hook --id=0 --hook=start-host lxc.rootfs.path = /var/lib/anbox/rootfs lxc.rootfs.options = ro lxc.environment = PATH=/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin lxc.init.cmd = /vendor/anbox/bin/anbox-init --api-level=31 --max-uid=4000000 --enable-cgroup-emulation lxc.log.level = 0 lxc.log.file = /var/lib/anbox/logs/container.log lxc.console.logfile = /var/lib/anbox/logs/console.log lxc.console.rotate = 1 lxc.prlimit.nproc = 6679 lxc.prlimit.nofile = 32768 lxc.prlimit.nice = 40:40 lxc.proc.oom_score_adj = -900 lxc.net.0.type = veth lxc.net.0.flags = up lxc.net.0.name = eth0 lxc.net.0.link = anbox0 lxc.net.1.type = veth lxc.net.1.flags = down lxc.net.1.name = vw0 lxc.net.1.link = anbox0 lxc.apparmor.profile = anbox_container lxc.seccomp.allow_nesting = 1 lxc.seccomp.profile = /usr/lib/x86_64-linux-gnu/anbox/seccomp/container.sc lxc.seccomp.notify.proxy = unix:/run/anbox-container-seccomp.socket lxc.seccomp.notify.cookie = 0 lxc.idmap = u 0 100000 2500 lxc.idmap = g 0 100000 2500 lxc.idmap = u 2500 1000 1 lxc.idmap = g 2500 1000 1 lxc.idmap = u 2501 102501 3997499 lxc.idmap = g 2501 102501 3997499 lxc.mount.entry = /var/lib/anbox/cache /var/lib/anbox/rootfs/cache none bind,create=dir 0 0 lxc.mount.entry = /var/lib/anbox/data /var/lib/anbox/rootfs/data none bind,create=dir,rbind,nosuid,nodev 0 0 lxc.mount.entry = /run/user/1000/anbox/sockets/qemu_pipe /var/lib/anbox/rootfs/dev/qemu_pipe none bind,create=file 0 0 lxc.mount.entry = /run/user/1000/anbox/sockets/anbox_bridge /var/lib/anbox/rootfs/dev/anbox_bridge none bind,create=file 0 0 lxc.mount.entry = /run/user/1000/anbox/sockets/anbox_audio /var/lib/anbox/rootfs/dev/anbox_audio none bind,create=file 0 0 lxc.mount.entry = /run/user/1000/anbox/input /var/lib/anbox/rootfs/dev/input none bind,create=dir 0 0 lxc.mount.entry = /run/user/1000/anbox/sockets/compositor /var/lib/anbox/rootfs/dev/anbox_compositor none bind,create=file 0 0 lxc.mount.entry = /run/user/1000/anbox/anbox.xml /var/lib/anbox/rootfs/vendor/etc/permissions/anbox.xml none bind,create=file 0 0 lxc.mount.entry = /dev/fuse /var/lib/anbox/rootfs/dev/fuse none bind,create=file 0 0 lxc.mount.entry = /dev/net/tun /var/lib/anbox/rootfs/dev/tun none bind,create=file 0 0 lxc.mount.entry = /dev/binderfs/binder0 /var/lib/anbox/rootfs/dev/binder none bind,create=file 0 0 lxc.mount.entry = /dev/binderfs/binder1 /var/lib/anbox/rootfs/dev/vndbinder none bind,create=file 0 0 lxc.mount.entry = /dev/binderfs/binder2 /var/lib/anbox/rootfs/dev/hwbinder none bind,create=file 0 0 lxc.mount.entry = /usr/lib/x86_64-linux-gnu/anbox/android-bin /var/lib/anbox/rootfs/vendor/anbox/bin none bind,create=dir 0 0 lxc.mount.entry = /dev/dri-android/renderD128 /var/lib/anbox/rootfs/dev/dri/renderD128 none bind,create=file 0 0 lxc.mount.entry = /dev/android_sync /var/lib/anbox/rootfs/dev/sw_sync none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/cpuinfo /var/lib/anbox/rootfs/proc/cpuinfo none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/diskstats /var/lib/anbox/rootfs/proc/diskstats none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/loadavg /var/lib/anbox/rootfs/proc/loadavg none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/meminfo /var/lib/anbox/rootfs/proc/meminfo none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/stat /var/lib/anbox/rootfs/proc/stat none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/swaps /var/lib/anbox/rootfs/proc/swaps none bind,create=file 0 0 lxc.mount.entry = /var/lib/lxcfs/proc/uptime /var/lib/anbox/rootfs/proc/uptime none bind,create=file 0 0 lxc.mount.entry = /var/lib/anbox/state/default.prop /var/lib/anbox/rootfs/vendor/build.prop none bind,ro 0 0 lxc.mount.entry = /var/lib/anbox/state/power_supply /var/lib/anbox/rootfs//sys/class/power_supply none bind,ro 0 0 lxc.mount.entry = /var/lib/anbox/state/system_cpu_available /var/lib/anbox/rootfs//sys/devices/system/cpu/online none bind,ro 0 0 lxc.mount.entry = /var/lib/anbox/state/system_cpu_available /var/lib/anbox/rootfs//sys/devices/system/cpu/present none bind,ro 0 0 lxc.mount.entry = /var/lib/anbox/state/system_cpu_available /var/lib/anbox/rootfs//sys/devices/system/cpu/possible none bind,ro 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_cmdline /var/lib/anbox/rootfs/proc/cmdline none bind,ro 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_vm_mmap_rnd_bits /var/lib/anbox/rootfs/proc/sys/vm/mmap_rnd_bits none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_vm_mmap_rnd_compat_bits /var/lib/anbox/rootfs/proc/sys/vm/mmap_rnd_compat_bits none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_kptr_restrict /var/lib/anbox/rootfs/proc/sys/kernel/kptr_restrict none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_sched_schedstats /var/lib/anbox/rootfs/proc/sys/kernel/sched_schedstats none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_hung_task_timeout_secs /var/lib/anbox/rootfs/proc/sys/kernel/hung_task_timeout_secs none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_panic_on_oops /var/lib/anbox/rootfs/proc/sys/kernel/panic_on_oops none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_sched_child_runs_first /var/lib/anbox/rootfs/proc/sys/kernel/sched_child_runs_first none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_randomize_va_space /var/lib/anbox/rootfs/proc/sys/kernel/randomize_va_space none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_vm_mmap_min_addr /var/lib/anbox/rootfs/proc/sys/vm/mmap_min_addr none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_sched_rt_runtime_us /var/lib/anbox/rootfs/proc/sys/kernel/sched_rt_runtime_us none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_sched_rt_period_us /var/lib/anbox/rootfs/proc/sys/kernel/sched_rt_period_us none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/proc_sys_kernel_sysrq /var/lib/anbox/rootfs/proc/sys/kernel/sysrq none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/sys_power_wakeup_count /var/lib/anbox/rootfs/sys/power/wakeup_count none bind,rw 0 0 lxc.mount.entry = /var/lib/anbox/state/sys_power_state /var/lib/anbox/rootfs/sys/power/state none bind,rw 0 0 ```The rootfs is setup as a set of bind mounts
Steps to reproduce
I was not yet able to reproduce the problem outside of Anbox Cloud. Please contact me to receive access to a system for debugging.
Information to attach
dmesg
)lxc info NAME --show-log
)lxc config show NAME --expanded
)lxc monitor
while reproducing the issue)The text was updated successfully, but these errors were encountered: