I have a problem with my keyboard: the left Alt key is not working any more.

When I logged in into the Window manager, I can remap the key to caps lock key, and everything works fine.

I changed the password for my main user, but didn't take into account, that the encryption password for my home partition should be changed accordingly. So, I cannot log in.

I would like to use Ctrl+Alt+F1 to log into shell, but that is not possible because I am missing Alt key.

I have the root password, but I don't have USB booting drive. I also tried the on-site screen keyboard, but unfortunately on Ubuntu that one has no Alt key.

How can I change the Alt key in Grub?

  • grub keyboard mapping has nothing to do with kernel's keyboard mapping. – Ipor Sircer Sep 18 '18 at 8:35
  • now I cannot log in, what makes you think you can login from a console? Do you have access to the root account (whose "home" is /root and hopefully not encrypted)? Fastest way to me to recover the system, grab an USB keyboard with a working Alt key or just boot with a live distro. – Mr Shunz Sep 18 '18 at 8:35
  • Yes I have the root password. And here on holidays unfortunately I neither have a USB device nor an extra keyboard with me – rubo77 Sep 18 '18 at 8:51
  • 1
    You can try in single user mode from grub – ctac_ Sep 18 '18 at 9:00
  • Thanks @ctac_, this will help in my case: askubuntu.com/q/132965/34298 – rubo77 Sep 18 '18 at 15:15

You need two command-line based tools, xev and xmodmap.

You can use xev to remap a key, start the terminal window and run xev, then press the key whose behaviour you want to change. In your case the alt key. xev will show you information about the alt key. such as:

state 0x18, keycode 131 (keysym 0xffe9, Alt_L), same_screen YES,
XKeysymToKeycode returns keycode: 108

You can use xmodmap to swap two keys.

  • Nice answer. But that would only work if you can log on in the first place. I guess, you didn't read my question fully ;-) – rubo77 Sep 18 '18 at 13:21
  • @rubo77. Kindly, what is your system and the Grub version? – user88036 Sep 18 '18 at 13:24
  • Ubuntu 18 with grub 2 – rubo77 Sep 18 '18 at 15:09

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.