5

I'm running Ubuntu Server on an old iMac. The server monitor does not shut off after boot, but that only started happening after a recent update. Until now, setterm -blank 10 in my ~/.bashrc did the trick (and, yes, I did try --blank instead of -blank, even though the latter has been working for months). But now, it stays on constantly.

I've tried the following (via ssh):

sudo vbetool dpms off

mmap /dev/zero: Operation not permitted
Failed to initialise LRMI (Linux Real-Mode Interface).

I edited /etc/sudoers by granting myuname ALL=(ALL) NOPASSWD: /usr/sbin/vbetool, but to no effect.

sudo xset dpms force off

xset: unable to open display ""

xrandr --query

Can't open display.

The $DISPLAY environment variable is not set.

Neither ps aux | grep "X " nor ps aux | grep -i display produce any output to help identify display IDs.

And that's the depth of my toolbox, I'm afraid. Any help to shut off my monitor would be greatly appreciated.

  • xset -display :0 dpms force off works for me (without sudo). – Jos Jul 12 '21 at 22:30
  • Thanks @Jos. I still get an error with your suggestion: 'xset: unable to open display ":0"' – chaoborid Jul 12 '21 at 22:33
  • What is the output of ls /tmp/.X11-unix/? Every X display should correspond to an entry there. – Jos Jul 12 '21 at 22:38
  • Literally nothing. Here it is. total 8.0K drwxrwxrwt 2 root root 4.0K Jul 12 20:59 . drwxrwxrwt 16 root root 4.0K Jul 12 21:31 .. – chaoborid Jul 12 '21 at 22:40
  • Then you don't have an X server running. Which is normal for a Ubuntu Server. vbetool dpms off still seems to be the way to go. – Jos Jul 12 '21 at 22:43
  • I get the same error with vbetool dpms off (without sudo) as I reported above. It's not clear to me what "Failed to initialise LRMI (Linux Real-Mode Interface)" means. – chaoborid Jul 12 '21 at 22:46
  • See https://bugs.launchpad.net/ubuntu/+source/vbetool/+bug/1875240 where a solution for this error was found: editing grub by adding iomem=relaxed, and rebooting. – Jos Jul 12 '21 at 22:49
  • I tried both editing grub by adding iomem=relaxed (updating grub, and rebooting), as well as using the mount -o remount,exec /dev which was recorded as a solution on that bug report. Both yielded the same LRMI initialization error when running the vbetool. – chaoborid Jul 12 '21 at 23:06
  • Try adding consoleblank=60 to the GRUB_CMDLINE_LINUX_DEFAULT= in the /etc/default/grub file, then run sudo update-grub and reboot the system. 1 minute (60 seconds) after boot, the monitor should turn off. – Terrance Jul 12 '21 at 23:52
  • Thanks @Terrance. This seemed to do the trick. – chaoborid Jul 13 '21 at 04:01
  • @chaoborid Changed my comment into an answer for you. – Terrance Jul 13 '21 at 13:31

1 Answers1

5

Try adding consoleblank=60 or any mount of seconds that you want to the GRUB_CMDLINE_LINUX_DEFAULT= line in the /etc/default/grub file. Then run sudo update-grub and reboot the system.

After your choice of seconds added to consoleblank the monitor should turn off after booting the system up.

Hope this helps!

Terrance
  • 41,612
  • 7
  • 124
  • 183
  • This is a good trick. On my iMac screen goes off correctly after boot. However if I try to type some commands, next time screen will go to a white screen. Why is it? – PouJa Jan 22 '24 at 14:15
  • @PouJa consoleblank= whould be used on a server and not a desktop. If you are running a server on your iMac and use this, it may be conflicting with the local video driver that might have been installed. Usually though, servers are meant to be headless and it without actual keyboard interaction. If this is a desktop system with a full GUI, I would recommend not to use this, but to use the screensaver software instead with the screen blanking. – Terrance Jan 22 '24 at 14:19
  • It is a desktop computer but with headless ubuntu server installed on it. I use it as a small home server and in the night it makes my room glow. I don't know how to make the screen go off automatically after some seconds of idling and come back on just after I press a button. – PouJa Jan 22 '24 at 14:23
  • 1
    @PouJa You might want to look more into the Power saving modes then https://help.ubuntu.com/community/PowerManagement/ReducedPower. The consoleblank= command line option I don't think powers the monitor off, as I know that when the monitor I have hooked up to my server will still glow all the time. So I just power mine all the way off and I don't touch my server unless I absolutely have to like in a failure or in a OS update on it when it could go offline from my remote control. – Terrance Jan 22 '24 at 14:38