Getting Scroll Lock to Work in Ubuntu

For some odd reason the Scroll Lock button doesn’t work in an Xsession in Ubuntu. There’s an old bug report here. However it works as it should in a virtual terminal. :? The interesting thing though is that Xev will detect the key press. So how do you get the Scroll Lock functioning again? Well first let’s run this command

xmodmap -pm

You should get an output like this

xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_L (0x7d),  Meta_L (0x9c)
mod2        Num_Lock (0x4d)
mod3
mod4        Super_L (0x7f),  Hyper_L (0x80)
mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x7c)

Notice mod3 has nothing listed.  This will be what we will use to assign Scroll Lock.  It may be a different mod for some people.  Either way use the one that has nothing listed.

Before we do anything else let’s test this to make sure it works.  We’re going to run this command

xmodmap -e ‘add mod3 = Scroll_Lock’

Replace mod3 with whatever the blank mod listing was.  Your Scroll Lock should work now.

I hate making changes like this locally to only my user, so I’m going to do this globally.

Now we need to create a file in /etc/X11 called Xmodmap.  So start up Gedit or your favorite text editor

gksudo gedit /etc/X11/Xmodmap

Now add this to the file

add mod3 = Scroll_Lock

again, change mod3 to the one that was empty from the first command.  Now the Scroll Lock key should get set when X starts now. :)

About these ads

24 thoughts on “Getting Scroll Lock to Work in Ubuntu”

  1. thanks man…i used this info go get my Trendnet KVM switch to work…it uses the key sequence “ScrLock + ScrLock” and my ubuntu wont recognize this…

  2. Excellent info. I’ve used this in 8.04 to get my KVM working. I’ve recently upgraded to Intrepid Ibex 8.10, and it stopped working again. It appears that Xmodmap is no longer used and this must be taken care of though HAL. I’ve managed to do some tweaks to my mouse with a .fdi file. It looks like the same needs to be done to get scroll lock working again. How about an update here to show us noobs how it’s done? :)

  3. Hey

    Thanks for the info ! I have used it on a number of Ubuntu 8.04 boxes with success.

    However if a make the mod in 9.04 it kills the alt-gr button. (The right alt key, which is frequently used on a danish keyboard layout as mine).

    Does anyone know a workaround for this ?

  4. I just upgraded to 9.10 and this will not work. is there a way to do this with newer versions or am SOL. also, i have been having problems with the flash plugins, i am not sure if this is just my hardware (which is very old) or if there is a known bug.

  5. I fixed the problem in Intrepid Ibex and Jaunty by creating the file ~/.Xmodmaprc (in my home directory). This file is picked up by X upon login. The file contains the following :

    add mod3 = Scroll_Lock

    The first time you log in after the creating .Xmodmaprc, the system will ask you if you want to load .Xmodmaprc. The next time you log in, it will not ask you unless you delete the Gnome configuration file for the keyboard modifications located in :

    /home/rbo83/.gconf/desktop/gnome/peripherals/keyboard/general/%gconf.xml

  6. Oh, wow. You are a genius! I have an LED backlit keyboard that will only light up if the Scroll Lock is pressed. Your’re a life saver!

    So why isn’t the scroll lock enabled in the first place? It seems like this would be something pretty standard, wouldn’t it?

  7. Doesn’t work in Knoppix – it “looks” like it works, there’s no error in the terminal, and xmodmap -pm returns as it should (with mod3 being set to scroll lock), but scroll lock still doesn’t actually work.

    Very frustrating.

  8. This is great – a fantastic tutorial as have been having problems with NumLock and CapsLock – it works in Ubuntu Lucid 10.04. When 10.04 first came out – all was working fine but since it was first released the CapsLock, NumLock and ScrollLock all disappeared! Very bizarre! Anyway this is a great way to fix it as I thought it was my keyboard (been using the Microsoft wired keyboard 500 and the Acer keyboard – both set up as generic layout with using Generic 105-key (Intl) PC keyboard.

    Many thanks for your help.

  9. Thanks, had a new keyboard for xmas, thought the led light for the scroll-lock was damaged.

    Followed your instructions on Arch Linux, worked as expected…. many thanks!

  10. The xmodmap solution is not working for me in 12.04 now =( worked in 8.04;

    The scroll lock light *is* fixed, but the toggling of the light doesn’t trigger the KVM for some reason; works fine on my 8.04 and windows boxes though…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s