18
submitted 2 months ago* (last edited 2 months ago) by muhyb@programming.dev to c/linuxquestions@lemmy.zip

Hi there!

I recently switched from Arch Linux after a decade and now settled on Void Linux. So far so good. However sometimes I gather minor things here and there. My current issue is, the proprietary drivers of Nvidia still seeking systemd for some parts and not sure how to walk around this.

I cannot suspend my PC because when I wake it up I always see something about nvidia-sleep.sh. Probably it cannot wake the GPU up properly.

This is nvidia-sleep.sh:

#!/bin/bash

if [ ! -f /proc/driver/nvidia/suspend ]; then
    exit 0
fi

RUN_DIR="/var/run/nvidia-sleep"
XORG_VT_FILE="${RUN_DIR}"/Xorg.vt_number

PATH="/bin:/usr/bin"

RestoreVT() {
    #
    # Check if Xorg was determined to be running at the time
    # of suspend, and whether its VT was recorded.  If so,
    # attempt to switch back to this VT.
    #
    if [[ -f "${XORG_VT_FILE}" ]]; then
        XORG_PID=$(cat "${XORG_VT_FILE}")
        rm "${XORG_VT_FILE}"
        chvt "${XORG_PID}"
    fi
}

case "$1" in
    is-suspend-then-hibernate-supported)
        # suspend-then-hibernate only works correctly if $SYSTEMD_SLEEP_ACTION
        # is supported, which was added in systemd 248.
        systemd_version=$(systemctl --version | head -n1 | cut -d' ' -f2)
        if [ "$systemd_version" -gt 247 ]; then
            exit 0
        fi

        echo "systemd version $systemd_version is too old to support suspend-then-hibernate with NVIDIA." 2>&1
        echo "Please upgrade to systemd 248 or newer." 2>&1
        exit 1
        ;;
    suspend|hibernate)
        mkdir -p "${RUN_DIR}"
        fgconsole > "${XORG_VT_FILE}"
        chvt 63
        if [[ $? -ne 0 ]]; then
            exit $?
        fi
        echo "$1" > /proc/driver/nvidia/suspend
        RET_VAL=$?
        #
        # If suspend/hibernate entry fails, switch back to the active VT
        #
        if [[ $RET_VAL -ne 0 ]]; then
            RestoreVT
        fi
        exit $RET_VAL
        ;;
    resume)
        echo "$1" > /proc/driver/nvidia/suspend
        RestoreVT
        exit 0
        ;;
    *)
        exit 1
esac

I'm using Niri so no desktop environment here if that helps. My driver is nvidia580. Also using greetd (w/ tuigreet). So, what can I do here?

Linux void 6.18.38_1 
pkgver: runit-2.3.1_1
Nvidia 580.159.04 

Edit: Tried nouveau and suspend works with it. However because Nvidia didn't provide firmware blobs for my card (GTX 1080) I cannot use the open drivers well.

Edit 2: Tried to give power management from acpid to elogind, thinking it might help to fool this script since it's systemd's standalone part here. Currently elogind both handles my seat and power management. I actually had some hope here, but sadly didn't work. Here are my elogind config files anyway:

/etc/elogind/logind.conf.d/logind.conf
[Login]
KillUserProcesses=no
HandlePowerKey=poweroff
HandlePowerKeyLongPress=poweroff
HandleRebootKey=reboot
HandleRebootKeyLongPress=poweroff
HandleSuspendKey=suspend
RemoveIPC=yes
/etc/elogind/sleep.conf.d/nvidia-sleep.conf                                    
[Sleep]
AllowSuspend=yes
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
#SuspendMode=deep
SuspendState=mem standby freeze
HandleNvidiaSleep=yes

Nvidia, this is for you:

top 26 comments
sorted by: hot top new old
[-] shrugs@lemmy.world 8 points 2 months ago

The script gets called as either

nvidia-sleep.sh suspend

On suspend and resume as

nvidia-sleep.sh resume

The important part is this:

echo "$1" > /proc/driver/nvidia/suspend

where $1 is either suspend or resume. /proc is a kernel interface that, I guess in this case, tells the kernel to suspend or resume the GPU. It just puts the corresponding string into /proc/driver/nvidia/suspend which causes the kernel to act accordingly.

chvt and fgconsole are commands you should look into, as they are called after the echo to proc and might be important.

