As a Linux system administrator, I've frequently encountered situations where headless servers blank their virtual console displays after inactivity, despite having no actual power-saving requirements. This behavior originates from the Linux kernel's VT (virtual terminal) power management system.
The console blanking is controlled by three key components:
1. Kernel parameters (consoleblank)
2. Terminal settings (setterm)
3. getty services (specific to login prompts)
The most reliable method is modifying the kernel boot parameters. Edit your bootloader configuration:
# For GRUB (most common)
sudo nano /etc/default/grub
# Find GRUB_CMDLINE_LINUX_DEFAULT and add:
GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0"
# Then update GRUB
sudo update-grub
For systems using systemd, create a service to run at startup:
# /etc/systemd/system/disable-console-blanking.service
[Unit]
Description=Disable console screen blanking
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/bin/setterm -blank 0 -powersave off -powerdown 0
[Install]
WantedBy=multi-user.target
Enable it with:
sudo systemctl enable --now disable-console-blanking.service
For login prompts, modify getty services. Create or edit:
# /etc/systemd/system/getty@tty1.service.d/noblink.conf
[Service]
ExecStartPre=/usr/bin/setterm -blank 0 -powersave off -powerdown 0
Check current settings with:
cat /sys/module/kernel/parameters/consoleblank
setterm -powerdown
setterm -blank
The first command should return 0, and the others should show '0' or 'off'.
- Ubuntu/Debian: Works with GRUB method
- RHEL/CentOS: May need additional getty service modifications
- Arch Linux: Both methods work, but systemd approach preferred
Persistent console display is crucial for:
- Headless server debugging
- Industrial control systems
- Kiosk mode applications
- Long-running terminal sessions
If you're managing a headless Ubuntu server that occasionally needs local access, you've probably encountered the frustrating console blanking behavior. The screen goes dark after a few minutes of inactivity, requiring keyboard input to wake it up - not ideal when you're troubleshooting or just checking system status.
Linux console blanking is controlled by the kernel's VT (virtual terminal) subsystem. The blanking timeout is governed by:
# Current value can be checked with:
cat /sys/module/kernel/parameters/consoleblank
The most reliable system-wide approach is to modify kernel boot parameters:
- Edit the GRUB configuration:
sudo nano /etc/default/grub
- Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and add:
consoleblank=0
- Update GRUB:
sudo update-grub
- Reboot for changes to take effect
For systems using systemd, create a service to run at boot:
# /etc/systemd/system/disable-console-blanking.service
[Unit]
Description=Disable console blanking
[Service]
Type=oneshot
ExecStart=/usr/bin/setterm -blank 0 -powersave off -powerdown 0
[Install]
WantedBy=multi-user.target
Then enable it:
sudo systemctl enable --now disable-console-blanking.service
After implementing either solution, verify with:
cat /sys/module/kernel/parameters/consoleblank
# Should return 0
Or check current terminal settings:
setterm -term linux -dump