[RESPONDED] Suspend and Resume in Gentoo

Hello all,

Just bought my first Framework laptop :blush: and, as a long-time Gentoo user, installed it as my primary OS on this great machine, with a custom kernel.

To configure the kernel accordingly, I installed a Fedora 38 on another SSD and did a lsmod and lspci -k to figure out which config options should be enabled.

But there are 3 things that still don’t work on my Gentoo (but works on Fedora) : the webcam, the ambient light sensor, and most notably the suspend, which is the most problematic for now : the laptop never goes on suspend when I close it, and I am unable to log in again when resuming : it is totally unresponsive (I can only enter my password on GDM, but it’s freezing after that, I must hard reboot it!)

I already searched for some help before posting this topic, mostly here, without success.

Some help would be much appreciated! Here are some details about my config:

  • Linux kernel 6.1.31 (stable branch in Gentoo’s repository)
  • 11th Gen Intel(R) Core™ i7-1185G7 @ 3.00GHz
  • Gentoo with OpenRC and Gnome 44.1

Hi @Phil , welcome to the forums

for webcam, can you try and check your gentoo install if it loaded uvcvideo module? if it did then perhaps try to modinfo see what version?

after freezing of the gentoo install, and after rebooting, what’s the error messages when invoking

jouranlctl -b -1  -p err

cheers

Did you follow the various kernel setup bits on the gentoo wiki? Framework Laptop - Gentoo Wiki

I mostly followed those and my 12th and 13th gen frameworks both work out of the box for webcam and suspend/resume.

@Phil Hi, good to find Gentoo user here. I am waiting for my AMD Framework.

Have you tried non-gui to login then unlock your Gnome session?

Hi @Loell_Framework, thank you for your help. I don’t use Systemd, so I don’t have access to journalctl command, but here is the kernel log generated during my last attempt to suspend:

Jun 13 08:50:12 framework-philippe ModemManager[2117]: <info>  [sleep-monitor] system is about to suspend 
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.5032] manager: sleep: sleep requested (sleeping: no  enabled: yes)
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.5033] device (C4:91:0C:4A:D0:91): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.5039] manager: NetworkManager state is now ASLEEP
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.5041] device (wlp170s0): state change: activated -> deactivating (reason 'sleeping', sys-iface-state: 'managed')
Jun 13 08:50:12 framework-philippe dbus-daemon[1736]: [system] Activating service name='org.freedesktop.nm_dispatcher' requested by ':1.2' (uid=0 pid=1960 comm="/usr/sbin/NetworkManager --pid-file /run/NetworkMa") (using servicehelper)
Jun 13 08:50:12 framework-philippe dbus-daemon[1736]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jun 13 08:50:12 framework-philippe kernel: wlp170s0: deauthenticating from 44:a6:1e:6c:2d:7b by local choice (Reason: 3=DEAUTH_LEAVING)
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6022] device (wlp170s0): state change: deactivating -> disconnected (reason 'sleeping', sys-iface-state: 'managed')
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6118] dhcp4 (wlp170s0): canceled DHCP transaction
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6118] dhcp4 (wlp170s0): activation: beginning transaction (timeout in 45 seconds)
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6118] dhcp4 (wlp170s0): state changed no lease
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6119] dhcp6 (wlp170s0): canceled DHCP transaction
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6119] dhcp6 (wlp170s0): activation: beginning transaction (timeout in 45 seconds)
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6119] dhcp6 (wlp170s0): state changed no lease
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.6419] device (wlp170s0): set-hw-addr: set MAC address to BA:9C:19:70:97:9D (scanning)
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <warn>  [1686639012.9438] platform-linux: do-add-rule: failure 97 (Famille d'adresses non supportĂŠe par le protocole - Rule family not supported)
Jun 13 08:50:12 framework-philippe last message buffered 1 times
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.9457] device (wlp170s0): supplicant interface state: completed -> disconnected
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.9459] device (wlp170s0): supplicant interface state: disconnected -> interface_disabled
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.9466] device (wlp170s0): state change: disconnected -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Jun 13 08:50:12 framework-philippe NetworkManager[1960]: <info>  [1686639012.9866] device (wlp170s0): set-hw-addr: reset MAC address to 4C:77:CB:ED:5A:4E (unmanage)
Jun 13 08:51:28 framework-philippe syslogd[1868]: syslogd v2.4.4: restart.
Jun 13 08:51:23 framework-philippe kernel: microcode: microcode updated early to revision 0xaa, date = 2022-12-28
Jun 13 08:51:23 framework-philippe kernel: Linux version 6.1.31-gentoophilippe (root@framework-philippe) (gcc (Gentoo Hardened 12.2.1_p20230428-r1 p2) 12.2.1 20230428, GNU ld (Gentoo 2.39 p6) 2.39.0) #3 SMP PREEMPT_DYNAMIC Mon Jun 12 18:26:34 CEST 2023