In your case, since the driver doesn't come back but the system is usable, ssh into the system from another one and you can check with "sudo journalctl -f" and "sudo dmesg -w" what's happening.

Tbh, I don't see anything systemd-specific.

Hope that helps. Ask away if it doesn't.

[-] muhyb@programming.dev 3 points 2 months ago* (last edited 2 months ago)

Yeah, the Nvidia proc only has three states: suspend, hibernate, resume

I tried changing chvt 63 into chvt 2 so I can see what happens on resume more directly. By the way I didn't even know 63rd terminal existed.

I got errors like these, it goes further but basically:

void login: [13986.648494] BUG: using __this_cpu_read() is preemptible [00000000] code: nvidia-sleep.sh/18289
BUG: using smp_processor_id() in preemptible  [00000000] code: nvidia-sleep.sh/18289
BUG: using __this_cpu_read() is preemptible [00000000] code: elogind-daemon/831
BUG: using smp_processor_id() in preemptible  [00000000] code: elogind-daemon/831

I cannot use journalctl because this is runit, can dmesg though. It seems this could be a driver bug but not sure.

[-] imeansurewhynot@sh.itjust.works 5 points 2 months ago* (last edited 2 months ago)

I'm not technically literate enough to understand most of what you're saying, but I'm using Linux Mint with an nvidia card and it's working with Death Stranding 2, Cyberpunk I mean everything I've played on it has worked fine, and there are updates coming out all the time for my nvidia card.

and i can suspend my computer without an issue.

just my 2 cents.

[-] muhyb@programming.dev 4 points 2 months ago

Well, no problem with games and all here too. The problem is most likely because of Nvidia not being open, though currently investigating.

[-] hellmo_luciferrari@lemmy.zip 4 points 2 months ago

I would imagine that the line where it checks systemd version could be modified to fit. How? I dont know.

Why use the proprietary NVIDIA package instead of nouveau?

[-] muhyb@programming.dev 3 points 2 months ago

I tried modifying chvt 63 part into where I can easily access via key shortcuts like chvt 2 and now I'm getting a different error output, at least something... more readable.

I don't use nouveau because I play games. It improved with NVK a lot recently but still isn't there.

[-] hellmo_luciferrari@lemmy.zip 3 points 2 months ago

I also play games, and use noveau. I get great performance. No issues at all. In some cases even better than proprietary.

[-] muhyb@programming.dev 3 points 2 months ago

Huh, last time I tried NVK was more than 6 months ago apparently. I'm actually interested in open drivers because proprietary ones are pain. Anyway, can you explain more? What kind of games are you playing, for how long on nouveau? It might be improved since I last checked.

[-] hellmo_luciferrari@lemmy.zip 3 points 2 months ago

I have been on nouveau drivers for over a year at this point. Games vary, but have played through a good chunk of Cyber Punk 2077, Doom Dark Ages (including the new DLC), Minecraft (specifically All The Mods 10), Mortal Kombat One (with latest DLC), 7 Days to Die, Risk of Rain 2, The Talos Principle Reawakened, Far Cry 5, Far Cry 6.

I mean I have played plenty more.

I use Proton-Ge or CachyOS Proton.

I also have an issue with suspend/hibernate and the like. Machine just shuts off. I haven't figured that out for myself.

[-] muhyb@programming.dev 2 points 2 months ago* (last edited 2 months ago)

Hmm, some resource-heavy games there. Sounds promising. Last time when I try to play resource-heavy games, I was getting 30-40 FPS where I usually get at least 75. There were playable but not fun that way. By the way, just checked and last time I tried NVK was 2 years ago!? I guess I'll give it a shot again. Thanks for reminding me. <3

I also have an issue with suspend/hibernate and the like. Machine just shuts off. I haven’t figured that out for myself.

This doesn't sound good. So it's possible my problem won't go away with nouveau. :/

Edit: Which distro are you using by the way?

[-] hellmo_luciferrari@lemmy.zip 4 points 2 months ago

Always glad to share what I find that may help another person!

Also may I add, I am using 2 180hz monitors and I hit 144 constantly. (I am rocking the 3090)

I am on Arch! I am not super intimate with how suspend/hibernate works with Nvidia cards, even after perusing the Arch Wiki and trying a lot.

I did look into it a bit. And you have inspired me to do so even more. Should I find something, you'll be the first I share with.

