[systemd-devel] Running a service *just* before unmounting filesystems

Hans de Goede hdegoede at redhat.com
Wed Jun 13 08:39:26 UTC 2018


Hi,

On 13-06-18 05:40, Alexander E. Patrakov wrote:
> Hans de Goede <hdegoede at redhat.com>:
>>
>> Hi All,
>>
>> So as you may have heard, I'm working on hiding the grub-menu
>> by default on single OS Fedora Workstation.  Part of the plan
>> here is to detect if a previous boot was successful and
>> cleanly shutdown the machine and show the menu (not hide the
>> menu) if the previous boot has failed to set either the
>> boot_success or shutdown_success flags:
>>
>> https://fedoraproject.org/wiki/Changes/HiddenGrubMenu
> 
> I think that I have a possibly better idea regarding shutdown. The
> idea is to modify GRUB so that it can see whether a filesystem has
> been cleanly unmounted, and use this condition in the "if" blocks. If
> the root filesystem has not been cleanly unmounted, then the shutdown
> has likely failed, possibly because the user has pressed a power
> button for 5 seconds. The problem with this solution is that, upon
> hibernation, the filesystem will be always dirty (i.e.: false
> positive), but we can probably manage it with another flag in grubenv.

Thank you for the suggestion, that certainly is an interesting idea,
but it would require grub to scan all block devices and check
all filesystems which will slow things down significantly and if
their then is some old left-over partition somewhere which is
not used, it will always get a false positive.

That combined with the hibernate issue makes me think that this
is more trouble then it is worth.

I've accepted that we won't be able to detect unclean shutdowns
and we can live with that.

Still as said, thank you for thinking along with us.

Regards,

Hans


More information about the systemd-devel mailing list