As you can see, mainly messages related to NetworkManager during suspend, but nothing during resume. Last 3 lines are during the hard reboot. I think it’s actually never suspending: I close the lid, the screen goes off, but the power button is still lighting, and when I open the laptop it is nearly totally freezed: I have to wait long seconds before the screen goes back, the touchpad doesn’t work anymore, I can only enter my password on GDM screen, and after that: total freeze.

Here is the result of dmesg -l err to see the errors logged at kernel level (somewhat the same as the command you requested):

[    2.432392] cros-usbpd-charger cros-usbpd-charger.2.auto: Unexpected number of charge port count
[    2.487718] hdaudio hdaudioC0D2: Unable to configure, disabling
[    4.253846] Bluetooth: hci0: Malformed MSFT vendor event: 0x02

I believe you should see things similar to this in your dmesg before suspend:

[196792.161548] PM: suspend entry (deep)
[196792.256340] Filesystems sync: 0.094 seconds
[196792.264782] Freezing user space processes
[196792.268707] Freezing user space processes completed (elapsed 0.003 seconds)
[196792.268712] OOM killer disabled.
[196792.268712] Freezing remaining freezable tasks
[196792.270024] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[196792.270034] printk: Suspending console(s) (use no_console_suspend to debug)
[196792.289187] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[196792.289245] sd 0:0:0:0: [sda] Stopping disk
[196792.693420] ACPI: EC: interrupt blocked
[196792.725166] ACPI: PM: Preparing to enter system sleep state S3
[196792.725260] ACPI: EC: event blocked
[196792.725260] ACPI: EC: EC stopped
[196792.725261] ACPI: PM: Saving platform NVS memory
[196792.725271] Disabling non-boot CPUs ...
[196792.726675] smpboot: CPU 1 is now offline
[196792.728588] smpboot: CPU 2 is now offline
[196792.730505] smpboot: CPU 3 is now offline

And after you resume, you should probably see:

[196792.732980] ACPI: PM: Low-level resume complete
[196792.733026] ACPI: EC: EC started
[196792.733027] ACPI: PM: Restoring platform NVS memory
[196792.733658] Enabling non-boot CPUs ...
[196792.733708] x86: Booting SMP configuration:
[196792.733709] smpboot: Booting Node 0 Processor 1 APIC 0x1
[196792.734619] CPU1 is up
[196792.734656] smpboot: Booting Node 0 Processor 2 APIC 0x2
[196792.735388] CPU2 is up
[196792.735422] smpboot: Booting Node 0 Processor 3 APIC 0x3
[196792.736181] CPU3 is up
[196792.737933] ACPI: PM: Waking up from system sleep state S3
[196792.738183] ACPI: EC: interrupt unblocked
[196792.756019] ACPI: EC: event unblocked
[196792.756917] sd 0:0:0:0: [sda] Starting disk
[196792.760770] i915 0000:00:02.0: [drm] [ENCODER:94:DDI A/PHY A] is disabled/in DSI mode with an ungated DDI clock, gate it
[196792.760776] i915 0000:00:02.0: [drm] [ENCODER:102:DDI B/PHY B] is disabled/in DSI mode with an ungated DDI clock, gate it
[196792.760779] i915 0000:00:02.0: [drm] [ENCODER:110:DDI C/PHY C] is disabled/in DSI mode with an ungated DDI clock, gate it
[196792.762383] nvme nvme0: Shutdown timeout set to 8 seconds
[196792.769658] nvme nvme0: 4/0/0 default/read/poll queues
[196793.071565] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[196793.072268] ata1.00: supports DRM functions and may not be fully accessible
[196793.079114] ata1.00: supports DRM functions and may not be fully accessible
[196793.086454] ata1.00: configured for UDMA/133
[196793.086876] ata1.00: Enabling discard_zeroes_data
[196793.174858] OOM killer enabled.
[196793.174859] Restarting tasks ... done.
[196793.177687] video LNXVIDEO:00: Restoring backlight state
[196793.355195] PM: suspend exit
[196793.355271] elogind-daemon[5005]: System resumed.
[196797.194211] wlp2s0: authenticate with 38:94:ed:15:96:aa
[196797.203960] wlp2s0: send auth to 38:94:ed:15:96:aa (try 1/3)
[196797.211953] wlp2s0: authenticate with 38:94:ed:15:96:aa
[196797.211956] wlp2s0: send auth to 38:94:ed:15:96:aa (try 1/3)
[196797.216989] wlp2s0: authenticated
[196797.223168] wlp2s0: associate with 38:94:ed:15:96:aa (try 1/3)
[196797.225385] wlp2s0: RX AssocResp from 38:94:ed:15:96:aa (capab=0x11 status=0 aid=11)
[196797.225475] wlp2s0: associated
[196797.283225] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready

