Ubuntu – ubuntu 18.04 keyboard layout messed up after update

18.04keyboard-layoutxps

I have recently performed an update on my Dell XPS 15.

Before the update, the keyboard layout as much as the keyboard shortcuts were working: my German keyboard was recognized, I could switch between keyboard layouts using Super+Space and the Keyboard Shortcuts using the Super key defined in Settings->Devices->Keyboard were working.

After the update, the Super key alone is switching between different Keyboard layouts and NONE tested Keyboard Shortcuts using the Super are working including those that I erased and defined again. Hence, I can not switch between the keyboard layouts using Super+Space.

The responsible update seems to be one of the following (from /var/log/apt/history.log)

Start-Date: 2018-07-31  01:09:58
Commandline: packagekit role='update-packages'
Upgrade: papirus-icon-theme:amd64 (20180723-2516+pkg18~ubuntu18.04.1, 20180728-2528+pkg18~ubuntu18.04.1), console-setup-linux:amd64 (1.178ubuntu2.2, 1.178ubuntu2.3), console-setup:amd64 (1.178ubuntu2.2, 1.178ubuntu2.3), keyboard-configuration:amd64 (1.178ubuntu2.2, 1.178ubuntu2.3)
End-Date: 2018-07-31  01:10:24

Start-Date: 2018-07-31  09:50:32
Commandline: aptdaemon role='role-commit-packages' sender=':1.142'
Install: hunspell-en-gb:amd64 (1:6.0.3-3), hunspell-en-za:amd64 (1:6.0.3-3), hyphen-en-ca:amd64 (0.10), hyphen-en-gb:amd64 (1:6.0.3-3), libreoffice-l10n-en-gb:amd64 (1:6.0.3-0ubuntu1), libreoffice-l10n-en-za:amd64 (1:6.0.3-0ubuntu1), thunderbird-locale-en-gb:amd64 (1:52.9.1+build3-0ubuntu0.18.04.1), mythes-en-au:amd64 (2.1-5.4), libreoffice-help-en-gb:amd64 (1:6.0.3-0ubuntu1), hunspell-en-au:amd64 (1:2017.08.24), hunspell-en-ca:amd64 (1:2017.08.24)
End-Date: 2018-07-31  09:50:35

Attempted solution:
As described here How to permanently configure keyboard I executed

sudo dpkg-reconfigure keyboard-configuration

Selecting "keyboard model: Dell Inspiron 6000/8000 laptop, origin of the keyboard: German, keyboard layout: German, function as AltGr " The default…, No compose key, and no key for X server termination"
gives

WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.1) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-29-generic

After this, everything is working as before the update as described above.

Problem Suprisingly (update-initramfs was called and it was mentioned in the link that this would stick) the changes disappear after reboot. In addition, if I add or remove a keyboard layout via Settings->Region&Language I am also back with my old problems.

I also tried changing /etc/default/keyboard by hand which does not change anything.

Commands and output as suggested by Gunnar Hjalmarsson :

  1. cat /etc/default/keyboard

    XKBLAYOUT="de"
    BACKSPACE="guess"
    XKBVARIANT=""
    XKBMODEL="inspiron"
    XKBOPTIONS=""
    
  2. gsettings get org.gnome.desktop.input-sources xkb-options

    GLib-GIO-Message: 10:49:09.149: Using the 'memory' GSettings backend.  
    Your settings will not be saved or shared with other applications.
    @as []  
    
  3. setxkbmap -query -v 10

    Setting verbose level to 10
    locale is C
    Trying to load rules file ./rules/evdev...
    Trying to load rules file /usr/share/X11/xkb/rules/evdev...
    Success.
    Applied rules from evdev:
    rules:      evdev
    model:      inspiron
    layout:     de,us,us
    variant:    ,,
    options:    grp:lwin_toggle,grp_led:scroll
    Trying to build keymap using the following components:
    keycodes:   evdev+aliases(qwertz)
    types:      complete
    compat:     complete+ledscroll(group_lock)
    symbols:    pc+de+us:2+us:3+inet(evdev)+group(lwin_toggle)
    geometry:   pc(pc104)
    rules:      evdev
    model:      inspiron
    layout:     de,us,us
    variant:    ,,
    options:    grp:lwin_toggle,grp_led:scroll
    

On checking whether dconf database might be corrupted via

cd ~/.config/dconf
mv user user.bak

and re-login, I can change the Keyboard shortcuts under Settings->Devices->Keyboard and I can switch between layouts via Super+Space. Everything still works after reboot. Obviously all my settings are gone with this approach and I would need to reinstall all my gnome extensions etc. Is there a way to fix the dconf database (which parameters to change)?

Best Answer

I could fully resolve the issue by changing dconf as follows: Install dconf editor:

sudo apt install dconf-editor

Open the editor in command line by

dconf-editor

Then go to

/org/gnome/desktop/input-sources/xkb-options

Here I turned off option "Use default value"

This resolved all issues described above. Thanks to @Gunnar Hjalmarsson for pointing me to dconf. This link was helpful for dconf with a picture.

Related Question