Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to enable scroll lock so I can toggle lights on my keyboard. This works on Arch.Funny thing it doesn't work on Ubuntu.

$ xmodmap -e ‘add mod3 = Scroll_Lock’
xmodmap:  unknown command on line commandline:1
xmodmap:  unable to open file 'mod3' for reading
xmodmap:  unable to open file '=' for reading
xmodmap:  unable to open file 'Scroll_Lock’' for reading
xmodmap:  4 errors encountered, aborting.
share|improve this question
Thank you , solved the problem – RedBlue May 10 '14 at 17:06
xmodmap -e 'add mod3 = Scroll_Lock'

(Note the difference in the single-quotes!)

Copy this and paste it in a terminal.

Then the error will no longer occur.

I have used this command successfully on my Ubuntu 12.04 system.

share|improve this answer
This won't work anymore on Gnome 3.10 since it will reset keyboard map after every login and screen lock/unlock – Giovanni Toraldo Jan 25 at 20:35
How do you do this with just xkb instead of xmodmap? – CMCDragonkai Jan 27 at 4:52

Or you can switch the lights with these:


xset led named "Scroll Lock"


xset -led named "Scroll Lock"

Works on Ubuntu 12.04 x86 for my SpeedLink illuminated keyboard (SL-6453-SSV-A).

share|improve this answer
How can you use setxkbmap to have scroll lock just work? – Pykler Mar 17 '15 at 3:58

Found the permanent way after a long night up with lots of half baked solutions.

# backup your symbols file
sudo cp /usr/share/X11/xkb/symbols/us{,.distribution} 

Add the following line in the xkb_symbols "basic" { section. do not worry if that second line is not there, it is only there for some languages and was not there for us on my system.

    modifier_map Mod3   { Scroll_Lock }; <==<< Add this line

    include "level3(ralt_switch)" <==<< before this line

You may have to do the same in your other layouts if you switch between languages

Also, there is a cache where xkb layouts live. You should clear it before restarting your X server to check the new keyboard symbol file(s).

sudo dpkg-reconfigure xkb-data
share|improve this answer
Works on ubuntu 14.04 too (tested with Cooler Master Devastator keyboard) – Giovanni Toraldo Jan 25 at 20:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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