Login screen keyboard layout stays QWERTY on Debian/Ubuntu

Published 18 July 2026

date
env
linux Ubuntu 24.04 LTS (arm64, Parallels VM on Apple Silicon) — applies to Debian 12/13 and all Ubuntu flavours macos N/A

Symptom

You log into your desktop and everything is fine: the keyboard is AZERTY (or whatever layout you configured in GNOME Settings → Keyboard). But at the login screen itself, the keyboard is still QWERTY. Typing a password containing a, q, z, w, m or any digit produces the wrong characters, and there is no obvious way to switch layout before authenticating.

Typical trigger: a fresh Debian/Ubuntu install where the installer defaulted to us (very common in virtualised installs — Parallels, VMware, UTM, cloud images — because the installer never sees the physical keyboard).

Checking the current state confirms it:

Terminal window
cat /etc/default/keyboard
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"

Root cause

There are two independent keyboard configurations on the machine:

ScopeWhere it livesWho reads it
Your sessiondconf / GNOME Settings, per userYour desktop session only
System-wide/etc/default/keyboardThe greeter, TTYs, initramfs, LUKS prompt

The display manager greeter (GDM, LightDM, SDDM) does not run as your user. GDM runs as the dedicated gdm system user with its own dconf profile, so it has no idea what you configured in GNOME Settings. It falls back to the system-wide layout — which is still us.

The second half of the problem is distribution-specific and is the reason this how-to is split from its systemd counterpart: on Debian and Ubuntu, localectl set-x11-keymap — the command every generic Linux tutorial recommends — is disabled on purpose:

Setting X11 and console keymaps is not supported in Debian.

Debian delegates keyboard configuration to the console-setup / keyboard-configuration packages, whose single source of truth is /etc/default/keyboard. systemd-localed is patched out of that role to avoid two subsystems fighting over the same setting. So on these distributions you edit the file, then apply it.

Diagnosis

Confirm that the system-wide layout is the culprit and not the session:

Terminal window
localectl status
cat /etc/default/keyboard

If localectl status shows X11 Layout: us (or n/a) while your session behaves as AZERTY, the split described above is confirmed.

Identify your display manager, because the verification step differs:

Terminal window
cat /etc/X11/default-display-manager
systemctl status display-manager --no-pager | head -3

Find the exact layout/variant codes available on the system:

Terminal window
grep -E "^\s+(fr|be)\s" /usr/share/X11/xkb/rules/base.lst
awk '/! variant/,0' /usr/share/X11/xkb/rules/base.lst | grep " fr:"

The second command is the one that matters for Apple keyboards: it lists the mac variant of the fr layout, which maps the </>, @, # and dead keys the way an Apple French keyboard is physically engraved.

Solution

Prerequisites and warnings

  • You need sudo rights.
  • Do not use localectl set-x11-keymap here — it will fail with the “not supported in Debian” message. That command belongs to the other how-to.
  • Changing this file also changes the layout of the TTY consoles and the initramfs/LUKS passphrase prompt. That is usually what you want, but be aware of it if your disk encryption passphrase was typed with a QWERTY layout in mind.
  • Have a way back in (a second admin account, or an SSH session from another machine) in case you mistype the layout code and lock yourself out of the greeter.

Steps

  1. Edit the system-wide keyboard configuration.

    Terminal window
    sudo nano /etc/default/keyboard

    Set the four XKB fields. For a French AZERTY Apple keyboard:

    XKBMODEL="pc105"
    XKBLAYOUT="fr"
    XKBVARIANT="mac"
    XKBOPTIONS=""
    BACKSPACE="guess"

    Common alternatives:

    KeyboardXKBLAYOUTXKBVARIANT
    French AZERTY (PC)fr(empty)
    French AZERTY (Apple)frmac
    French AZERTY (new AFNOR norm)frafnor
    Belgian AZERTYbe(empty)
    US Internationalusintl
  2. Regenerate the configuration.

    Terminal window
    sudo dpkg-reconfigure keyboard-configuration

    An interactive menu appears. It is pre-filled with the values you just wrote, so simply confirm each screen. If you prefer to skip the dialog entirely, the next command alone is often enough:

    Terminal window
    sudo setupcon
  3. Apply to the running console and to the initramfs.

    Terminal window
    sudo setupcon --save
    sudo update-initramfs -u

    update-initramfs is only required if your root filesystem is encrypted and you want the passphrase prompt to use the new layout too. Skip it otherwise.

  4. Reboot.

    Terminal window
    sudo reboot

    A full reboot is the reliable way to make the greeter pick up the change. Restarting the display manager alone (sudo systemctl restart display-manager) works too, but it kills every running session without warning.

Verify

At the login screen, type your password into the username field first (where it is visible) to check the characters, then clear it and log in normally.

Once logged in:

Terminal window
localectl status
cat /etc/default/keyboard
setxkbmap -query

localectl status should now report:

X11 Layout: fr
X11 Model: pc105
X11 Variant: mac

setxkbmap -query only works under X11/XWayland; under a pure Wayland session use:

Terminal window
gsettings get org.gnome.desktop.input-sources sources

If the greeter is still QWERTY while /etc/default/keyboard is correct, the problem has moved to the display manager itself — see Alternatives below.

Rollback

Restore the previous values and re-apply:

Terminal window
sudo nano /etc/default/keyboard
sudo setupcon --save
sudo reboot

If you are locked out of the greeter because of a wrong layout, log in from a TTY (Ctrl+Alt+F3) — but note the TTY now uses the same broken layout. The safest recovery is SSH from another machine, or a root shell via GRUB Advanced options → recovery mode.

Alternatives

The greeter still ignores the setting (LightDM). LightDM does not always inherit console-setup. Force it with a greeter setup script:

Terminal window
sudo tee /etc/lightdm/lightdm.conf.d/50-keyboard.conf > /dev/null <<'EOF'
[Seat:*]
display-setup-script=/usr/bin/setxkbmap fr mac
EOF
sudo systemctl restart lightdm

The greeter still ignores the setting (GDM under Wayland). GDM reads the X11 keymap even in a Wayland session, via xkbcommon. If /etc/default/keyboard is not honoured, create the Xorg fragment by hand — this is the file localectl would have written on other distributions:

Terminal window
sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf > /dev/null <<'EOF'
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "fr"
Option "XkbModel" "pc105"
Option "XkbVariant" "mac"
EndSection
EOF
sudo reboot

Offering a layout picker instead of a fixed layout. Listing several comma-separated layouts makes a selector appear in the greeter’s top bar:

XKBLAYOUT="fr,us"
XKBVARIANT="mac,"

Apple keyboard oddities. If the mac variant still misplaces a few keys, test the plain fr layout for comparison. The mac variant is calibrated for built-in MacBook keyboards; an external Apple keyboard connected to a PC or a VM sometimes matches plain fr better. Under a VM in particular, the hypervisor already translates scancodes, so the guest may not need the mac variant at all. Test both before settling.

Sources

  • Ubuntu manpage: keyboard(5) — format of /etc/default/keyboard
  • Debian Wiki — Keyboard configuration
  • delphix-platform PR #552 — documents localectl set-x11-keymap being unsupported on Debian/Ubuntu 24.04
  • GNOME System Administration Guide — Display multiple keyboard layouts on the login screen