Announcement

Collapse
No announcement yet.

Sleep (s2idle) Unresponsive After Plugging in USB3 Monitor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sleep (s2idle) Unresponsive After Plugging in USB3 Monitor

    I realize I'm not alone in the world of Linux sleep problems, but I appreciate anyone taking a stab at helping. I finally decided to jump the Windows ship fulltime
    after they decided to remove the ability to move the taskbar in Win11. I used Kubuntu back in school for compsci, so I thought I would give it another shot. I typically use Debian for my headless servers so I feel somewhat at home with Kubuntu.

    The laptop becomes unresponsive after plugging in the USB 3 Monitor while in Sleep (s2idle). The sleep/power LED continues to indicate it is in sleep (slow blinking), but power button does not work, key/mouse does not wake and no activity on laptop monitor.

    The issue only seems to occur if the usb3 monitor is plugged in after the laptop sleeps. If I sleep (s2idle) with the usb monitor already plugged in, it wakes up perfectly fine. So logic would say there is some issue crashing the system while it is in s2idle when the usb monitor is plugged in. Like maybe it tries to wake it up... but fails and then crashes the system somehow?

    I have tested plugging in the downstream usb devices attached to the monitor independently and they (mouse/keyboard receiver, wireless phone charger) do not crash the system while in sleep. In fact not only do they not cause the sleep crash problem they successfully wake up the computer as normally intended, ie moving the external mouse and hitting a key on the external keyboard wake the computer up.

    The standard behavior, at least on my Windows laptops is that plugging in a usb monitor while asleep triggers wake up. I would prefer it did not - but if it woke up the computer I could live with it. Crashing it is a showstopper so I appreciate anyone's help. I've been digging around I'm stuck.

    Summary:
    Sleep with USB3 monitor already plugged in -> Wake works
    Sleep with USB3 monitor not plugged in -> Wake unresponsive after plugging in monitor
    Sleep with USB3 monitor already plugged in -> Wake works after unplugging monitor
    Sleep with USB3 monitor already plugged in -> Wake unresponsive after disconnecting and reconnecting monitor USB3 cable.

    ​Linux 6.11.0-14-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 10 23:48:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
    Operating System: Kubuntu 24.10
    KDE Plasma Version: 6.1.5
    KDE Frameworks Version: 6.6.0
    Qt Version: 6.6.2
    Kernel Version: 6.11.0-14-generic (64-bit)
    Graphics Platform: Wayland
    Processors: 8 × 11th Gen Intel® Core™ i5-1145G7 @ 2.60GHz
    Memory: 15.3 GiB of RAM
    Graphics Processor: Mesa Intel® Xe Graphics
    Manufacturer: HP
    Product Name: HP EliteBook 840 G8 Notebook PC
    System Version: SBKPF​



    #2
    having similar issues with the plasma suspend feature under power management... when asleep that way overnite the machine will completely brick

    and when i use the term brick, i am not exaggerating... i've had to RMA the motherboard to get the CMOS replaced.

    the workaround i've come up with is detailed here

    https://discuss.kde.org/t/tracking-d...om-sleep/29090

    Last edited by skyfishgoo; Yesterday, 02:42 PM.

    Comment


      #3
      I appreciate the response. My first preference would be to get s2idle (S0) working since that seems to be the modern way things are going, but I would be okay with using S3 Suspend-to-RAM. In fact I tried that, but it did not seem to change the behavior or fix the wake up defect when plugging in the USB monitor while in the sleep state. To be fair, I am not 100% sure I actually set the S3 Suspend-to-RAM correctly.

      #1 I don't see any indication in Kubuntu's Power Management to configure S3 Suspend-to-RAM. I only see "Do Nothing"/"Sleep"/Shutdown". I see in the documentation there's an additional option for type of Sleep, '...additional drop-down setting to select the exact sleep mode to enter when "Sleep" is activated' but the described additional drop-down is not shown on my system.

      #2 I attempted to manually configure S3 Suspend-to-RAM by writing "deep" into /sys/power/mem_sleep per https://www.kernel.org/doc/Documenta...wer/states.txt I confirmed [deep] shown in the output after writing, but after a reboot, /sys/power/mem_sleep output reverted back to [s2idle]. Not sure if Powerdevil is doing something, or systemd is doing something, or what?

      Comment


        #4


        Originally posted by hexintor View Post
        but after a reboot, /sys/power/mem_sleep output reverted back to [s2idle]
        yes, this needs to be made permanent. What you edited doesn't survive a reboot, since it isn't a physical or persistent file.

        THIS is a bit easier to follow and has more info and things to try. It may be a systemd service edit, or a grub kernel parameter.

        Comment


          #5
          Thanks. Unfortunately S3 is not working either. Per the instructions linked, "Confirm that your hardware does not exhibit issues with S3 sleep by testing a few sleep cycles after changing the sleep method". It's good to know if it did work that there is a way to sustain it through systemd, so thank you for that.

          When I sleep after enabling S3, it appears to go to sleep correctly (slow blinking LED), but waking resume does not work. For what it's worth, there is a difference from the S0 s2idle behavior. For S3, regardless of USB Monitor connection, the system appears to try to wake because the power LED light goes from blinking to solid on, as if it woke up. But the laptop screen does not turn on (stays black).

          In contrast on the original s2idle S0 side, the LED continues to blink slowly when trying to wake resume after connecting a USB monitor. Completely unresponsive.

          Any thoughts on which one of these methods I have the best chances of getting to work relative to effort of debugging? The link posted also suggests that even if "deep" is listed in /sys/power/mem_sleep, which it is on my system, it may still not be supported. So my gut is to continue to explore getting S0 s2idle to work. In theory from what I have been reading S0 s2idle is "Software" based, so it should be obtainable regardless of vendor hardware.

          Comment


            #6
            S0 is the working state, not a sleep state.

            s2idle is the S2 state and is faster to go into and come out of than suspend to disk (S3)

            if you run cat /sys/power/mem_sleep it will show you the sleep state supported by your firmware and kernel with the current default shown in [ ]'s, but those only apply when the power state of mem is called.

            cat /sys/power/state will list the power states that are called you issue the suspend command

            if freeze is listed first then it should go into s2idle, but my machine would not wake up when freeze was called i made edits to

            /etc/systemd/sleep.conf

            ​to remove the word freeze from the SuspendState= parameter and just relied on mem

            mem coupled with MemorySleepMode= will also determine which state of sleep your machine will go into when suspended

            if you have mem combined with deep then it will go into S3

            if you have mem combined with s2idle then it will go into S2 but that's the same as freeze and may be why it's not working.

            what happens if you issue the command

            sudo systemctl suspend

            does it suspend and resume as you expect or does that have the same issues as the plasma suspend?

            also examine the file /proc/acpi/wakeup to see if there are any S2 or S3 states listed by your firmware and also verify the contents of cat /sys/power/disk which may have [platform] as the default

            you may even want to add the SuspendMode=suspend parameter to your sleep.confg so that it does not have to rely on ACPI features you may not have.

            Last edited by skyfishgoo; Yesterday, 07:32 PM.

            Comment


              #7
              Thank you so much. I don't know why I kept calling S2Idle S0, it's literally in the name: S2. Sorry. My method for enabling S3 was described in my previous post (#5), and it resulted in worse behavior than s2idle because the wake resume did not turn on laptop monitor screen regardless of usb connectivity. I'll tinker with your systemd sleep conf setting recommendations but here's the current state, of note /proc/acpi/wakeup seems suspicious? XHCI appears to be USB related, and the issue involves plugging in a USB monitor while under s2idle. I'll have to do more research on the function of acpi wakeup file.

              cat /sys/power/mem_sleep
              [s2idle] deep

              cat /sys/power/state
              freeze mem

              /etc/systemd/sleep.conf (default?)
              [Sleep]
              #AllowSuspend=yes
              #AllowHibernation=yes
              #AllowSuspendThenHibernate=yes
              #AllowHybridSleep=yes
              #SuspendState=mem standby freeze
              #HibernateMode=platform shutdown
              #MemorySleepMode=
              #HibernateDelaySec=
              #SuspendEstimationSec=60min

              grep -E 'S2|S3' /proc/acpi/wakeup
              XHCI S3 *enabled pci:0000:00:14.0

              cat /sys/power/disk
              [disabled]


              Comment


                #8
                so, have you tried setting it via a boot parameter (in Grub)?

                Comment


                  #9
                  Originally posted by claydoh View Post
                  so, have you tried setting it via a boot parameter (in Grub)?
                  My understanding based on THIS ​ is setting mem_sleep_default=deep kernel parameter is only needed to make S3 permanent. I tested S3 manually by writing to /sys/power/mem_sleep and described the failing conclusions above. So I don't understand why I would want to make it permanent if it doesn't work. I don't see any notation stating that the kernel parameter assignment is the only/required way to enable the S3 state.

                  Is that the boot parameter you are referring to? or am I missing something. Thanks.

                  Comment


                    #10
                    Originally posted by hexintor View Post
                    My understanding based on THIS ​ is setting mem_sleep_default=deep kernel parameter is only needed to make S3 permanent.
                    yes, it is an alternate method of doing the same thing as the systemd edit.
                    You also can set different choices, not just :"deep". That is just one example.
                    Just something to try if the systemd one isn't working on your specific hardware and kernel combo.

                    a couple of years back, this is what we had to do for AMD based and some Intel Chromebooks to not lock up or some other bad thing, but which one to try differed for each board. The systemd sleep options had zero effect on these

                    Comment


                      #11
                      the cat /sys/power/disk result indicates you have secure boot turned on in your firmware preventing you from hibernating.

                      if you turn that off and check /proc/acpi/wakeup again, what does it say about S4?

                      rather than writing to those /proc files directly, it's better to issue the systemctl command and make your changes to the sleep.conf file by removing the comment #'s

                      this is what mine looks like

                      [Sleep]
                      MemorySleepMode=deep
                      AllowSuspend=yes
                      AllowHibernation=yes
                      AllowSuspendThenHibernate=yes
                      AllowHybridSleep=no
                      SuspendState=mem
                      HibernateState=disk
                      SuspendMode=platform
                      HibernateMode=platform shutdown
                      HibernateDelaySec=2h
                      #SuspendEstimationSec=60min​

                      a script is run after period of inactivity that issues the command

                      sudo systemctl suspend-then-hibernate

                      this will put my machine into S3 for 2hrs and then wake up and move everything to the suspend to disk (S4) state (its a desktop so i don't need to check on the battery state of charge).

                      Comment

                      Working...
                      X