Subject: bug#49475: closed (Re: bug#57583: Guix cannot resume after hibernation)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 05 Sep 2022 13:12:03 +0000

Your bug report

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

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
49475: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49475
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#57583: Guix cannot resume after hibernation
From: Tobias Geerinckx-Rice <[email-masked]>
To: Ludovic Courtès <[email-masked]>
Cc: [email-masked], [email-masked], Josselin Poiret <[email-masked]>, [email-masked], Yusuf Talha <[email-masked]>
Date: Mon, 05 Sep 2022 15:05:16 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Jack, Yusuf, Ludo',

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

Ludovic Courtès 写道：
> 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

Subject: [PATCH] linux-boot: Resume from hibernation after pre-boot.
From: Jack Hill <[email-masked]>
To: [email-masked]
Cc: Tobias Geerinckx-Rice <[email-masked]>
Date: Thu, 8 Jul 2021 22:48:53 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

* 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(-)

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