Re: pivot_root depreciated?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.01.2014 16:20, schrieb Phillip Susi:
> On 1/30/2014 9:50 AM, Thomas Bächler wrote:
>> At least mkinitcpio now generates a fresh "initrd" to return to
>> during system shutdown instead of keeping around the actual
>> initrd.
> 
> I see, so at shutdown the initramfs is re-loaded into a tmpfs that is
> then pivot_root()ed to?

Yes. This is the only choice, since you cannot access rootfs anymore, as
that would require running unmounting /.

And in our case, it's not "the initramfs" that is put into tmpfs - we
merely install systemd-shutdown as /shutdown and all needed shared
libraries. We use the initramfs generator for convenience, since it
knows how to resolve library dependencies.

> And at boot time, pivot_root is not used?

Correct.

>> 4) chdir("/realroot"); mount --move /realroot ., chroot(".");
> 
> Wait, how do you move a mount into itself?  I thought this was just
> the chdir and chroot.

Hm, there's something wrong here. It should be:

chdir("/realroot");
mount(".", "/", NULL, MS_MOVE, NULL);
chroot(".");

The comment included in the busybox source file which I linked to
explains it all properly.

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux