0

If the monitor on a remote Ubuntu Server goes into sleep mode, is there a way that you can wake it up from an SSH command line?

I have tried using export "DISPLAY=:0" and then xset -dpms to try and turn off power saving modes but I get:

 Invalid MIT-MAGIC-COOKIE-1 keyxset:  unable to open display ":0"

The server is Ubuntu 16.04.3 LTS running the Zentyal web front end. There is a UI on the remote server that local admins can log into, but for some unknown reason after applying updates via the Zentyal web admin screen and re-booting the screen seems to go into power save and wiggling the mouse or pressing a key won't wake it so I am trying to force the server to wake up the screen.

  • Did you try plugging it out and in again? Seriously, did you try xrandr --output YOURSCREEN --off && xrandr --output YOURSCREEN --auto? You did run xset as root, didn't you? – dessert Oct 11 '17 at 11:19
  • Did you try to set the display directly in xset? xset -display :0 -dpms – dessert Oct 11 '17 at 11:31
  • @dessert I am remote to the site that has the server so I asked them to wiggle the mouse and press a shift key on the server's keyboard and that did not work. The screen just reports that it is in power save mode. I didn't run xset as root or use sudo and I did not run xrandr. – Siv Oct 11 '17 at 17:42
  • @dessert I did try running xset -display using two separate commands, ie: – Siv Oct 11 '17 at 19:08
1

I know this thread is old, but just in case someone is wondering. I was getting exactly the same problem: unable to open display ":0"

I was trying to turn on two of my displays via SSH, but it failed with the message from above. Other thing I had to say is that I wasn't logged on the console of the physical PC, so, only the logon screen was there, but the displays were off because of the idle settings.

So, on my case, I had to add also the XAUTHORITY variable as follows:

#Turn on the main display
sudo DISPLAY=:0 XAUTHORITY=/run/user/121/gdm/Xauthority xrandr --output HDMI-0 --off
sudo DISPLAY=:0 XAUTHORITY=/run/user/121/gdm/Xauthority xrandr --output HDMI-0 --auto

#Turn on the second display
sudo DISPLAY=:0 XAUTHORITY=/run/user/121/gdm/Xauthority xrandr --output DP-4 --right-of HDMI-0 --off
sudo DISPLAY=:0 XAUTHORITY=/run/user/121/gdm/Xauthority xrandr --output DP-4 --right-of HDMI-0 --auto

Here I have to mention that I'm using Ubuntu 18 with gdm3 as display manager. You should check the path:

/run/user/121/gdm/Xauthority

It maybe different on your system. Also check your xorg.conf configuration. There I defined two screens as follows:

    Screen      0  "Screen0"
    Screen      1  "Screen1" RightOf "Screen0"

That's why I'm using the "--right-of" option.

Finally check the names of your ouputs by running:

sudo DISPLAY=:0 XAUTHORITY=/run/user/121/gdm/Xauthority xrandr -q

There you will get the right names. On my case: "HDMI-0" (main monitor) and "DP-4" (second monitor).

| improve this answer | |
  • Thanks for your comment, this was a long time ago and I got sick of Zentyal and the HP Server it was running on causing problems like this so now we have a Dell Server running ClearOS and everything works like a charm, so I don't need to fix it any more, however I have this page bookmarked and if I hit this issue in the future I will at least know how to fix it. Thanks again. – Siv May 27 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.