Ubuntu – Restoring the original keyboard mapping without logging on

xmodmap

I used xmodmap to remap some keys. I followed directions to restart. Now, I can't log in.

How can I restore my previous keyboard mapping?

Best Answer

Reboot.

Press and hold the left Shift key.

Look for the kernel that ends in (recovery mode) and load it.

enter image description here

Now drop to a root shell.

enter image description here

Then move to the user directory in question and delete the .Xmodmap file.