Hi Florian, "pelzflorian (Florian Pelz)" <[email protected]> writes:
> Fredrik Salomonsson <[email protected]> writes: > >> Hi Floarian, Apologize, I just saw that I misspelled your name! >> >> "pelzflorian (Florian Pelz)" <[email protected]> writes: >> >>> Fredrik Salomonsson <[email protected]> writes: >>> >>>> That did fix the issue with it shutting itself off when trying to wake >>>> it up with the power button. However it got replaced with it directly >>>> going back to suspend when waking up. Only after a few suspend/wake >>>> cycles does it finally wake up again. >>> >>> Hello Fredrik. No idea, but just to make sure your issue really is with >>> the kernel, could you try >>> >>> $ sudo -i >>> # echo disk > /sys/power/state >>> >>> or instead of disk whatever other suspend you want from >>> https://docs.kernel.org/admin-guide/pm/sleep-states.html#basic-sysfs-interfaces-for-system-suspend-and-hibernation >>> ? >> >> Thanks for the pointer! Looks like it might be deep mem_sleep that have >> some issues. I tested `echo disk > /sys/power/state` but that failed. > > For my cheap HP laptop, I use disk. My /etc/config.scm has > > (swap-devices > (list > (swap-space > (target "/swapfile") > (dependencies (filter (file-system-mount-point-predicate "/") > file-systems))))) > > (kernel-arguments > (cons* "resume=/dev/nvme0n1p2" ;Device containing /swapfile > "resume_offset=4161536" ;Offset that /swapfile has on it > %default-kernel-arguments))) > > similar to the manual[1]. Of course disk is more often called hibernate. > This /swapfile might be necessary for your > hybrid sleep, too, though. And /swapfile must be big enough. > > Regards, > Florian > > [1] > info "(guix)Swap Space" > https://guix.gnu.org/manual/devel/en/html_node/Swap-Space.html That what was I was missing. Now I got both suspend and hibernate working. The latter I think is the first time ever I have had a machine that can hibernate. Hats off for the pointers! This is what I ended up with: ``` (define plt-idun-os (operating-system (inherit %plt-base-operating-system) (host-name "idun") (mapped-devices (list mapped-root)) (swap-devices (list (swap-space (target "/swap/swapfile") (dependencies (list fs-swap))))) ;; … (kernel-arguments `(,(string-append "resume=/dev/mapper/" (car (mapped-device-targets mapped-root))) "resume_offset=533760" ,@%plt-kernel-arguments)) (services (cons* ;; … (modify-services %plt-base-services ;; … (elogind-service-type config => (elogind-configuration (handle-power-key 'suspend) (suspend-mode '(s2idle)) (handle-lid-switch 'ignore) (handle-lid-switch-external-power 'ignore)))))))) ``` Full definition of it is here [0] To find the offset I ran this command: ``` sudo btrfs inspect-internal map-swapfile -r /swap/swapfile ``` Which I found on this page [1], by someone explaining on how to set it up on Arch Linux. [0] https://git.sr.ht/~plattfot/plt/tree/a4b0a758119789686d80b8ded2160b7ef7151d4a/item/plt/system/machines/idun.scm#L63 [1] https://github.com/abhiae/btrfs_swap_guide#5-get-the-resume-offset -- s/Fred[re]+i[ck]+/Fredrik/g
