|
|
Log in / Subscribe / Register

Introducing /run

Introducing /run

Posted Mar 31, 2011 19:15 UTC (Thu) by lindi (subscriber, #53135)
In reply to: Introducing /run by neilbrown
Parent article: Introducing /run

pivot_root has not been used for quite some time. The "run-init" binary from klibc just mounts your hdd over / and chroots to it:

        /* Overmount the root */
        if (mount(".", "/", NULL, MS_MOVE, NULL))
                return "overmounting root";

        /* chroot, chdir */
        if (chroot(".") || chdir("/"))
                return "chroot";

        /* Open /dev/console */
        if ((confd = open(console, O_RDWR)) < 0)
                return "opening console";
        dup2(confd, 0);
        dup2(confd, 1);
        dup2(confd, 2);
        close(confd);

        /* Spawn init */
        execv(init, initargs);


to post comments

Introducing /run

Posted Apr 1, 2011 17:37 UTC (Fri) by nix (subscriber, #2304) [Link] (2 responses)

It doesn't take care to erase everything else in the initramfs beforehand? So it stays eating up memory forever?

Seems a bit of an omission.

(busybox's switch_root has never had this problem.)

Introducing /run

Posted Jan 20, 2012 20:15 UTC (Fri) by smurf (subscriber, #17840) [Link] (1 responses)

Just for the record:

Notice the MS_MOVE up there? This means that the source directory is moved there, thus the old root is (lazily) unmounted.
Unmounting a tempfs causes the files to get freed.
So in fact there is no problem.

Introducing /run

Posted Jan 26, 2012 18:19 UTC (Thu) by nix (subscriber, #2304) [Link]

This is not the case. mount("a","b"), no matter the flags, will never unmount "b". It just mounts "a" over the top of it: unmounting "a" will show you "b" still sitting there.

Inspecting /proc/self/mounts should show you this as well: both mounts are still shown, mounted in the same place.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds