Re: [systemd-devel] booting A/B rootfs

2014-10-24 Thread Greg KH
On Thu, Oct 09, 2014 at 06:13:01AM +0200, Darko Luketic 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?
 
 Why? Minimal downtime and if the new rootfs fails for whatever reason
 you could revert to the old rootfs but have a consistent userspace. Or
 you could run a testing system and if the new image reports no errors
 flag it stable and distribute to clients.
 
 And if this is possible, what if... you could shutdown the current
 running kernel and boot a new kernel which would in turn again run
 init and boot targets.

CoreOS and ChromeOS do this today, but you need to do this with the
bootloader, not at the init level.  systemd it too high-level to do
this, sorry.

good luck,

greg k-h
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] booting A/B rootfs

2014-10-24 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Oct 09, 2014 at 06:13:01AM +0200, Darko Luketic 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?
Sure, read about switch-root in systemctl(1).

 Why? Minimal downtime and if the new rootfs fails for whatever reason
 you could revert to the old rootfs but have a consistent userspace. Or
 you could run a testing system and if the new image reports no errors
 flag it stable and distribute to clients.
 
 And if this is possible, what if... you could shutdown the current
 running kernel and boot a new kernel which would in turn again run
 init and boot targets.
Sure, see kexec in systemctl(1).

Good luck,
Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] booting A/B rootfs

2014-10-09 Thread Lennart Poettering
On Thu, 09.10.14 06:13, Darko Luketic (i...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] booting A/B rootfs

2014-10-08 Thread Darko Luketic
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?

Why? Minimal downtime and if the new rootfs fails for whatever reason
you could revert to the old rootfs but have a consistent userspace. Or
you could run a testing system and if the new image reports no errors
flag it stable and distribute to clients.

And if this is possible, what if... you could shutdown the current
running kernel and boot a new kernel which would in turn again run
init and boot targets.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel