chroot into linux root FS and give them a way to self unmount
i'm developing and android universal bootloader.
this thread should NOT be moved to android forums!
our project it's to make users able to boot any OS ( linux, Mac, Windows, android and so on ) from any arm device. [ wiki: https://github.com/tux-mind/tf201-dev/wiki ]
our root_chooser works as /init replacement.
it chroot to an user defined device and substitute itself with another user specified init program ( usually /sbin/init ).
my problem is that the booted OS cannot unmount itself.
we are mounting the user-defined blockdevice over /newroot, chroot into /newroot ( or a subfolder ) and execv() the /sbin/init program.
for example gentoo say "cannot umount /newroot - we are using /newroot" in the shutdown phase.
i'm asking your help because every time i reboot the first mount() on the user-defined blockdevice takes so long due to unclean filesystem.
is there anyway to chroot into another linux root with giving him a way to unmount himself?
many init programs checks that they are the 1'st process....so a fork is not possible.
but i belive that there is a way since many initramfs do this.
thanks in advance for your help.
-- open source rocks!
I'm sure I'm missing something here..
Why not just unmount /newroot once chroot exits?
Or maybe you need pivot_root?
i can't unmount /newroot, i have to exec binaries that are into /newroot....
btw, pivot_root seems to be what i'm looking for :)
i'll try it today and let you known if it works.
thanks for your help.
pivot_root shouldn't be used by the initramfs,
you have to use switch_root instead.
BUT both require that the newroot it's a mountpoint.
our target it's to chroot inside a subdirectory of a device ( or a fs dd image ).
after looking around for pivot_root and switch_root i learned that mount accept the "move" option.
maybe this can help me.
but if i move the /newroot to /, and than chroot into a subfolder,
how can the spawned init unmount the real / ?
thanks in advance!
Moved: This thread is more suitable in <Linux - Embedded & Single-board computer> and has been moved accordingly to help your thread/question get the exposure it deserves.
|All times are GMT -5. The time now is 09:55 AM.|