Turn Off Display
This guide explains how to configure Ubuntu Server 24.04 to turn off the physical display after 10 minutes of boot using vbetool
. This solution is suitable for text-based consoles and addresses the limitation of setterm
not working in terminal emulators like xterm
.
Prerequisites
- Ubuntu Server 24.04.
- Physical monitor connected to the server.
- Root or
sudo
privileges. - Ensure your hardware supports DPMS (Display Power Management Signaling).
Steps
1. Install vbetool
Install the vbetool
package to control display power.
sudo apt update
sudo apt install vbetool
2. Test Turning Off the Display
Verify that vbetool
can turn off the monitor.
sudo vbetool dpms off
- The physical monitor should turn off.
- Press a key on the physical keyboard to turn it back on.
- If this doesn't work, your hardware may not support DPMS. Consider alternative solutions like kernel console blanking.
3. Create a Script to Turn Off the Display
Create a script to delay the display turn-off by 10 minutes (600 seconds).
sudo nano /usr/local/bin/screen-off.sh
Add the following content:
#!/bin/bash
sleep 600
/usr/sbin/vbetool dpms off
Save and make the script executable:
sudo chmod +x /usr/local/bin/screen-off.sh
Now wee can run this script at boot using Crontab
. Not vbetool requres root so it needs to be on root's Crontab.
sudo crontab -e
# Crobntab entry for trigger on boot
@reboot path/to/your/script
4. Create a Systemd Service
Automate the script to run at boot using a systemd service.
sudo nano /etc/systemd/system/screen-off.service
Add the following content:
[Unit]
Description=Turn off screen after 10 minutes
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/screen-off.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Save the file.
5. Enable and Start the Service
Enable the service to run at boot and start it immediately.
sudo systemctl enable screen-off.service
sudo systemctl start screen-off.service
6. Test the Configuration
- Reboot the server:
sudo reboot
- Wait 10 minutes after boot. The physical monitor should turn off.
- Press a key on the physical keyboard to wake the monitor.
Troubleshooting
- Monitor doesn't turn off:
- Check if the service ran:
journalctl -u screen-off.service
. - Test
vbetool dpms off
manually to confirm hardware support. - Ensure you're testing on the physical console, not an SSH session.
- Check if the service ran:
- Hardware compatibility:
- Some monitors or GPUs may not support DPMS. Run
lspci | grep VGA
to identify your GPU and share details for further assistance.
- Some monitors or GPUs may not support DPMS. Run
- Logs:
- Check system logs for errors:
dmesg | grep -i dpms
orjournalctl -xe
.
- Check system logs for errors:
Notes
- This solution turns off the display completely, saving more power than blanking.
- It applies to the physical console (e.g.,
/dev/tty1
). If using a GUI, alternative tools likexset
may be needed. - If the monitor remains dimly lit, check its power settings or hardware-specific quirks.
For further assistance, provide hardware details (GPU, monitor model) or error logs.