Skip to main content
Topic: Black Screen after waking up from suspend state (NVIDIA GPU ONLY) (Read 2374 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

possibly useful info:
--> I use startx to run my desktop.

Installing "nvidia-utils" a script is placed at "/lib/elogind/system-sleep/nvidia" with the content
Code: [Select]
#!/bin/sh

case "$1" in
    post)
        /usr/bin/nvidia-sleep.sh "resume"
        ;;
esac

This script does not resume/wake-up the system properly. after wake-up i get a black screen, i cannot change to any of the tty's. the only way i can proceed is by killing Xorg by ssh-ing into the system from my laptop and running "pkill Xorg" which throws me back to tty1 on my main display/monitor.

After some trial and error i was able to modify the above script and now everytime i wake-up my system i get the intended display output.

This is the modified script

Code: [Select]
#!/bin/sh

case "$1" in
    pre)
        /usr/bin/nvidia-sleep.sh "suspend"
        sleep 2
        ;;

    post)
        (sleep 2; /usr/bin/nvidia-sleep.sh "resume";)&
        ;;
esac

my takeaways:
1. the gpu needs to be put into the suspend state before the system itself suspends.
2. after elogind has finished it's wake-up executions the gpu needs to be put in to the resume state. ( hence the sleep 2 and '&', so that it does not block elogind's execution)

my issue is everytime the package "nvidia-utils" is upgraded the script gets overwritten and i have to make the changes again.

So i would like to know how i can bring this to the package maintainers attention. Unless there is something else that can ( or was supposed to ) be done.

Thank You
Abh15h3k

Re: Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

Reply #1
For a personal instant solution, try man pacman.conf, a NoUpgrade file won't be overwritten on updates. No idea if that change should be universally adopted though.

Re: Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

Reply #2
Is the "sleep 2" really necessary? Wouldn't just backgrounding the resume call be enough? It makes sense to me that there would need to be something done at "pre" though.

I hate to say it, but this script comes directly from nvidia so the chances of them fixing an (apparently broken) suspend script seems low. Although you're welcome to report this to them. I think carrying a workaround/fix in the package is reasonable enough. I just don't personally like the "sleep 2" since it feels arbitrary.

Re: Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

Reply #3
Quote
Is the "sleep 2" really necessary? Wouldn't just backgrounding the resume call be enough? It makes sense to me that there would need to be something done at "pre" though.

The thing is i have another script in "system-sleep" which starts slock just before sleeping and sets my liquid aio's fan speed after waking up ( using liquidctl ). I think that liquidctl's excution takes long enough to block elogind and nvidia-sleep "resume" gets executed before elogind is done. which results in a black screen. So you could say its there to avoid a race condition.

Re: Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

Reply #4
I looked at the arch nvidia-utiils package. On systemd, they use two services which call


Code: [Select]
 /usr/bin/nvidia-sleep.sh "sudpend"

 /usr/bin/nvidia-sleep.sh "resume"

I am not on nvidia any longer, so I am not sure what approach to take to make it work.
Provide a proper script, or add init specific services like systemd does?
Would the second approach work?

Re: Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

Reply #5
Quote
Provide a proper script, or add init specific services like systemd does?

I'm using openrc init. AFAIK openrc does not have a "suspend" run-level to run particular services before suspend.

also, what do you mean by proper script?

 

Re: Black Screen after waking up from suspend state (NVIDIA GPU ONLY)

Reply #6
suspend runlevel.
IIRC suspend should be handled by elogind and it has some ability to run scripts at suspend event.