How can I change the Keyboard Layout on login screen?

26,212
  • 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
Share:
26,212

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    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.

  • Cedric Martens
    Cedric Martens over 6 years
    But how am I supposed to type sudo service keyboard-setup restart if I can't login because of the layout
  • Colonel Panic
    Colonel Panic about 5 years
    Why switch to console mode? Can't I just open a terminal?
  • Akif
    Akif over 4 years
    Ctrl + Alt + F3 for switching to console mode in Ubuntu 18.04 askubuntu.com/a/1053220/726213
  • wgj
    wgj about 4 years
    This worked specifically when most x.org settings (setxkbmap and localectl ... would not persist after restarts with Kali. Thank you very much.
  • medina
    medina about 4 years
    I've ben looking for this solution for a long time. Really appreciate your answer. Many thanks!
  • ElRudi
    ElRudi over 3 years
    I know this thread is old, but maybe the people are still around ;) Is there a way to add a second keyboard? This solution replaces the existing layout
  • user149408
    user149408 about 3 years
    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.
  • user149408
    user149408 about 3 years
    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?
  • Admin
    Admin almost 2 years
    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
  • Admin
    Admin almost 2 years
    you can try localectl list-x11-keymap-layouts or localectl list-x11-keymap-variants
  • Admin
    Admin almost 2 years
    That's excatly what I meant ! Thanks !