On 21/06/16 16:24, Martin "eto" Misuth wrote:
On Tue, 21 Jun 2016 14:45:59 +0200
Laurent Bercot <[email protected]> wrote:
...
  With udevd, the workaround is to kill it after you have performed the
coldplug, and only restart it as part of your normal boot sequence once
you have pivot_rooted. It can be supervised at this point.


Thank you! Especially for mdev coldplug process description!

I asked, because it seems FreeBSD will be getting pivot_root like
capabilities soon. This makes it more similar to Linux in a way. And opens
some weekends for tinkering. It also introduces remote posibility of situation
like described actually happening there too.

FreeBSD 10.3 (the latest release as of writing) includes rerooting support. By passing the rerooting flag to the reboot systemcall the userland can tell the kernel to start the usual shutdown (kill all processes including init, unmount all filesystems including "/") and after unmounting the root filesystem the kernel performs a "userland reboot" by mounting a new root filesystem and starting a new init process.

There are lots of usecases for this e.g. configure the in-kernel iSCSI initiator from a small netboot image and switch to an iSCSI LUN as root file system. An other example are full disc encrypted systems without trusted system console. In that case you can use a minimal unencrypted system to unlock the encrypted disks and reroot into your encrypted devices.

Use kenv vfs.root.mountfrom="<fstype>:<device>" to set the filesystem type and device path before you invoke "reroot -r".

Reply via email to