Linux mint 21.1 resumes immediately after suspend

Questions about other topics - please check if your question fits better in another category before posting here
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
quevon24
Level 1
Level 1
Posts: 5
Joined: Thu Mar 23, 2023 5:19 pm

Linux mint 21.1 resumes immediately after suspend

Post by quevon24 »

i recently installed linux mint 21.1 in my desktop, but i've been having problems with suspend, the computer resumes immediately after suspend, i already checked and wake on lan is disabled in my bios, this is the cat /proc/acpi/wakeup output:

Code: Select all

    GP12	  S4	*enabled   pci:0000:00:07.1
    GP13	  S4	*enabled   pci:0000:00:08.1
    XHC0	  S4	*enabled   pci:0000:08:00.3
    GP30	  S4	*disabled
    GP31	  S4	*disabled
    PS2K	  S3	*disabled
    PS2M	  S3	*disabled
    GPP0	  S4	*enabled   pci:0000:00:01.1
    GPP8	  S4	*enabled   pci:0000:00:03.1
    PTXH	  S4	*enabled   pci:0000:02:00.0
    PT20	  S4	*disabled
    PT23	  S4	*disabled
    PT24	  S4	*enabled   pci:0000:03:04.0
    PT26	  S4	*disabled
    PT27	  S4	*disabled
    PT28	  S4	*disabled
    PT29	  S4	*enabled   pci:0000:03:09.0

Devices:

Code: Select all

    00:07.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Internal PCIe GPP Bridge 0 to bus[E:B]
    00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Internal PCIe GPP Bridge 0 to bus[E:B]
    08:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
    00:01.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge
    00:03.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge
    02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] Device 43ee
    03:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Device 43ea
inxi -G output:

Code: Select all

    Graphics:
      Device-1: NVIDIA GA104 [GeForce RTX 3070 Lite Hash Rate] driver: nvidia
        v: 525.85.05
      Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: nvidia
        unloaded: fbdev,modesetting,nouveau,vesa gpu: nvidia resolution:
        1: 1920x1080~60Hz 2: 1920x1080~60Hz
      OpenGL: renderer: NVIDIA GeForce RTX 3070/PCIe/SSE2
        v: 4.6.0 NVIDIA 525.85.05
I'm not a linux expert, but if anyone can help me i would really appreciate it
Last edited by LockBot on Sat Sep 23, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
madfatcat
Level 1
Level 1
Posts: 2
Joined: Sat Dec 12, 2020 11:26 am

Re: Linux mint 21.1 resumes immediately after suspend

Post by madfatcat »

having the same problem. I'm going crazy.
User avatar
PureTrance
Level 1
Level 1
Posts: 1
Joined: Fri Mar 24, 2023 9:42 am
Location: Republic of Moldova, Balti
Contact:

Re: Linux mint 21.1 resumes immediately after suspend

Post by PureTrance »

(Linux Mint Cinnamon 21.1 on my home PC: Athlon 200GE + Gigabyte B450M-S2H V2 + 8GB DDR4 2666)

When I press "Sleep" button on my keyboard, PC goes to sleep and after 1 second it wakes up for unknown reason. When I press "Suspend" button in the "Shutdown" menu, my PC goes to sleep and stays in sleep mode (that's OK). When idle timeout is reached, my PC goes to sleep and stays in sleep mode (that's OK too). When I type in the Terminal "systemctl suspend" or "sudo pm-suspend", the PC goes to sleep and stays in sleep mode as it should. So, the problem is only with "Sleep" button on my keyboard.

Today I found a solution! Here it is:
1. Open Preferences -> Keyboard -> Shortcuts.
2. Select "System" on the left, then "Suspend" on the right.
3. In the "Keyboard bindings" section double-click "Sleep" (that is the keyboard button name) and press Backspace to clear the binding.
4. In "Custom shortcuts" create a launcher named "Custom sleep" (press "Add custom shortcut") with command "envoke-sleep" (without quotes). Press "Add".
5. Double-click on "unassigned" line and press "Sleep" on your keyboard. Close the "Keyboard" window.
6. Open the Terminal and type in "sudo xed /usr/bin/envoke-sleep" and press Enter. It opens xed (text editor for LM Cinnamon) with elevated privileges.
7. Copy and paste there the following code:

Code: Select all

#!/bin/bash
# 2023-03-24 by PureTrance
# Put PC to sleep. You can bind this script to "Sleep" keyboard button.

sleep 1 && systemctl suspend
8. Save the file, close the editor.
9. In Terminal type in:

Code: Select all

sudo chmod +x /usr/bin/envoke-sleep
...and press Enter.

Now press "Sleep" button on your keyboard to verify your computer goes to sleep and doesn't wake up immediately.
Last edited by PureTrance on Mon Apr 17, 2023 5:31 am, edited 5 times in total.
Linux Mint Cinnamon 21.1 on PC: Athlon 200GE + Gigabyte B450M-S2H V2 + 8GB DDR4 2666
CloneWerks
Level 3
Level 3
Posts: 157
Joined: Fri Dec 09, 2022 3:02 pm

Re: Linux mint 21.1 resumes immediately after suspend

Post by CloneWerks »

Not sure if this helps but I have a cordless gaming mouse that constantly "wakes up" any computer I plug it into.
quevon24
Level 1
Level 1
Posts: 5
Joined: Thu Mar 23, 2023 5:19 pm

Re: Linux mint 21.1 resumes immediately after suspend

Post by quevon24 »

PureTrance wrote: Fri Mar 24, 2023 10:31 am (Linux Mint Cinnamon 21.1 on my home PC)

When I press "Sleep" button on my keyboard, PC goes to sleep and after 1 second it wake ups for unknown reason. When I press "Suspend" button in the "Shutdown" menu, my PC goes to sleep and stays in sleep mode (that's OK). When idle timeout is reached, my PC goes to sleep and stays in sleep mode (that's OK too). When I type in the Terminal "systemctl suspend" or "sudo pm-suspend", the PC goes to sleep and stays in sleep mode as it should. So, the problem is only with "Sleep" button on my keyboard.

Today I found a solution! Here it is:
1. Open Preferences -> Keyboard -> Shortcuts.
2. Select "System" on the left, then "Suspend" on the right.
3. In the "Keyboard bindings" section double-click "Sleep" (that is the keyboard button name) and press Backspace to clear the binding.
4. In "Custom shortcuts" create a launcher named "Custom sleep" (press "Add custom shortcut") with command "envoke-sleep" (without quotes). Press "Add".
5. Double-click on "unassigned" line and press "Sleep" on your keyboard. Close the "Keyboard" window.
6. Open the Terminal and type in "sudo xed /usr/bin/envoke-sleep" and press Enter. It opens xed (text editor for LM Cinnamon) with elevated privileges.
7. Copy and paste there the following code:

Code: Select all

#!/bin/bash
# 2023-03-24 by PureTrance
# Put PC to sleep. You can bind this script to "Sleep" keyboard button.

sleep 1 && systemctl suspend
8. Save the file, close the editor.
9. In Terminal type in:

Code: Select all

sudo chmod +x /usr/bin/envoke-sleep
...and press Enter.

Now press "Sleep" button on your keyboard to verify your computer goes to sleep and doesn't wake up immediately.
Thank you for the suggestion but the problem persists.

I have a ryzen 7 5800x and i found the solution here: viewtopic.php?t=346257

I created this script ~/scripts/disable-devices-as-wakeup.sh:

Code: Select all

#!/bin/bash
declare -a devices=(GPP0) # <-- Add your entries here
for device in "${devices[@]}"; do
    if grep -qw ^$device.*enabled /proc/acpi/wakeup; then
        sudo sh -c "echo $device > /proc/acpi/wakeup"
        echo "Device disabled: $device"
    fi
done
then

Code: Select all

sudo chmod + ~/scripts/disable-devices-as-wakeup.sh

touch ~/scripts/disable-devices-as-wakeup.service
and at the end add it as a service:

Code: Select all

[Unit]
Description=Disable devices as wakeup

[Service]
ExecStart=/home/username/scripts/disable-devices-as-wakeup.sh
Type=oneshot

[Install]
WantedBy=multi-user.target

Code: Select all

sudo cp ~/scripts/disable-devices-as-wakeup.service /etc/systemd/system/
systemctl enable disable-devices-as-wakeup.service
Locked

Return to “Other topics”