Freshly installed 14.04, CoolerMaster Storm keyboard. I'm not at all concerned with being able to toggle/turn off the LED, I simply want the LED to turn on before login, i.e. while looking at the login screen, the LED should already be on.

I've set up a keyboard shortcut to run xset led 3, but this is less than ideal, as I have to be logged in in order to use the shortcut. I'd like this to happen automatically instead.

I'm very new to both Linux and scripting, so please ELI5/walk me through it. I know that you can run scripts at startup as per this, but I don't understand how to actually write the script or how to "put it in" /etc/rc.local. Do I simply fire up gedit and type xset led 3 directly into rc.local below the #comments, but above the exit 0? Do I make another script somewhere else and link to it in rc.local? Am I overthinking it (probably)?

In short, I'd like a more detailed explanation of what Mitch was saying in the link. Thanks for your time.

  • 4
    You should be able to simply add xset to the rc.local and it works, exactly as you said (before the exit 0). Make sure you edit rc.local with root privileges (open console and type sudo <editor name> /etc/rc.local) and also ensure the file is executable (chmod +x /etc/rc.local) – willl459 Mar 18 '16 at 0:06
  • @willl459 Tried it, doesn't seem to work, unfortunately. Here's what my /etc/rc.local looks like: imgur.com/c2ZdCsi. I made sure it was executable: imgur.com/MavjohI – Baku9 Mar 18 '16 at 0:35
  • 1
    That looks correct. Try the answer by shvahabi here. Steps 1 through 7 seem to be right so try step 8, type sudo /etc/init.d/rc.local start on a terminal and restart. – willl459 Mar 18 '16 at 0:48
  • @willl459 Please don't recommend starting graphical programs with plain sudo. D: Use sudo -i. – Seth Mar 18 '16 at 1:20
  • 1
    in rc.local put the full path to xset. You can figure it out by issuing which xset – jet Apr 12 '16 at 17:27

Open the terminal, enter sudo -s to get root-access. Now enter nano /etc/rc.local, now edit the file so it looks like this:

!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

xset led 3
exit 0

Now save with Ctrl + O, press enter and then Ctrl + X to exit.

Let's set the proper permissions using:

sudo chown root /etc/rc.local
sudo chmod 755 /etc/rc.local

Make sure everything works fine using:

sudo /etc/init.d/rc.local start

And now reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.