MX Linux, Xfce 4.18

Closing the laptop lid suspends the system, opening it resumes it, but the screen is black. I’m guessing it’s related to powerup because suspending through the logout menu and systemctl suspend both work as expected. When it’s black, switching to a different tty works, as well as C-M-Backspace to logout.

Same results with both lightdm and sddm, when replacing suspend with hibernate, and I’ve tried a few solutions like disabling lock on sleep.

Seems like this issue has been around for years, but had a whole bunch of different causes since every other thread has a different solution.

XFSETTINGSD_DEBUG=1 xfsettingsd --replace --no-daemon > /tmp/xf.log 2>&1

ps -ef | grep -E ‘screen|lock’

xfconf-query -c xfce4-power-manager -lv

dmesg, cleared it before trying to suspend

updates:

I’m not seeing a black screen, instead it turns on the display and then turns it off.

Additionally, I tried closing and opening the lid a few times, and it woke up correctly.

I tried it in i3wm with the xfce power manager to suspend after closing the lid. It woke up correctly 10 times in a row.

Solution: start an xrandr config and the monitor turns back on.

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    7 months ago

    Few things to figure out that could be helpful:

    • What’s your GPU?
    • What suspend modes does your laptop supposedly support, and then what modes does your kernel THINK it supports
    • What kernel are you in?
    • What does dmesg show right after you wake the machine back up?
    • Shareni@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      7 months ago

      What’s your GPU?

      NVIDIA GeForce MX150 (Thinkpad t480)

      What suspend modes does your laptop supposedly support, and then what modes does your kernel THINK it supports

      Sleep mode, hibernation mode, wireless off (source). freeze mem disk (cat /sys/power/state)

      I doubt it’s related as systemctl suspend works as expected.

      What kernel are you in?

      6.1.0-20-amd64

      What does dmesg show right after you wake the machine back up?

      dmesg, cleared it before trying to suspend

      I’ve tried resuming 50+ times while troubleshooting, and it only once did it correctly. Now I try to replicate the bug and it worked correctly 2/3 times.

      • just_another_person@lemmy.world
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        edit-2
        7 months ago

        I’ve tried resuming 50+ times while troubleshooting, and it only once did it correctly. Now I try to replicate the bug and it worked correctly 2/3 times

        That’s just the computers fucking with you. It’s how it always happens 😉

        Regarding the sleep modes, I was referring to the S* states. Run this:

        dmesg | grep 'S3\|suspend'

        • Shareni@programming.devOP
          link
          fedilink
          arrow-up
          1
          ·
          7 months ago

          Tried systemctl suspend and then resume:

          dmesg after a successful resume

          sudo dmesg | grep -E "S3|suspend"

          [ 9760.639020] PM: suspend entry (deep)
          [ 9761.235526] printk: Suspending console(s) (use no_console_suspend to debug)
          [ 9764.716421] ACPI: PM: Preparing to enter system sleep state S3
          [ 9764.764150] ACPI: PM: Waking up from system sleep state S3
          [ 9767.889922] PM: suspend exit
          
          • just_another_person@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            7 months ago

            The only thing that looks odd in there is the default in libgl, but otherwise looks okay. So it’s probably not a compatibility problem.

            How is your swap sized compared to your system memory?

            • Shareni@programming.devOP
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              7 months ago

              I just tried starting the xfce power manager in i3 and using it to go to standby when i close the lid. It woke up 10 times in a row without an issue. It looks like it’s a purely xfce issue.

              Also, when it wakes up it turns on the display, but then it doesn’t go black but instead turns it off. I was still able to reboot while it was off.

              $ swapon -s
              Filename				Type		Size		Used		Priority
              /swap/swap                              file		38915068	0		-2
              
              Memory: 2926MiB / 31859MiB
              
        • Shareni@programming.devOP
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          7 months ago

          That’s just the computers fucking with you. It’s how it always happens 😉

          Oh I know, just complaining

          sudo dmesg | grep -E "S3|suspend"

          [ 7225.917778] PM: suspend entry (deep)
          [ 7226.596293] printk: Suspending console(s) (use no_console_suspend to debug)
          [ 7230.132960] ACPI: PM: Preparing to enter system sleep state S3
          [ 7230.178542] ACPI: PM: Waking up from system sleep state S3
          [ 7233.500089] PM: suspend exit
          

          cat /sys/power/mem_sleep gives me: s2idle [deep]

  • gnuhaut@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    7 months ago

    Since that bug seems related to the X server somehow, I wonder if your monitor is showing black or actually off/standby (as in backlight off)?

    If it’s the backlight, maybe it’s related to DPMS (monitor power management), and you can jolt it back to life with something like

    xset dpms force on
    

    after waking up. Or maybe disable DPMS completely and see if that changes anything.

    It would also be interesting to know if this problem also happens outside of XFCE. If you just use (say) openbox (which I don’t think does any power management or DPMS stuff by itself), does that work?

    • Shareni@programming.devOP
      link
      fedilink
      arrow-up
      2
      ·
      7 months ago

      I wonder if your monitor is showing black or actually off/standby (as in backlight off)?

      It actually starts, and then turns off. I didn’t notice it before you drew my attention.

      The command doesn’t do anything, but I was able to type sudo reboot and it rebooted.

      It would also be interesting to know if this problem also happens outside of XFCE

      I can’t install anything new, but I just tried starting power manager in i3 and using it to go to standby when i close the lid. It woke up 10 times in a row without an issue. So it’s most likely a purely xfce issue that’s been around for like a decade in different forms.

      • gnuhaut@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        7 months ago

        It actually starts, and then turns off. I didn’t notice it before you drew my attention.

        That does sound like DPMS (“vesa display power management signaling”) shenanigans though.

        Maybe you can disable XFCE’s display power management stuff completely? Systemd’s logind (/etc/systemd/logind.conf) can do (and does by default I think) suspend on lid-close without any window manager involvement at all, works fine with i3 here. So disabling XFCE’s stuff probably “only” messes with your monitor not going standby after a while, and you can maybe use xset or xscreensaver and set this by hand (after making sure it’s actually properly disabled in XFCE, so XFCE doesn’t override that stuff).

        Found this about how to stop xfce4-power-manager and disable DPMS:

        xfce4-power-manager -q
        xset -dpms
        

        Try doing that and see if lid close works afterwards.

        • Shareni@programming.devOP
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          7 months ago

          I found a different solution: trigger an xrandr config. I’m leaving automating it for tomorrow.

          The funniest thing is that I was trying to help out some other lemmy user fix their own xrandr issues, and accidentally came across a thread mentioning it when I went back to fixing my own.

          Thanks for the help anyways

            • Shareni@programming.devOP
              link
              fedilink
              arrow-up
              2
              ·
              7 months ago

              I found it because you pointed out the monitor might be turning off. Changed search terms and found the recommendation in a Reddit thread. The full solution wasn’t great though.

  • lurch (he/him)
    link
    fedilink
    arrow-up
    2
    ·
    7 months ago

    i suggest you try something with chvt or openvt for a workaround. like after resume chvt to tty1 and then back to whatever your GUI runs on.

      • lurch (he/him)
        link
        fedilink
        arrow-up
        2
        ·
        7 months ago

        i wonder what happens if you send SIGSTOP to the Xserver before suspend, then SIGCONT after resume. I imagine it would be like a time jump and it doesn’t notice it was suspended, but not sure at all.

        • Shareni@programming.devOP
          link
          fedilink
          arrow-up
          3
          ·
          7 months ago

          I found a solution last night: execute an xrandr config. I’ll update the post later when I automate it.

          • lurch (he/him)
            link
            fedilink
            arrow-up
            2
            ·
            7 months ago

            😲 that’s cool. I use xrandr a lot in scripts for playing games with small text in lower resolution. It makes sense.

  • Kualk@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    It is not likely to be XFCE specific.

    Make sure you have properly configured swap space and its size is larger than RAM. Because this will be the easiest cause. Some people stated as much as twice the ram size.

    There’s a wiki page on arch wiki trying to help with this issue. In short, prepare for a lot of work and good luck.

    • Shareni@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      It is not likely to be XFCE specific.

      It seems to be, or it’s related to my xfce+I3 setup. I tried starting the xfce power manager in i3 and it woke up correctly 10 times in a row. And executing an xrandr config turns the monitor back on.

      AFAIK swap is only used for hibernation. Suspend keeps ram (and a single core/thread?) powered, so it’s not needed.

  • boredsquirrel@slrpnk.net
    link
    fedilink
    arrow-up
    1
    ·
    7 months ago

    Be aware that you are having problems with legacy software being completely based off unmaintained XOrg.

    It might just be a driver problem, but if XOrg is the problem, thats not solvable soon.

    • Shareni@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      unmaintained XOrg

      hmmmmmmm… It’s just not introducing breaking changes all the time like wayland.

      And I’d definitely not call xfce legacy as it’s in active development, but its focus has always been on stability over introducing new features.