[systemd-devel] does poweroff -f really sync

Lennart Poettering lennart at poettering.net
Thu Nov 6 06:22:50 PST 2014


On Thu, 06.11.14 15:08, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:

> On a related note: if I read the code correctly, reboot -f or
> JobFailureAction=reboot-force should sync the filesystems. But this doesn't
> seem to work:
> - on fedora-devel Adam W. said that fsck ran after a boot timeout
> - yesterday I did something like 'sudo install ./systemd /usr/lib/systemd/ && sudo reboot -f'
>   and ended up with an _empty_ file in /usr/lib/systmed/systemd.
> Am I missing something? Does this look like a kernel bug, or some
> timing issue? Maybe the sync in running asynchronously?

Well, it will sync() but the fs will still be dirty and thus require
fsck on next boot. 

If you want to avoid that you need to umount all before
rebooting.

That said, while we have the sync() in place before we invoke
reboot() during clean shutdowns (see shutdown.c) we actually are
missing that when you invoke "reboot -f". Or more, correctly: we
*were* missing it until 30s ago, until I added it there too.

I'd really recommend running "systemctl reboot -f" though in such
emergency situations, since it will immediately reboot, but still
umount all file systems before. "systemctl reboot -ff" (which is the
same as "reboot -f") is really just the last emergency if PID 1 is
hung.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list