[PATCH] linux-boot: Resume from hibernation after pre-boot.

  • Done
  • quality assurance status badge
Details
3 participants
  • Jack Hill
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Jack Hill
Severity
normal
J
J
Jack Hill wrote on 9 Jul 2021 04:48
(address . guix-patches@gnu.org)(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)
20210709024853.1170-1-jackhill@jackhill.us
* gnu/build/linux-boot.scm (boot-system): Call resume-if-hibernated
after pre-mount.
---

This change allows resuming from a swap device that needs device-mapper
to be set up first. In my case I tested swap on lvm on dm-crypt. I
believe this change to be safe since pre-mount shouldn't mount or
otherwise touch the filesystems. It it did, there would be data
corruption, so special care should be taken when reviewing.

gnu/build/linux-boot.scm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 461df9ff46..778ee99690 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -563,15 +563,6 @@ upon error."
(load-linux-modules-from-directory linux-modules
linux-module-directory)
- (unless (or (member "hibernate=noresume" args)
- ;; Also handle the equivalent old-style argument.
- ;; See Documentation/admin-guide/kernel-parameters.txt.
- (member "noresume" args))
- ;; Try to resume immediately after loading (storage) modules
- ;; but before any on-disk file systems have been mounted.
- (false-if-exception ; failure is not fatal
- (resume-if-hibernated (find-long-option "resume" args))))
-
(when keymap-file
(let ((status (system* "loadkeys" keymap-file)))
(unless (zero? status)
@@ -606,6 +597,15 @@ upon error."
(unless (pre-mount)
(error "pre-mount actions failed")))
+ (unless (or (member "hibernate=noresume" args)
+ ;; Also handle the equivalent old-style argument.
+ ;; See Documentation/admin-guide/kernel-parameters.txt.
+ (member "noresume" args))
+ ;; Try to resume immediately after loading (storage) modules
+ ;; but before any on-disk file systems have been mounted.
+ (false-if-exception ; failure is not fatal
+ (resume-if-hibernated (find-long-option "resume" args))))
+
(setenv "EXT2FS_NO_MTAB_OK" "1")
(if root-device
--
2.32.0
T
T
Tobias Geerinckx-Rice wrote on 9 Jul 2021 05:21
(name . Jack Hill)(address . jackhill@jackhill.us)(address . guix-patches@gnu.org)
87a6mwgnvt.fsf@nckx
Jack Hill ???
Toggle quote (4 lines)
> * gnu/build/linux-boot.scm (boot-system): Call
> resume-if-hibernated
> after pre-mount.

All right! \o/ Whilst I'm glad it didn't eat your data, it was
still just an off-the-cuff suggestion on IRC & I'd like to take
the weekend to think about the whole picture.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYOfEFg0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW155PUA/0XvlC1lk4repufb6af41nb9zjPn9RAKxVMGmg2A
FwHmAQC3qkBVZa3EecQH3lcldu0+LLGodZyfUR8pdjMZ2WAxBg==
=qcha
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 5 Sep 2022 14:51
Re: bug#57583: Guix cannot resume after hibernation
(name . Josselin Poiret)(address . dev@jpoiret.xyz)
87h71m3rx1.fsf@gnu.org
Hi,

Josselin Poiret <dev@jpoiret.xyz> skribis:

Toggle quote (9 lines)
> Yusuf Talha via Bug reports for GNU Guix <bug-guix@gnu.org> writes:
>
>> I haven't encountered this problem on any other distros.  You probably realized that I encrypted my disk.  Hibernation wasn't working while I was using Guix without encryption a few months ago either.  So I don't think LUKS is the problem here.
>
>>From what I can tell, resuming from an encrypted partition isn't
> currently supported. This could potentially be done, though it's not my
> priority right now (and testing these kinds of features is dangerous,
> you could make a wrong move and incur heavy data loss).

I believe this is fixed by this:


Jack, do I get it right?

The patch in question fell through the cracks, but it actually LGTM.

Thanks,
Ludo’.
T
T
Tobias Geerinckx-Rice wrote on 5 Sep 2022 15:05
(name . Ludovic Courtès)(address . ludo@gnu.org)
87wnaiezj2.fsf@nckx
Jack, Yusuf, Ludo',

Yusuf: you could try pulling, reconfiguring, hibernating, and
resuming, if you're brave-ish.

Ludovic Courtès ???
Toggle quote (3 lines)
> I believe this is fixed by this: […] The patch in question fell
> through the cracks

It should and it had, sorry.

I *dislike* the fact that this makes the resume path no longer
trivially obviously correct — because we now actually do something
potentially useful (and hence, dangerous) during it — but that's
unavoidable I suppose. It's certainly not the fault of this
patch.

Pushed as ec16f88522041dc285a35705ff9ee95672b78143, thanks Jack!

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYxX1oQ0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW150cYA/3ZS6cUFlwn+9Q7MDVcWwHPe1Kbi4BHjtXrw5BZP
ZS/fAQCId35XEGp8/W1LizS/imQg14KfTLyfPyddJ6Xs1hV2Dw==
=uYzh
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 49475@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 49475
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch