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:

you are viewing a single comment's thread
view the rest of the comments
[-] 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.

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

Linux Questions

4197 readers
8 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