[-] muhyb@programming.dev 1 points 2 months ago* (last edited 2 months ago)

Mine is 1080 and already dropped to legacy driver.

By the way, just installed nouveau and on my first try, got bunch of DATA_ERROR but it's fine now. Though haven't tried a game yet, will try soon and report back.

While doing this, found out about this: nouveau doesn't have support for power management for some cards and apparently mine is one of them.

~~Check your sudo dmesg | grep -i nouveau and if you see pmu: firmware unavailable that's why your suspend or hibernate don't work (mine probably won't too, will see).~~

Thanks again. :)

[-] hellmo_luciferrari@lemmy.zip 2 points 2 months ago

Oh man, that sounds like not so much fun. Keep me posted! I will help if I can if there is anything I can do.

I did run sudo dmesg | grep -i nouveau and nothing came up.

I did look into different idle parameters for /sys/power/mem_sleep

But I didn't end up trying to switch from s2idle deep to just s2idle.

[-] muhyb@programming.dev 3 points 2 months ago* (last edited 2 months ago)

From Void handbook:

Only first generation Maxwell, Kepler, and some Tesla cards support manual reclocking. Cards past Turing (GTX 16xx) support automatic reclocking. Graphics cards starting with second generation Maxwell (GTX 9xx) do not support reclocking because the linux-firmware collection is missing signed firmware blobs needed to reclock these cards past their boot frequencies.

So it seems there is no hope for my card for nouveau? The gaming performance is terrible because it cannot reclock once in the game apparently. One positive side, suspend works now. :`)

Edit: It was worth the try but no joy. Went back to no suspend state. :) At least it was easy thanks to dracut.

Edit 2: No wonder why I didn't have a good performance on Arch too. It's because Nvidia didn't provide blobs for my card. :(

Well I say what Linus said to Nvidia.

Thanks again though!

[-] hellmo_luciferrari@lemmy.zip 2 points 2 months ago

Thanks for sharing your findings! Can't say I have ever used dracut. Only ever mkinitcpio

[-] muhyb@programming.dev 2 points 2 months ago

Well, both do the same I guess. At least I didn't manually run it. That's some convenience.

And, no problem! Thank you too!

[-] shrugs@piefed.social 2 points 2 months ago

have you just tried unloading the module before suspending and then reloading after resume?

sudo modprobe -r nvidia suspend resume sudo modprobe nvidia

I found this: https://forum.manjaro.org/t/how-to-unload-a-module-prior-to-suspend-and-reload-it-afterwards/155058/4

since you are using runit, you have to find a way to implement the above service in it though

[-] muhyb@programming.dev 1 points 2 months ago* (last edited 2 months ago)

I cannot use it without killing the programs that uses the Nvidia driver first (Niri itself uses it for example), which defeats the purpose of suspend. Nice try though, thanks!

[-] shrugs@piefed.social 1 points 2 months ago

that's why you do it from a tty: Ctrl + alt + F3 then login and execute the commands. see what happens.

[-] muhyb@programming.dev 1 points 2 months ago

Sadly doesn't work on another tty too.

[-] possiblylinux127@lemmy.zip 1 points 2 months ago

I personally would just use systemd or get a AMD GPU

Nvidia drivers are know for being inflexible

[-] muhyb@programming.dev 2 points 2 months ago

To be fair, I was eyeing 9060 xt for some time and cannot buy it anymore since the price doubled because of AI-bros. Otherwise, I plan to, just can't yet. Maybe 5 more years stuck on GTX 1080 at this point, don't know.

And yeah, Nvidia drivers suck.

[-] possiblylinux127@lemmy.zip 2 points 2 months ago

You could get something like a 580 or 6600

Performance wise the 580 is a little weaker. However, it can be had for pretty cheap

[-] muhyb@programming.dev 1 points 2 months ago

Well, second hand market is as terrible as getting new here so I don't know honestly. If I'm going that way, I would try to get at least 6600 xt, which is thrice the price of my 1080 on the market. Need the bubble to burst first I guess. :)

this post was submitted on 17 Jul 2026
18 points (95.0% liked)

Linux Questions

4197 readers
14 users here now

Linux questions Rules (in addition of the Lemmy.zip rules)

Tips for giving and receiving help

Any rule violations will result in disciplinary actions

founded 3 years ago
MODERATORS