A few months ago I tried to reassign some keys on my keyboard and accidentally broke my '8' key. Unfortunately, I have no idea how I did it because I tried out a few different methods and didn't notice that I had broken it until a few days later.

To fix it, I used xev to find out the keycode, 17, then I used xmodmap to assign the correct value: xmodmap -e "keycode 17=8".

However, the key still doesn't work. When I check it out in xev it shows the right keycode and the right assigned value but the computer doesn't seem to be recognising when the key is pressed. I know the key works because if I hold it down it starts printing 8s after a few seconds.

Update: I just noticed that after messing around with xmodmaps the shift+8 and alt+8 functionality is now also broken so I cannot get a left parenthesis or the left square bracket.

Resetting the keyboard to the default should work. I tried doing it with dpkg-reconfigure keyboard-configuration but I am using a lenovo t460p and they don't seem to have correct keyboard model.

I have been looking around the forums but I can't seem to find a solution. The all seem to be for adding shortcuts or switching key values. Any help would be much appreciated.

  • To reset it: sudo apt install --reinstall xkb-data May 14, 2017 at 16:43
  • I'm afraid that had no effect @GunnarHjalmarsson May 14, 2017 at 17:37
  • Well, then you'd better explain how you reassigned some keys. May 14, 2017 at 17:38
  • I'm afraid I really don't know. As I said, I tried out a few different methods for a different key (unsuccessfully) I didn't realise it had happened until a few days later, and that was a few months ago. Is there some way I can check if the OS is recognising the key is being pushed? There must be a config file somewhere that assigns the actions for different keys, right? May 14, 2017 at 18:07
  • There is not one single file, it's pretty complex, and I for one am not able to help if you don't remember what you did. Possibly a reinstall of the OS is the easiest way to move forward. May 14, 2017 at 19:00

1 Answer 1


It turns out the shortcut I had previously been trying to add via System Settings/Keyboard/Shortcuts/Custom Shortcuts was still there and was the cause of the problem. I had been trying to assign the period "." to the "," key on the German numeric keypad on my keyboard. I added the shortcut via the GUI and I'm not sure how it got mixed up. The '8' key did not seem to be assigned to it. When I tried xmodmap -pke | grep 8, the key seemed to be assigned correctly. Also, resetting the keyboard with setxkbmap -layout de had no effect. However, when I deleted the shortcut the 8 key went back to behaving normally.

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.