How can I change the Keyboard Layout on login screen?
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.
6 Answers 6
- 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
But how am I supposed to type sudo service keyboard-setup restart if I can’t login because of the layout
This worked specifically when most x.org settings ( setxkbmap and localectl . would not persist after restarts with Kali. Thank you very much.
To 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.
Linux etc default keyboard
NAME
keyboard - keyboard configuration file
DESCRIPTION
The keyboard file describes the properties of the keyboard. It is read by setupcon(1) in order to configure the keyboard on the console. In Debian systems the default keyboard layout is described in /etc/default/keyboard and it is shared between X and the console. The specification of the keyboard layout in the keyboard file is based on the XKB options XkbModel, XkbLayout, XkbVariant and XkbOptions. Unfortunately, there is little documentation how to use them. Description of all possible values for these options can be found in the file xorg.lst. You might want to read “The XKB Configuration Guide” by Kamil Toman and Ivan U. Pascal: http://www.xfree86.org/current/XKB-Config.html Other possible readings are: http://pascal.tsu.ru/en/xkb/ http://www.charvolant.org/~doug/xkb/ The complete XKB-specification can be found on http://xfree86.org/current/XKBproto.pdf The file keyboard consists of variable settings in POSIX format: VARIABLE=VALUE Only one assignment is allowed per line. Comments (starting with '#') are also allowed.
OPTIONS
The following variables can be set. XKBMODEL Specifies the XKB keyboard model name. Default: pc105 for most platforms. XKBLAYOUT Specifies the XKB keyboard layout name. This is usually the country or language type of the keyboard. Default: us for most platforms XKBVARIANT Specifies the XKB keyboard variant components. These can be used to further specify the keyboard layout details. Default: not set. XKBOPTIONS Specifies the XKB keyboard option components. Options usually relate to the behavior of the special keys (, , , , etc.) Default: not set. BACKSPACE Determines the behavior of and keys on the console. Allowed values: bs, del and guess. In most cases you can specify guess here, in which case the current terminal settings and the kernel of your operating system will be used to determine the correct value. Value bs specifies VT100-conformant behavior: will generate ^H (ASCII BS) and will generate ^? (ASCII DEL). Value del specifies VT220-conformant behavior: will generate ^? (ASCII DEL) and will generate a special function sequence. KMAP Usually this variable will be unset but if you don't want to use a XKB layout on the console, you can specify an alternative keymap here. Specify a file that is suitable as input for loadkeys(1) on Linux or for kbdcontrol(1) on FreeBSD.
FILES
The standard location of the keyboard file is /etc/default/keyboard. Description of all available keyboard models, layouts, variants and options is available in /usr/share/X11/xkb/rules/xorg.lst. In most cases, in /usr/share/keymaps/ or /usr/share/syscons/keymaps/ you will find several keymaps that can be used with the variable KMAP.
NOTES
In Debian systems, changes in /etc/default/keyboard do not become immediately visible to X. You should either reboot the system, or use udevadm trigger --subsystem-match=input --action=change
BUGS
When a triple-layout is used, i.e. a layout with three XKB groups, then the group toggling happens in the following way: Group1 -> Group2 -> Group1 -> Group3. On FreeBSD triple- and quadruple-layouts are not supported (only the first and the second layout are taken into account). The option grp:shifts_toggle is not supported.
EXAMPLES
The following configuration will give you the standard US QWERTY layout (us). The key will act as a compose key (compose:menu) and will act as third control key (ctrl:nocaps). XKBLAYOUT=us XKBVARIANT= XKBOPTIONS=compose:menu,ctrl:nocaps In the following configuration the right key (grp:toggle) will toggle between US QWERTY layout (us) and Greek (gr) layout. The option grp_led:scroll is ignored on the console but in X in means to use the ScrollLock keyboard led as indicator for the current layout (US or Greek). XKBLAYOUT=us,gr XKBVARIANT= XKBOPTIONS=grp:toggle,grp_led:scroll In the following configuration the + key combination will toggle (grp:ctrl_shift_toggle) between French keyboard (fr) without dead keys (nodeadkeys) and British (gb) “Dvorak” (dvorak) keyboard. The right key will be a compose-key (compose:rwin) and the right key will function as AltGr (lv3:lalt_switch). XKBLAYOUT=fr,gb XKBVARIANT=nodeadkeys,dvorak XKBOPTIONS=grp:ctrl_shift_toggle,compose:rwin,lv3:ralt_switch
SEE ALSO
setupcon(1), ckbcomp(1), console-setup(5), loadkeys(1), kbdcontrol(1)
© 2019 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.
How do I change the «system default» keyboard?
I’ve tried changing the session keyboard but it doesn’t work. If I go Settings → Settings Manager → Keyboard → Layout (tab at top) → uncheck Use System Defaults → Delete the current keyboard / add a new one I find that when I log back on the correct keyboard is still not working.
6 Answers 6
You can change the setting for default system keyboard hardware (e.g. «Generic 105-key keyboard» to «Generic 101-key keyboard» ) and also the system keyboard layout (e.g. «us-intl» to «us» ) with the command
sudo dpkg-reconfigure keyboard-configuration
debconf-show keyboard-configuration will show these settings, and it’s stored in /var/cache/debconf/config.dat
view this file /usr/share/console-setup/KeyboardNames.pl . In it you’ll see a Perl Hash of Hashes:
'us' => < 'Cherokee' =>'chr', 'English (Colemak)' => 'colemak', 'English (Dvorak alternative international no dead keys)' => 'dvorak-alt-intl', 'English (Dvorak international with dead keys)' => 'dvorak-intl', 'English (Dvorak)' => 'dvorak', 'English (Macintosh)' => 'mac', 'English (US, alternative international)' => 'alt-intl', 'English (US, international with dead keys)' => 'intl', 'English (US, with euro on 5)' => 'euro', 'English (classic Dvorak)' => 'dvorak-classic', 'English (international AltGr dead keys)' => 'altgr-intl', 'English (layout toggle on multiply/divide key)' => 'olpc2', 'English (left handed Dvorak)' => 'dvorak-l', 'English (programmer Dvorak)' => 'dvp', 'English (right handed Dvorak)' => 'dvorak-r', 'Russian (US, phonetic)' => 'rus', 'Serbo-Croatian (US)' => 'hbs', >
'English (international AltGr dead keys)' => 'altgr-intl',
'English (US, international with dead keys)' => 'intl',
Firstly, see that they all fall under us. Now edit /etc/default/keyboard and change this
XKBMODEL="pc105" XKBLAYOUT="us" XKBVARIANT="intl" XKBOPTIONS=""
XKBMODEL="pc105" XKBLAYOUT="us" XKBVARIANT="altgr-intl" XKBOPTIONS=""
An even better way to find out system name of the keyboard you want to use is with ` localectl list-x11-keymap-variants us`
In ubuntu 14.04, Open system settings > Text Entry ( or Search for it with the Super key and type ‘Text Entry‘ to find it)
Click the plus in the lower left
Select the language (e.g. English(Dvorak), English(Colemak), etc)
To switch between layouts, Super+Space is the default switcher. The mouse can be used to select the text entry method in the up right, shown with an abbreviation for the language.
For English, it will appear as En. For multiple English layouts a subscript appears to differentiate them. Other language key-mappings have a different abbreviation.
I realize it has been 7.5 years since this question was asked, but I found it today when I had the same issue. I came up with this very simple solution that worked for me on Ubuntu 16.04:
Open system settings -> text entry
You will see your input sources («keyboards») listed in a window on the left side. If you want to add more keyboards, press the bottom-left «+».
Here is the trick: Once you have all your desired keyboards, use the up-down arrows at the bottom of that window to arrange the keyboards in your order of choice. The one at the top of the list will be your default keyboard, and you will move along this list when you switch keyboards when pressing Super+Space.
After doing this I logged out and then also restarted the system. The change seems permanent.
I hope this helps people, despite the long time past.