I assumed you should have installed elogind and put into “boot” runlevel. Recently I reinstalled one system with Plasma but nothing pulled into elogind, everything seems to be weird. Mind you, those log I didn’t pull them off Framework, but two working Gentoo OpenRC system.

Thank you @Kings for your answer. Unfortunately, nothing is logged when suspending and resuming. For me, maybe it’s a SSD-related problem, as no log is written?

I’ve just tried another distro: Manjaro Gnome, to see how it is working, comparing to Fedora 38 and my Gentoo. I have suspend and resume problems in Manjaro too: the first time it was able to resume properly, but my battery discharged drastically during suspend: from 60% to 15%! And the second time, resuming didn’t work at all: total freeze like on my Gentoo.

For now, the only distro which supports greatly my Framework is Fedora 38: all is working, even the ambient light sensor (not in Manjaro and Gentoo), but same battery draining problem during suspend.

@Phil I believed your machine is not suspending at all. Let’s see how things go.

@Kings Reminds me of my first trials with Linux (Mandrake, old Fedoras, Debian…) 20 years ago :slightly_smiling_face: Always had suspend problems. Seems like, as for now, suspend is not quite well supported on Framework hardware as I can see on this forum…

@Phil
I am using this small script s2ram (on Artix, an Arch Linux without systemd):

#!/bin/bash
echo "deep" > /sys/power/mem_sleep
echo "mem" > /sys/power/state

and it has been going really well.

The only thing is that you need to take care of the lock screen yourself, this script doesn’t lock anything and leaves you logged in

1 Like

@Phil Suspend problem is always difficult to solve. Hope you will be coming back to Gentoo soon.

1 Like

@Mapleleaf Thank you! I just tried your script: works great, the laptop goes really on sleep (power button led goes off), and resumes directly on desktop as you said. But after resuming I am not able to do anything: I/O errors when I want to execute any command, and a desktop notification when I want to launch any app: Execution of child processus /usr/libexec/gio-launch-desktop failed (I/O error)

Only thing I can do: hard rebooting…

For me, this is clearly a problem related to the SSD: looks like the system is unable to read/write anything when resuming…

1 Like

@Phil I tend to think that the machine is suspending well - as your Fedora, and the test you did are working. The software is the the culprit on your Gentoo installation. I highly suspected that something is missing on your fresh Gentoo install.

@Phil Sorry if I have posted too many messages…

https://wiki.gentoo.org/wiki/Suspend_and_hibernate

This is a very useful resource believe.

1 Like

Looks like gio-launch-desktop is part of Gnome, and I don’t even have it on my system (by the way, do you have this file?).
Maybe you could try with an other DE?
Personally I’m on XFce. And yeah I use OpenRC just like you.

Yeah might be the SSD. There is one thread that could interest you, their solution was to use a different SSD:

Does not mean your SSD is bad, it’s just a compatibility issue related to the wake up sequence.

What is your SSD right now?

I/O error could mean that the storage was unmounted or disconnected unexpectedly. I would bet that the sequencing is not right.

@Mapleleaf Thank you for the other thread. I think I have a SSD incompatibility/bug issue. My Gentoo is installed on a M2 I already had before purchasing my Framework. But my tests in Fedora and Manjaro were done with the M2 purchased at Framework…

Here is the output of hwinfo --disk on my Gentoo:

 Model: "Micron/Crucial CT1000P5PSSD8"
 Vendor: pci 0xc0a9 "Micron/Crucial Technology"
 Device: pci 0x5407 "CT1000P5PSSD8"
 SubVendor: pci 0xc0a9 "Micron/Crucial Technology"
 SubDevice: pci 0x0100 
 Serial ID: "213030878D2F"
1 Like

Ok, in this case it would be interesting to see what happens if you copy your Gentoo install over to the Framework SSD.
In particular using the s2ram script, which I believe gives the most control over what’s happening.

@Mapleleaf Ok, I had time to copy my Gentoo on Framework SSD (Sandisk WD_BLACK SN770 500GB), using the very useful tool MkStage4.

  • When using the s2ram script, it goes on suspend without problem, but crash and shutdown immediately after waking up.
  • Still freezing when resuming after closing the lid. Hard reboot required…

It’s annoying that this laptop can’t suspend properly under Linux… I also tried 2 other distros: Pop!_OS and OpenSuSE: same problem… :neutral_face: