r/voidlinux • • Nov 22 '24

solved Fixing KDE Plasma sleep (suspend) with Void Linux & Nvidia

Hello everyone

You may have noticed that after installing Nvidia drivers on your Void Linux operating system with KDE Plasma, the suspend and hibernate functions no longer work. I just spent hours figuring out why, so here's the solution:

Also for anybody wondering, the technical term for "sleep" is "suspending your session to RAM"

---

- ⚠️ Symptoms:

You're using elogind and you've installed Nvidia drivers. When suspending the session, one of the following happens:

  • Your screen goes completely blank, and the computer will not wake
  • Your screen flashes black and then returns to the login (SDDM) screen
  • Your computer suspends properly, but when waking from suspend, it turns on for a second but then goes back to sleep and/or becomes unresponsive
  • Once logged back in, your software doesn't seem like it can access your hardware anymore. The most common one is Wi-Fi not detecting anything.

---

- ℹ️ Why This Happens:

So, it turns out the reason this is happening is because Nvidia needs to put its drivers to sleep before the entire session suspends. To do this, Nvidia uses a script called nvidia-sleep.sh, which they attempt to make elogind run before and after suspending/hibernating to handle Nvidia drivers.

On Void, elogind runs scripts placed in

/usr/lib64/elogind/system-sleep/
/etc/elogind/system-sleep
/usr/libexec/elogind/system-sleep/

before and after suspending, passing the $1 arguments pre for pre-suspend and post for post-suspend.

Guess what! Nvidia places its driver handler script in /usr/libexec/elogind/system-sleep/, which is run, but elogind on void doesn't run suspend scripts with root (for some reason 🥹). This means that instead of running, the Nvidia script asks for a password on an invisible terminal, and weird things happen.

Luckily for us, Void's very own zzz also gets configured to run Nvidia's scripts when called, and this one actually runs properly. Therefore, we can remove Nvidia's nvidia-sleep.sh script from elogind and instead have elogind run zzz when suspending the system.

---

- ✅ The Solution

First, we need to disable Nvidia's nvidia-sleep.sh:

sudo mv /usr/libexec/elogind/system-sleep/nvidia.sh /usr/libexec/elogind/backup/

Next, we can make elogind use zzz:

• 1. Open the elogind sleep config file:

Kate: kate /etc/elogind/sleep.conf

Nano: sudo nano /etc/elogind/sleep.conf

• 2.Uncomment and set the following parameters:

AllowSuspend=yes
SuspendByUsing=/usr/bin/zzz
HibernateByUsing=/usr/bin/ZZZ

• 3. Open terminal and reload elogind:

loginctl reload

---

Congrats! You're done. Hopefully that fixes the issue and everything works great again. If not, hopefully this information serves as a starting point for troubleshooting any further issues with this problem.

If you're still here, you deserve a cookie: 🍪

Thanks for reading!

27 Upvotes

55 comments sorted by

View all comments

Show parent comment

1

u/089sudg9078n Nov 25 '24

Screen immediately turns black and monitor goes to standby. Keyboard LEDs turn off for half a second and then back on. Never a change in fan RPMs. Then it refuses to wake up. So what I think is that it never reaches sleep properly and gets stuck on something.

By the time I wrote the previous sentence the fans even started to ramp up.

I can only hold the power button to do a hard shutdown.

I wonder if it's because I don't have a swap partition but I thought that was only for hibernation.

2

u/NomadicalYT Dec 01 '24

Hmm interesting... That seems to me like a deeper ACPI issue :(

If you want to further debug it, you can install socklog and enable the service to start system logging, and then try this:

sudo socklog >> ~/syslog.txt

It should echo listening on /dev/log, starting.,

do not kill this terminal session

Open up a new one (new tab, new window), and run this command:

sudo nvidia-sleep.sh suspend && sleep 1 && sudo loginctl suspend && sleep 5 && nvidia-sleep.sh resume

Hopefully after running this command your computer should sleep for 6 seconds and then wake back up. If it doesn't, force restart it.

Once the PC returns to the world of the living, you should have a nice system log present in ~/syslog.txt that might tell you what's going on :)

Btw you can kill the socklog now. Ctrl+C will work

2

u/089sudg9078n Dec 05 '24 edited Dec 05 '24

Decided to try void linux in virtualbox with a fresh install that only has the bare essentials for KDE (and using sddm instead of lightdm). Suspend doesn't work there either but socklog doesn't give anything useful at all. Seems like the VM is freezing up completely before anything can happen though in one attempt I did see it hit s2idle and then suspend exit in the kernel. Though the machines screen never went black and never unfroze.

At least it made me realize that the transition from kde5 to kde6 seems to have broken things for me on my real machine so I will reinstall KDE. :)

edit: Tried a bunch of different things but the inconsistent logging from socklog is really annoying. It either gives no information or useless information. I'm just going to accept that sleep doesn't work and probably never will.

Then again, writing mem or other sleep parameters directly to /sys/power/state also freezes the systems. Will try a few other distros and see how that goes.

1

u/089sudg9078n Dec 02 '24

That's cool and I've dug into it. It seems that zzz can't suspend due to a printf i/o error.

elogind: Zzzz... /usr/bin/zzz: 52: printf: printf: I/O error

elogind: zzz: suspend failed

Gives me a decent starting point to go digging

1

u/[deleted] Aug 15 '25

[removed] — view removed comment

1

u/089sudg9078n Aug 15 '25

Nvidia driver in the end. Might be fixed now with 580 so I guess I'll try again. Thanks for the reminder.

1

u/[deleted] May 06 '26

[removed] — view removed comment

1

u/089sudg9078n May 08 '26

No I completely gave up on sleep. Nothing I tried worked.

Even now that I'm on arch linux and on latest AMD gpu. It just doesn't work. Sleep just doesn't work on linux. It is what it is.