3

Installed Ubuntu server on a tablet. But the screen always stays on.

Can do a command:

echo -ne "\033[9;5]" > /dev/tty1

It does turn it off or at least it then goes to black. If I press a key on the keyboard it comes back on - that's what I want.

But that command doesn't stay. Sometimes in a week or so it can turn back on and I did not touch the keyboard.

There are all sorts of things can find for the desktop but not the server to turn the screen off when not using the keyboard on it.

Zanna
  • 70,465

1 Answers1

13

SOLUTION (verified with Ubuntu 20.04 server running on a laptop)

Create a file:

sudo nano /etc/systemd/system/enable-console-blanking.service

And put this into the file:

[Unit]
Description=Enable virtual console blanking

[Service] Type=oneshot Environment=TERM=linux StandardOutput=tty TTYPath=/dev/console ExecStart=/usr/bin/setterm -blank 1

[Install] WantedBy=multi-user.target

Then change the file rights and enable the service:

sudo chmod 664 /etc/systemd/system/enable-console-blanking.service
sudo systemctl enable enable-console-blanking.service

And reboot the server. Now the screens blanks after 1 minute without keypresses, even before the login.

  • This worked the first time, but then the screen turned white after each subsequent timeout. – Chris Jenks Apr 01 '22 at 19:28
  • That's strange. For me it works after several reboots using Ubuntu 20.04 server. Try checking if the created files mentioned above are altered. – Tobias Holm Apr 03 '22 at 08:16
  • Yes, it is strange. No change to the config file. I notice that when I disturb the blackened screen by hitting shift, the screen flashes white before the text console reappears. So I wonder if the screen is displaying white and the backlight turns off the first time, but the backlight fails to turn off subsequently. I am running 20.04.4 desktop, with startx disabled, on a Lenovo Thinkpad X131e. – Chris Jenks Apr 04 '22 at 16:51
  • ok. Maybe there are something in the computer BIOS that causes the backlight to stay on, if possible you could try to reset the BIOS-settings to default. Is it a Chromebook? Maybe you can try moving the hard drive to another computer and see if it behaves the same, or if the problem is tied to the Thinkpad X131e machine. – Tobias Holm Apr 06 '22 at 07:25
  • I was able to fix the problem by adding radeon.backlight=0 to the kernel parameters in the grub configuration. – Chris Jenks Apr 07 '22 at 17:18
  • Worked for me. Thank you! – mix3d Feb 04 '23 at 06:18
  • setterm: terminal xterm-256color does not support --blank – Porcupine Mar 01 '23 at 09:49
  • If you used the solution above, the --blank option would work, because the terminal type is switched to 'linux'.

    The error message "setterm: terminal xterm-256color does not support --blank" means that the terminal type you are using does not support the "--blank" option in the "setterm" command.

    To resolve this issue, you can try using a different terminal type that supports the "--blank" option. For example, you can try using the "linux" terminal type instead of "xterm-256color" by running the following command: export TERM=linux

    – Tobias Holm Mar 02 '23 at 11:45