[systemd-devel] booting A/B rootfs
Lennart Poettering
lennart at poettering.net
Thu Oct 9 02:57:53 PDT 2014
On Thu, 09.10.14 06:13, Darko Luketic (info at icod.de) wrote:
> Hi,
>
> I have limited knowledge of the boot process.
> I'm wondering if the following is possible with systemd.
>
> Imagine you have 2 rootfs partitions.
> You build a new rootfs on a security update or when a new version of a
> listed package that has dependencies is released and extract this on
> either A or B partition (A if B is the current rootfs, B if A is the
> current rootfs)
> The idea is, with systemd you can isolate targets. I assume you could
> shutdown all services so that nothing but systemd is running.
> Then unmount the current rootfs and mount the new rootfs and boot to
> default target.
> All without needing to poweroff or physically reboot the system.
> Only if you install a new kernel a "real" reboot would be required.
> Would this be possible with systemd in its current state?
This has been requested before, but is currently not nicely supported,
but I am open to adding some support for this. Note though that you
probably need to do more than just stopping all services, you need to
at least flush out /run, too, plus some other things like /dev/shm, or
the sysvipc objects.
The part of this that I think might be suitable for direct integration
into systemd is the above plus maybe high-level support in "systemctl"
to get a new verb for rebooting this way. The swapping of the
partitions though probably something to do externally, integrated in
the same way as the current dracut/initrd shutdown logic is
integrated, which disassembles the root disk: after systemd did
everything it could do it transitions back into the initrd which then
does what it needs to do.
In fact, you probably could use the initrd logic for this already,
just place a script /run/initramfs/shutdown, do the flushing of
/run+sysv manually, and then simply reexec systemd again.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list