Is there a way to turn on the keyboard backlight from the multi-user.target environment? As X11 is not loaded, the command xset led on does not work and gives xset: unable to open display "".

Currently, I am wanting the keyboard backlight to turn on each time the system starts (only if the keyboard is present). I would also like the keyboard backlight to turn on regardless the system loading in a graphical or non-graphical environment. Preferably, I would like this done through Cron.

2 Answers 2


You can do this with setleds, which acts on the current virtual terminal (without using X):

setleds +num +caps +scroll

You can set the VT defaults with the -D flag. If standard input isn’t a VT, you can redirect it:

setleds +num +caps +scroll < /dev/tty1

(assuming you can write to /dev/tty1).

  • setleds +scroll turned on the keyboard light and the ScrollLock light along with ScrollLock itself. When applying the -D flag and rebooting, the VT defaults did not persist as all three were set to off (along with the keyboard light). Writing to /dev/tty1 did not make this persist either.
    – Bill Joe
    Commented Jul 16, 2023 at 12:13
  • Ah, are you talking about backlight LEDs rather than the three indicator LEDs? What type of keyboard do you have? (setleds -D doesn’t set boot-time defaults, just defaults during the current session.) Commented Jul 16, 2023 at 13:53
  • To clarify, I am talking about the backlight LED. I am using the Cooler Master Devastator II SGB-3031-KKMF1-US
    – Bill Joe
    Commented Jul 16, 2023 at 17:42

You need to create a systemd service that starts once upon bootup:

sudo nano /etc/systemd/system/setleds.service

Then type the contents:

Description=Run setleds once at startup

ExecStart=/usr/bin/setleds +num +caps +scroll


If that doesn't work and you need the input redirection, just change the relevant line:

ExecStart=/bin/bash -c '/usr/bin/setleds +num +caps +scroll < /dev/tty1'

And to make sure it runs:

sudo systemctl enable setleds.service
sudo systemctl start setleds.service

Alternatively you can use cron instead:

sudo crontab -e

Then, add the following:

@reboot /usr/bin/setleds +num +caps +scroll < /dev/tty1

PS Whoa, I didn't know my keyboard had a backlight... Scroll Lock seems to turn it on!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .