How to turn off monitor on Ubuntu Server

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.


Solution 1:

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!