I changed my Keyboard Layout from Swedish to English, but now my password doesn’t work and I can’t login. I need a way to change the keyboard layout at the login screen without having access to the keyboard or a way to enter the password using characters not available on the keyboard itself.
7 Answers
Press Ctrl+Alt+F1 to switch console mode. Type your username and press Enter and also now type your password.
Next type
sudo dpkg-reconfigure keyboard-configuration
and hit Enter type your password again and follow screen instruction.
As usual, it will prompt you for the model of keyboard (what the keyboard is), and then for the keyboard layout (what the keys should do)
To apply new settings, restarting the keyboard-setup service with this
sudo service keyboard-setup restart
-
7But how am I supposed to type
sudo service keyboard-setup restart
if I can't login because of the layout Jan 25, 2018 at 12:50 -
-
1This worked specifically when most x.org settings (
setxkbmap
andlocalectl ...
would not persist after restarts with Kali. Thank you very much.– wgjMar 5, 2020 at 22:01 -
1I've ben looking for this solution for a long time. Really appreciate your answer. Many thanks!– medinaMay 2, 2020 at 4:42
-
1To answer some questions from the comments: Depending on how/where OP set the layout, this change only affects the desktop session, but not the tty consoles (where the login screen gets its layout from depends on the flavor of Ubuntu). Hence we need
Ctrl + Alt + F3
to switch to a tty console, which (hopefully) still has the Swedish layout so OP can enter their password. Of course one could run these commands from a terminal, but only after you manage to log into a desktop session. Apr 21, 2021 at 11:01
This works for me: Change de variable XKBVARIANT = “us”, on file /etc/default/keyboard to the name of layout you want and reboot.
-
For me it was a french "afnor" and I switched to "azerty". It was a shot in the dark however, I wonder where one could find a list of all available variants– Axel BJul 11, 2022 at 11:10
-
you can try
localectl list-x11-keymap-layouts
orlocalectl list-x11-keymap-variants
Jul 12, 2022 at 13:25 -
-
@AxelB The file
/usr/share/X11/xkb/rules/xorg.lst
contains a list of all available variants. Source: manpages.ubuntu.com/manpages/bionic/en/man5/… (and tried it myself) Jun 15, 2023 at 7:43
This is an old post, but recently I have faced with the same issue and the solution above did not help.
During the Linux Mint installation, I accidentally selected the wrong keyboard layout. Later I fixed it by removing the old one and adding the proper keyboard, but unfortunately, this had no impact on the login screen.
Solution:
- login and show your current, working layout configuration with
setxkbmap -print -verbose 10
- check the layout that is used on the login screen:
cat /etc/default/keyboard
- set up properly the login screen keyboard layout with
sudo dpkg-reconfigure keyboard-configuration
That was the only solution that worked for me. I hope that it helps you as well.
For anyone who's been facing the same problem and nothing worked here's an idea boot from the recovery mode then scroll down to root then write the following command to reset your password "passwd yourUserName" then enter your new password for that username hope this helps :)
-
Wouldn’t it be possible to run
sudo dpkg-reconfigure keyboard-configuration
in recovery mode and revert to a keyboard layout that has all the characters needed for recovery mode? Apr 23, 2021 at 16:26
In GNOME 42, localectl
told me VC Keymap: n/a
.
Running sudo localectl set-x11-keymap dk
set the login screen layout to Danish.
I have no input source selection available under Region & Languages > Login Screen.
See further this GNOME help page
I just had the same problem on Ubuntu 22. On the login screen click on the accessibility options and activate the screen keyboard, then you should be able to get your special character and login.
Then once logged in, you should be able to do the proper configuration described by the other answers.
Use tty3 using Ctrl+Alt+F3
sudo nano /etc/default/keyboard
to look like this:# KEYBOARD CONFIGURATION FILE # Consult the keyboard(5) manual page. XKBMODEL="macbook78"<br> XKBLAYOUT="de"<br> XKBVARIANT="basic"<br> XKBOPTIONS=""<br> BACKSPACE="guess"
sudo setupcon
reboot
After that it changed my layout.
-
-
Not sure why this was downvoted. The accepted answer didn't work for me but changing
sudo nano /etc/default/keyboard
withXKBLAYOUT="de"
did the trick (with a restart) Nov 26, 2022 at 13:24