Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Thanks for taking the time to provide a detailed answer. Will you be kind enough to also share some knowledge around exec switch_root step as well? What bothers me is that when /init is running from ramdisk or initramfs udev/dev and proc filesystems are mounted at /dev & /proc respectively. How do udev/dev and proc get remounted/remapped to dev and proc directories on real / filesystem? Should switch_root system call not complain that / is busy? Commented Nov 15, 2019 at 6:45
  • See the man pages of the switch_root tool and its source code - it encapsulates all the critical actions of the switch in a single tool, and the initramfs is constructed to minimize the number of userspace processes active at the time of the switch. After switching, the tool deletes the initramfs contents, and as soon as there are no processes holding onto them, the kernel initramfs driver cleans them up, until nothing is left of the initramfs. Commented Nov 15, 2019 at 8:01