diff mbox series

initramfs-framework: overlayroot: switch_root instead of chroot

Message ID 20260519111947.39044-1-marcus.flyckt@kvaser.com
State New
Headers show
Series initramfs-framework: overlayroot: switch_root instead of chroot | expand

Commit Message

Marcus Flyckt May 19, 2026, 11:19 a.m. UTC
Use a proper switch_root instead of a plain chroot when transitioning to
the overlay root filesystem.

Some Linux features, like unshare(2), check for chrooted
environments and may return EPERM when running inside one.

This is particularly an issue when running unprivileged containers.

Signed-off-by: Marcus Flyckt <marcus.flyckt@kvaser.com>
---
 meta/recipes-core/initrdscripts/initramfs-framework/overlayroot | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/overlayroot b/meta/recipes-core/initrdscripts/initramfs-framework/overlayroot
index dacbcbe213..3f0a1c5493 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/overlayroot
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/overlayroot
@@ -114,4 +114,4 @@  mount -n --move /proc ${NEWROOT}/proc
 mount -n --move /sys ${NEWROOT}/sys
 mount -n --move /dev ${NEWROOT}/dev
 
-exec chroot ${NEWROOT}/ ${bootparam_init:-/sbin/init} || exit_gracefully "Couldn't chroot into overlay"
+exec switch_root ${NEWROOT}/ ${bootparam_init:-/sbin/init} || exit_gracefully "Couldn't switch_root into overlay"