New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
units: introduce systemd-hibernate-clear.service that clears stale HibernateLocation EFI variable #32043
Conversation
b6dc97f
to
8e71ea3
Compare
d3c2969
to
3438c78
Compare
3438c78
to
f62387c
Compare
|
||
/* Let's insist that the system identifier is verified still. After all if things don't match, | ||
* the resume wouldn't get triggered in the first place. We should not erase the var if booted | ||
* from LiveCD/portable systems/... */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After re-reading your reply in the above and this comment, yeah, that sounds reasonable.
f62387c
to
59f3023
Compare
@@ -32,6 +33,7 @@ static int help(void) { | |||
"\n%sInitiate resume from hibernation.%s\n\n" | |||
" -h --help Show this help\n" | |||
" --version Show package version\n" | |||
" --clear-efi Clear stale HibernateLocation EFI variable and exit\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the "and exit" is redundant. Of course we exit after executing the command.
And I'd drop the reference to the name of the EFI variable. That smells a bit too much of an implementation detail. i.e. sounds great for the man page, but I would not stuff it into the --help text.
And this doesn't just clear stale info, it clears any info afaics, stale or not. Hence, don#t say "stale". I mean, it's hopefully typically used to drop stale info, but that's not really strictly the only case.
Hence maybe "Clear hibernation stroage information from EFI variables" or so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the "and exit" is redundant. Of course we exit after executing the command.
Hmm, I see an ambiguity here: people might assume that if and only if this option is specified, the efivar gets cleared before resuming. But it actually just clears it and quits.
looks good, just some comments on naming things pretty much |
actually cleared the variable
stale HibernateLocation EFI variable Currently, if the HibernateLocation EFI variable exists, but we failed to resume from it, the boot carries on without clearing the stale variable. Therefore, the subsequent boots would still be waiting for the device timeout, unless the variable is purged manually. There's no point to keep trying to resume after a successful switch-root, because the hibernation image state would have been invalidated by then. OTOH, we don't want to clear the variable prematurely either, i.e. in initrd, since if the resume device is the same as root one, the boot won't succeed and the user might be able to try resuming again. So, let's introduce a unit that only runs after switch-root and clears the var. Fixes systemd#32021
59f3023
to
5f0cd57
Compare
Addressed all comments, except for the "and exit" part. |
Fixes #32021