DEV Community

Cover image for Troubleshooting Scroll Lock on Linux: A Step-by-Step Guide
saurav Moktan
saurav Moktan

Posted on • Edited on

Troubleshooting Scroll Lock on Linux: A Step-by-Step Guide

After countless attempts, tweaking configurations, and trying every method under the sun, I was almost convinced that I couldn’t get Scroll Lock to work on my Linux. It was frustrating, especially since it also impacted my ability to turn on the RGB lighting on my keyboard. But then, after some persistence and experimenting, I finally got it working!

It turned out the solution was pretty simple—so simple that I felt silly for missing it. If you’re in the same boat, here’s a step-by-step guide to enable Scroll Lock and, for those with compatible keyboards, activate RGB lighting in Linux (BTW I’m currently using Fedora 41 gnome so it may or may not work for you but you can try may be it work for you.)

Before diving into detailed steps, start with this quick Hardware Check

Check Your Keyboard Hardware

Ensure the issue isn’t with your keyboard

  1. 🔧 Open a terminal and run :
xev | grep Scroll
Enter fullscreen mode Exit fullscreen mode
  1. 🔑 Press the Scroll Lock key. If you see output, the system is detecting the key.

Detailed Steps to Enable Scroll Lock

Step 1: Check xmodmap for Scroll Lock

Run the following command to check if Scroll Lock is mapped:

xmodmap -pm
Enter fullscreen mode Exit fullscreen mode

If Scroll Lock isn’t listed, add it with this command:

xmodmap -e "add mod3 = Scroll_Lock"
Enter fullscreen mode Exit fullscreen mode

This change is temporary and will reset after a restart. To make it permanent:

  1. 🔧 Edit the XKB configuration file located at:

    /usr/share/X11/xkb/symbols/us
    
  2. 🔒 Add the following line under xkb_symbols "basic":

    modifier_map Mod3 { Scroll_Lock };
    
  3. 🌐 Reset the XKB layout cache:

    sudo rm -f /var/lib/xkb/*
    sudo rm -f /var/lib/lib/xkb/*
    

Bonus Tips: For gnome User

If you are a GNOME user, it could also be a problem with the system settings. So, give this solution a try as well.

Step 1: Install GNOME Tweaks

First, you’ll need GNOME Tweaks, a handy tool for customizing various GNOME desktop settings. If you don’t have it installed yet, open a terminal and run:

sudo dnf install gnome-tweaks
Enter fullscreen mode Exit fullscreen mode

Step 2: Open GNOME Tweaks

Once installed, launch GNOME Tweaks. You’ll find it in the applications menu, or you can search for it using your favorite launcher.

Step 3: Navigate to Keyboard Settings

In GNOME Tweaks, go to the Keyboard & Mouse section. Look for an option labeled Additional Layout Options, and click it.

correct keyboard setting

Step 4: Enable Scroll Lock Compatibility

On the Additional Layout Options page, scroll down until you find Compatibility options. Under this section, you’ll see an option labeled Map Scroll Lock to Mod3. Make sure it’s ticked.

correct-layout

choose correct option

Step 5: Test Scroll Lock

Once you’ve enabled this setting, the Scroll Lock key should work as expected. If your keyboard has RGB lighting linked to Scroll Lock, you should see it light up when you toggle it on.

Happy tweaking! 🎉✨

Top comments (0)