firecracker icon indicating copy to clipboard operation
firecracker copied to clipboard

jailer: pivot_root does not work with rootfs

Open acipu-aws opened this issue 7 years ago • 1 comments

Per the comment in the syscall code, SYS_pivot_root will fail if the current root is rootfs. This is a problem for systems that do not mount anything over the rootfs.

acipu-aws avatar Jan 15 '19 09:01 acipu-aws

Hello! My name's Dhriti, I'm currently taking the CS 360V course at UT Austin. One of our projects for the class is to work on an issue in an open-source repository, and since I've been working on learning Rust recently, this repository looked pretty cool. Would it be alright if I worked on this issue? If so, I'd really appreciate any information on how to approach it, or where to get started.

dhriti-rajan avatar Mar 21 '23 14:03 dhriti-rajan

 - When switching another root device, initrd would pivot_root and then
    umount the ramdisk.  But initramfs is rootfs: you can neither pivot_root
    rootfs, nor unmount it.  Instead delete everything out of rootfs to
    free up the space (find -xdev / -exec rm '{}' ';'), overmount rootfs
    with the new root (cd /newmount; mount --move . /; chroot .), attach
    stdin/stdout/stderr to the new /dev/console, and exec the new init.

Solving this is not trivial and requires changing from pivot_root to mount(MS_MOVE) in cases where / is rootfs (initramfs). We're not aware of any usecases where firecracker is run directly from an initramfs, so we're going to close this issue as not relevant,

Manciukic avatar Mar 13 '25 11:03 Manciukic