You are not logged in.

#1 2022-01-19 21:19:13

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

[SOLVED] Monitor Will Not Receive Signal From Sleep

Problem Description

Whenever my desktop is suspended, and my GIGABYTE G27Q 27" 144Hz 1440P Gaming Monitor (https://www.newegg.com/p/N82E1682401201 … 6824012015) goes to sleep, the monitor will not detect an HDMI signal from the desktop upon waking. This issue does not happen on other HDMI monitors. Waking the monitor from sleep manually after the desktop is awakened, it will state "HDMI No Signal" and then it will return to sleep. The only way to get the monitor to get an image again is to either re-seat the HDMI cable in the GPU or reboot the PC.

PC Specs

Neofetch output:

OS: Arch Linux x86_64 
Kernel: 5.16.1-arch1-1 
Uptime: 31 mins 
Packages: 1404 (pacman), 7 (snap) 
Shell: bash 5.1.16 
Resolution: 2560x1440 
DE: Plasma 5.23.5 
WM: KWin 
WM Theme: Sweet-Dark-transparent 
Theme: Sweet [Plasma], Sweet [GTK2/3] 
Icons: candy-icons [Plasma], candy-icons [G 
Terminal: konsole 
Terminal Font: Hack 10 
CPU: Intel i5-6600K (4) @ 4.700GHz 
GPU: NVIDIA GeForce GTX 1080 Ti 
Memory: 4346MiB / 15941MiB 

Note: I'm using proprietary NVIDIA driver, not Nouveau.

What I've Tried
  • Everything is up to date with pacman and yay.

  • Disabled KMS, made no difference.

  • Tried the fix for "System does not return from suspend" in this wiki page: https://wiki.archlinux.org/title/NVIDIA … om_suspend to no avail.

  • Used the monitor with a Windows laptop, the issue was not present there.

  • If I think of anything else I've tried, I'll edit and add.

I know Arch is DIY but I'm a n00b and I haven't got a clue what else to try. Thus, I humbly ask for assistance.

Last edited by MegaMexican (2022-01-25 20:24:48)

Offline

#2 2022-01-20 08:48:50

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Do you get a signal when switching to a different VT (ctrl+alt+f3)?
Does it remain when switching back?

Can you ssh into the resumed system (for further inspections)?

Offline

#3 2022-01-20 13:18:36

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

You're such a wizard, I didn't even think of the VT switch.

Switching to TTY2 immediately gets the monitor up, then switching back to GUI works fine. So that's a valid workaround for now. Question is, how can I configure this to come back up straight into GUI from sleep?

I like the ssh idea but I don't have another Linux system at the moment to use, I could try it but I would prefer to do it as a last resort thing since it will be a pain trying to get a Linux system to use.

EDIT: I'm using KDE with SDDM through X.

Last edited by MegaMexican (2022-01-20 13:22:06)

Offline

#4 2022-01-20 13:25:51

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,626

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Try enabling the video memory preservation hooks: https://wiki.archlinux.org/title/NVIDIA … er_suspend

Offline

#5 2022-01-20 13:38:45

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

If that doesn't work, see whether changing the modeline (ideally just the refresh rate) w/ xrandr can achieve the same thing, eg. w/ a delayed systemd sleep hook.
https://wiki.archlinux.org/title/Power_ … stem-sleep (you'll have to export the DISPLAY and use the proper UID)

In that case, rather than the invalidated video memory, the output might justs miss the (extremely fragile) HDMI handshake and require an extra invitation to come back up.

Offline

#6 2022-01-20 21:18:44

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

So for V1del's suggestion, I did the following:

$ sudo modprobe nvidia
$ sudo nano /etc/modprobe.d/nvidia-power-management.conf
     and in it write "options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/tmp-nvidia" without the quotation marks.
$ sudo systemctl enable nvidia-suspend
$ reboot

Then suspend the PC after reboot, and wait until the monitor puts itself to sleep. Doing that, the issue persists.

As for seth's suggestion, I'm not entirely clear on how to implement what you're recommending. From what I'm understanding, it sounds like you're saying to write a custom script within the /usr/lib/systemd/system-sleep directory (side note: ls -l /usr/lib/systemd output shows "-rwxr-xr-x " for systemd-sleep instead of "drwxr-xr-x" which I would expect because it's a directory), and in this script have xrandr change the modeline (like from 2560x1440_144.00 to 2560x1440_120.00 I'm guessing?) to effectively re-establish a signal between the GPU and the monitor. Would I be able to set the refresh rate back to 144 by adding another line changing modeline back to 2560x1440_144 in same script? Also, I don't follow when you say "use the proper UID" after exporting $DISPLAY. Can you please clarify?

Thank you guys for taking the time to help out.

Last edited by MegaMexican (2022-01-20 23:15:28)

Offline

#7 2022-01-20 21:41:42

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

write a custom script within the /usr/lib/systemd/system-sleep

Yes (you can also use the service files, but I bascially only drop scripts there)

side note: ls -a /usr/lib/systemd output shows "-rwxr-xr-x "

"ls -a" doesn't show permissions at all, check "stat /usr/lib/systemd/system-sleep"

in this script have xrandr change the modeline

Yes.

Would I be able to set the refresh rate back to 144 by adding another line changing modeline back to 2560x1440_144 in same script?

Yes, you maybe want to cut the output some slack

#!/bin/sh
case $1/$2 in
        pre/*)
        ;;
        post/*)
        sudo -u megamexican xrandr --display :0 --ouput HDMI-0 --refresh 120 # username and output name are a GUESS, replace them w/ the proper ones
        sleep 0.5
        sudo -u megamexican xrandr --display :0 --ouput HDMI-0 --refresh 144 # dto.
        ;;
esac

Edit: hardcoding user and display isn't very elegant but will do for a simple test. If you can ssh into the system, you can also run that from there.

Last edited by seth (2022-01-20 21:42:53)

Offline

#8 2022-01-20 23:23:40

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

"ls -a" doesn't show permissions at all, check "stat /usr/lib/systemd/system-sleep"

That was a typo on my part. The command was "ls -l /usr/lib/systemd". Interestingly enough, "stat /usr/lib/systemd/system-sleep" yields "Access: (0755/drwxr-xr-x)". So ls -l lists /usr/lib/systemd/system-sleep as a file while stat lists it as a directory. I don't get it.

I tried the code you supplied, output is correct. I put in the correct username, took out the comments for good measure, and the issue is still there. Are there any additional services I need to enable for this to work or something?

It's also worth mentioning that whenever I wake the PC up from sleep, switch to another VT, then switch back to the desktop environment, KDE will provide a notification that the graphics have been reset. Could this indicate that the root cause of the issue is X.Org/SDDM/KDE?

EDIT: sudo journalctl -b -u systemd-suspend.service yields:

Jan 20 16:07:44 hostname [2139]: /usr/lib/systemd/system-sleep/sleepyboytest.sh failed with exit status 1.
Jan 20 16:07:44 hostname systemd[1]: systemd-suspend.service: Deactivated successfully.
Jan 20 16:07:44 hostname systemd[1]: Finished System Suspend.
Jan 20 16:07:44 hostname systemd[1]: systemd-suspend.service: Consumed 1.220s CPU time.

EDIT 2: I played around with the cables, noticed some interesting behavior. The GPU has one HDMI ports, and three Display Ports. The monitor has two HDMI ports and one Display Port. I do not have a Display Port cable to test with, I have an adapter though.
I tried a 2nd HDMI cable, same behavior if it's plugged into the HDMI port on the GPU and HDMI-1 or HDMI-2 on the monitor. If it's plugged into a Display Port on the GPU via adapter and HDMI-1 on the monitor, it does not have this issue. HDMI on the GPU to HDMI on another monitor, it works perfectly fine.

Last edited by MegaMexican (2022-01-21 00:05:19)

Offline

#9 2022-01-21 08:39:53

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Jan 20 16:07:44 hostname [2139]: /usr/lib/systemd/system-sleep/sleepyboytest.sh failed with exit status 1.

…
sudo -u megamexican xrandr --display :0 --ouput HDMI-0 --refresh 120 2>&1 | tee -a /tmp/xrandr.errors
sleep 0.5
sudo -u megamexican xrandr --display :0 --ouput HDMI-0 --refresh 144 2>&1 | tee -a /tmp/xrandr.errors

Check /tmp/xrandr.errors - either there's a blatant error or you might have to eg. "sleep 1" ahead of anything because it's called tooearly™ during the resume.

Offline

#10 2022-01-21 13:33:51

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

$ cat /tmp/xrandr.errors 
xrandr: unrecognized option '--ouput'
Try 'xrandr --help' for more information.
xrandr: unrecognized option '--ouput'
Try 'xrandr --help' for more information.

OUPUT

Facepalm of the century that I didn't catch that typo. I corrected it, and it worked!

So my question now is, what exactly is the root cause of this issue?

Offline

#11 2022-01-21 13:38:20

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

I need to stop writing with an arm pump smile

Failing handshake. Probably.
It's hyper-fragile and time sensitive because you're stealing valuable … WTF are there now PowerRangers on fucking Tatooine.  Nobody wants to even steal that.
Fuck Disney.

Anyway, the HDMI handshake is rather fragile and it's likely to fail - esp. since only one output is affected. Can you alternatively use DP?

Offline

#12 2022-01-21 14:12:16

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

I spoke too soon. It's only worked the very first time, I've tried it a couple other times. cat /tmp/xrandr.errors is completely empty. Here's the output for sudo journalctl -b -u systemd-suspend.service:

systemd[1]: Starting System Suspend...
systemd-sleep[2520]: Entering sleep state 'suspend'...
systemd-sleep[2520]: System returned from sleep state.
sudo[2635]:     root : PWD=/ ; USER=username ; COMMAND=/usr/bin/xrandr --display :0 --output HDMI-0 --refresh 120
sudo[2635]: pam_systemd_home(sudo:session): systemd-homed is not available: Unit dbus-org.freedesktop.home1.service not found.
sudo[2635]: pam_unix(sudo:session): session opened for user username(uid=1000) by (uid=0)
sudo[2635]: pam_unix(sudo:session): session closed for user username
sudo[2679]:     root : PWD=/ ; USER=username ; COMMAND=/usr/bin/xrandr --display :0 --output HDMI-0 --refresh 144
sudo[2679]: pam_systemd_home(sudo:session): systemd-homed is not available: Unit dbus-org.freedesktop.home1.service not found.
sudo[2679]: pam_unix(sudo:session): session opened for user username(uid=1000) by (uid=0)
sudo[2679]: pam_unix(sudo:session): session closed for user username
systemd[1]: systemd-suspend.service: Deactivated successfully.
systemd[1]: Finished System Suspend.
systemd[1]: systemd-suspend.service: Consumed 1.327s CPU time.

Last edited by MegaMexican (2022-01-21 14:12:29)

Offline

#13 2022-01-21 14:14:48

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Did you try to prepend "sleep 1" to wait for the output?

Offline

#14 2022-01-21 14:53:26

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

I switched sleep 0.5 to sleep 1.0, got no messages. Switched it back to sleep 0.5, now we have this:

$ cat /tmp/xrandr.errors
xrandr: Configure crtc 0 failed
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  7 (RRSetScreenSize)
  Serial number of failed request:  49
  Current serial number in output stream:  50

Offline

#15 2022-01-21 14:56:00

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Not "switch"

#!/bin/sh
case $1/$2 in
        pre/*)
        ;;
        post/*)
        sleep 1 # this is to make sure that the monitor has done its thing
        sudo -u megamexican xrandr --display :0 --output HDMI-0 --refresh 120
        sleep 0.5 # this is to allow the monitor to handle the previous mode switch
        sudo -u megamexican xrandr --display :0 --output HDMI-0 --refresh 144 # dto.
        ;;
esac

Offline

#16 2022-01-21 14:59:11

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

I tried it just now, same behavior and same error in /tmp/xrandr.errors

Offline

#17 2022-01-21 15:42:34

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Is it from the 1st or the second call (inject a sneaky "echo stage 1/2 >> /tmp/xrandr.errors" between the calls) and can you generally still "xrandr --output HDMI-0 --refresh 120"?

Offline

#18 2022-01-21 18:46:20

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Let me make sure I'm doing this right, the code should be

#!/bin/sh
case $1/$2 in
        pre/*)
        ;;
        post/*)
        sleep 1
        sudo -u username xrandr --display :0 --output HDMI-0 --refresh 120 2>&1 | tee -a /tmp/xrandr.errors
        sleep 0.5
        echo stage 1/2 >> /tmp/xrandr.errors
        sudo -u username xrandr --display :0 --output HDMI-0 --refresh 144 2>&1 | tee -a /tmp/xrandr.errors
        ;;
esac

correct?

Offline

#19 2022-01-21 19:02:22

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

The idea was

echo "stage 1" >> /tmp/xrandr.errors
xrandr ...
sleep 0.5
echo "stage 2" >> /tmp/xrandr.errors
xrandr ...

to tell them apart.
Also try whether xrandr generally still works to alter the refresh rate and in doubt reboot to reset the GPU after all the sleep tests

Offline

#20 2022-01-21 19:27:22

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

So I tried running the script with the added echo commands:

$ cat /tmp/xrandr.errors
stage 1
stage 2

Running "$ xrandr --output HDMI-0 --refresh 120" or "$ xrandr --output HDMI-0 --refresh 144" and then running "xrandr" immediately yield the same result either way:

$ xrandr
Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767
DVI-D-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 698mm x 393mm
   2560x1440     59.95 + 143.98*  120.00  
   3840x2160     59.94    50.00  
   2560x1080     50.00  
   1920x1080    120.00   100.00    60.00    59.94    50.00    60.00    50.04  
   1440x900      59.89  
   1440x576      50.00  
   1400x1050     59.98  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720     119.88    60.00    59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-4 disconnected (normal left inverted right x axis y axis)
DP-5 disconnected (normal left inverted right x axis y axis)

Offline

#21 2022-01-21 20:45:38

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Why is there no output from xrandr?

Running "$ xrandr --output HDMI-0 --refresh 120" or …

The question is more whether they also cause "xrandr: Configure crtc 0 failed" - if they don't the problem is w/ calling xrandr at the specific time during the wakeup.

Offline

#22 2022-01-24 14:02:08

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Yeah I don't understand what's going on. Just tried:

~> $ xrandr --output HDMI-0 --size 1920x1080 >> ~/testlog
~> $ cat ~/testlog
~> $

Completely blank output. Didn't change the resolution from 2560x1440 to 1920x1080, resolution stayed absolutely the same.

Offline

#23 2022-01-24 14:09:08

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

xrandr --output HDMI-0 --mode 1920x1080 >> ~/testlog 2>&1

"--mode" and "2>&1" resirects stderr into stdout

Offline

#24 2022-01-24 18:18:40

MegaMexican
Member
Registered: 2021-10-08
Posts: 27

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

So I changed the script to the following:

#!/bin/sh
case $1/$2 in
        pre/*)
        ;;
        post/*)
        sleep 1
        echo "stage 1" >> /tmp/xrandr.errors
        sudo -u username xrandr --display :0 --output HDMI-0 --mode 1920x1080 2>&1 | tee -a /tmp/xrand>
        sleep 0.5
        echo "stage 2" >> /tmp/xrandr.errors
        sudo -u username xrandr --display :0 --output HDMI-0 --mode 2560x1440 2>&1 | tee -a /tmp/xrand>
        ;;
esac

Then I suspended the PC, and it worked. I rebooted, then suspended the PC, and it didn't work. Then I checked the logs which0 say:

cat /tmp/xrandr.errors
stage 1
xrandr: Configure crtc 0 failed
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  7 (RRSetScreenSize)
  Serial number of failed request:  49
  Current serial number in output stream:  50
stage 2

Not entirely sure what's going on here.

Offline

#25 2022-01-24 20:08:11

seth
Member
Registered: 2012-09-03
Posts: 50,928

Re: [SOLVED] Monitor Will Not Receive Signal From Sleep

Either the call is too early or xrandr doesn't like the mode.
What's the output of "xrandr -q" (under normal circumstances)?
Try to delay the call more generously ("sleep 10" instead of "sleep 1") and also try to just switch the refresh rate ("--rate 60" … "--rate 144")

Offline

Board footer

Powered by FluxBB