[systemd-devel] does poweroff -f really sync

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Nov 6 07:18:17 PST 2014


On Thu, Nov 06, 2014 at 03:22:50PM +0100, Lennart Poettering wrote:
> 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. 
Well, I'd expect the journal to be replayed without any fsck.

> 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.
Thanks. That completely explains what I was seeing.

> 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.

Zbyszek


More information about the systemd-devel mailing list