I have Ubuntu Server 20.04 installed on an early 2011 MacBook Pro 8,1 and I want to close the lid and turn the screen off.
I have succesfully prevented it from sleeping when closing the lid as described here https://askubuntu.com/a/594417
and from another answer https://askubuntu.com/a/1117586 in the same question, I created a script to trigger the screen on/off. This script gets executed I have confirmed that with logging the calls to it.
The first problem is (was) that
sudo vbetool dpms off
resulted in this
mmap /dev/zero: Operation not permitted
Failed to initialise LRMI (Linux Real-Mode Interface).
So I tried the solution here
Ubuntu 20.04 on a laptop - is there any way toturn off the screen?
that adds this
sudo mount -o remount,exec /dev
sudo vbetool dpms off
sudo mount -o remount,noexec /dev
but it results in
Real mode call failed
and yes the screen does not turn off
I tried xset and xrandr but they can't open the display
The installation is headless without GUI
uname -a
Linux oldlaptop 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-5.4.0-91-generic root=/dev/mapper/ubuntu--vg-ubuntu--lv ro
Any ideas how to turn off the screen, either using vbetool or any other?