How to Fix GNOME Crashes After Adding Keyboard Layouts
In Ubuntu System Recovery and GNOME Shell Troubleshooting, adding a new input source (keyboard layout) can sometimes trigger a segmentation fault in gnome-shell. Because the shell crashes before it can load your session, you find yourself stuck at the GDM login screen regardless of how many times you enter your correct password.
1. Identifying the "Login Loop"
When this bug occurs, the system isn't rejecting your password; it's failing to start the desktop environment. You can confirm this by checking the journalctl logs via a virtual terminal.
- Access the Terminal: Press
Ctrl + Alt + F3at the login screen. - Log In: Enter your username and password in the text-based console.
- Check the Error: Run
journalctl -xe | grep gnome-shellto see if it mentions "input-sources" or "mutter."
2. Solution: Resetting Input Sources via Terminal
Since you cannot access the GUI "Settings" app to remove the problematic layout, you must use gsettings or dconf to reset your input sources to the default (usually English US).
- Reset to Default: Execute the following command to clear all added layouts:
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us')]" - Clear Most-Recently-Used (MRU): Sometimes the crash is stored in the MRU list. Clear it with:
gsettings reset org.gnome.desktop.input-sources mru-sources - Return to GUI: Press
Ctrl + Alt + F1(or F2) and try logging in again.
3. Advanced: Editing the dconf Database
If gsettings fails to apply because the D-Bus session is locked, you can manually edit or "dump" your configuration database. This is the most reliable way to strip out a "custom" keyboard file that broke the system.
| Action | Command Line Method |
|---|---|
| Dump Config | dconf dump /org/gnome/desktop/input-sources/ > layout_backup.txt |
| Nuke Settings | dconf reset -f /org/gnome/desktop/input-sources/ |
| Manual Edit | Edit the layout_backup.txt, remove the offending layout, then: dconf load / < layout_backup.txt |
4. Resolving Conflicts with Fcitx5 or IBus
In 2026, many Ubuntu Categories users have reported that the crash occurs specifically when Fcitx5 is installed alongside the default GNOME keyboard manager. These two "Input Method Editors" fight for control over the keyboard layout indicator.
- The Fix: If you use a custom IME, ensure it is set to not override system XKB settings.
- Terminal Check:
im-config -n default(This resets your input method to the Ubuntu default).
5. The "Nuclear" Option: Clearing the Config Cache
If resetting the layouts doesn't work, your local GNOME configuration may be corrupted. You can move your configuration folders to a backup location to force Ubuntu to generate a "factory fresh" desktop upon your next login.
# Run these from a TTY (Ctrl+Alt+F3)
mkdir ~/gnome_backup
mv ~/.config/dconf ~/gnome_backup/
mv ~/.cache/gnome-shell ~/gnome_backup/
sudo reboot
Conclusion
Getting locked out after adding a keyboard layout is a terrifying experience, but it is rarely a sign of hardware failure. By using gsettings to force the layout back to 'us' via the terminal, you can bypass the crash and regain control of your desktop. For Search Engine Optimize success in 2026, always remember that modern GNOME stores its input sources in the dconf binary; manual edits via TTY are the "golden key" to fixing login loops without a full OS reinstallation.
Keywords
gnome crash after adding keyboard layout, ubuntu login loop keyboard error, fix gnome-shell crash input sources, reset keyboard layout terminal ubuntu, locked out of ubuntu after keyboard change, dconf reset input-sources, ubuntu 24.04 gsettings keyboard fix, recover gnome session terminal.
