DEV Community

Tran Tien
Tran Tien

Posted on

How to fix not wake up after suspend on PC (Linux Mint xfce)

I understand that you find the suspend feature very useful for personal use as it helps you save energy and time by avoiding the need to restart your computer or reopen other software. However, you mentioned that sometimes it doesn’t work as expected on some graphics cards. I found some information that might help you fix this issue.

You copy nvidia-sleep.sh

sudo cp /usr/bin/nvidia-sleep.sh /usr/bin/nvidia-suspend.sh
Enter fullscreen mode Exit fullscreen mode

Then
Add code exit 0 in top into file nvidia-sleep.sh

#!/bin/bash

exit 0

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"

case "$1" in
    suspend|hibernate)
        mkdir -p "${RUN_DIR}"
        fgconsole > "${XORG_VT_FILE}"
        chvt 63
        if [[ $? -ne 0 ]]; then
            exit $?
        fi
    echo "" > /proc/driver/nvidia/suspend
        echo "$1" > /proc/driver/nvidia/suspend
        exit $?
        ;;
    resume)
    echo "" > /proc/driver/nvidia/suspend
        echo "$1" > /proc/driver/nvidia/suspend 
        #
        # 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
        exit 0
        ;;
    *)
        exit 1
esac
Enter fullscreen mode Exit fullscreen mode

Next step edit /lib/systemd/system-sleep/nvidia

#!/bin/sh

case "$1" in
    post)
        /usr/bin/nvidia-suspend.sh "resume"
        ;;
esac
Enter fullscreen mode Exit fullscreen mode

I hope that this tip will help you save time and this is my note.

Top comments (1)

Collapse
 
tranphuoctien profile image
Tran Tien

After a restore of a timeshift snapshot, before rebooting, you should replace the old swap UUID with the new one in /etc/fstab by following:

mount the swap partition 28 using disks or partitionmanager

copy new UUID (The disks app will show UUIDs)

edit /etc/fstab with root privileges:

sudo nano /etc/fstab
Search for swap
delete the old UUID
paste the new uuid
save by pressing Ctrl+X Y Enter
unmount swap partition
reboot

forum.manjaro.org/t/howto-restore-...