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 <[email protected]>
---
 meta/recipes-core/initrdscripts/initramfs-framework/overlayroot | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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"
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#237311): 
https://lists.openembedded.org/g/openembedded-core/message/237311
Mute This Topic: https://lists.openembedded.org/mt/119388651/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to