Skip to content

Keyboard layout / AltGr state unstable after login; xmodmap autostart may disrupt Cinnamon session startup #13759

@teriodore

Description

@teriodore

Distribution

Linux Mint 21.3 Cinnamon

Package version

6.0.4

Graphics hardware in use

NVIDIA GeForce GTX 760, NVIDIA 470.256.02 driver (Yes, yes I know)

Frequency

Only occasionally

Bug description

Keyboard layout / AltGr state unstable after login; xmodmap autostart may disrupt Cinnamon session startup

Summary

After configuring a Logitech ERGO K860 keyboard on Linux Mint Cinnamon, I found that Right Alt / AltGr can revert from ISO_Level3_Shift to Multi_key / Compose after logout/login. This breaks third/fourth-level key symbols even though the custom key mappings remain present.

I also tried loading the fix through a Cinnamon autostart .desktop entry. After the next login, the Cinnamon session behaved badly: several unrelated applications failed to start or respond correctly, including Firefox/Proton Pass, qBittorrent, and Birdtray. Removing the autostart entry and rebooting restored normal startup.

I am not claiming the xmodmap autostart directly caused all failures, but the timing suggests a possible session-startup race or keyboard-layout initialization issue.

System

Cinnamon 6.0.4

Host: Benizakura
Kernel: 5.15.0-177-generic x86_64
Desktop: Cinnamon 6.0.4
Window manager: muffin
Display manager: GDM3 42.0, LightDM 1.30.0
Distro: Linux Mint 21.3 Virginia
Base: Ubuntu 22.04 jammy
Session: X11

Keyboard: Logitech ERGO K860
Keyboard physical layout: ISO


The keyboard has two physical keys that I wanted to map as:

`  ~  §  ±
\  |  <  >


The working live keyboard configuration is:

setxkbmap -layout us -variant intl -option '' \
  -option grp:win_space_toggle \
  -option terminate:ctrl_alt_bksp \
  -option lv3:ralt_switch

And the working ~/.Xmodmap is:

keycode 49 = grave asciitilde grave asciitilde section plusminus section plusminus
keycode 94 = backslash bar backslash bar less greater less greater
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
add mod5 = ISO_Level3_Shift


Applied with:

xmodmap ~/.Xmodmap

Expected working output:

plain `              -> `
Shift + `            -> ~
AltGr + `            -> §
AltGr + Shift + `    -> ±

plain \              -> \
Shift + \            -> |
AltGr + \            -> <
AltGr + Shift + \    -> >
What goes wrong


After logout/login, the two symbol-key mappings can remain present, but keycode 108 reverts to Multi_key, so Right Alt becomes Compose instead of AltGr.

Broken state observed:

xmodmap -pke | egrep 'keycode +(49|94|108) ='

Output:

keycode  49 = grave asciitilde grave asciitilde section plusminus section plusminus
keycode  94 = backslash bar backslash bar less greater less greater backslash bar less greater backslash bar less greater
keycode 108 = Multi_key Multi_key Multi_key Multi_key Multi_key Multi_key Multi_key Multi_key

Working state requires:

keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift

Right Alt / AltGr was correctly detected during the working session as:

keycode 108 (keysym 0xfe03, ISO_Level3_Shift)

But after relogin it reverted to:

keycode 108 = Multi_key Multi_key Multi_key Multi_key Multi_key Multi_key Multi_key Multi_key

The custom mappings for keycode 49 and 94 remained present, but AltGr no longer worked because keycode 108 had become Compose / Multi_key.



Login/session escalation:

I attempted to make the fix load automatically with this Cinnamon autostart entry:

mkdir -p ~/.config/autostart

cat > ~/.config/autostart/xmodmap-keyfix.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=K860 key symbol fix
Comment=Load custom Xmodmap mappings for Logitech ERGO K860
Exec=sh -c 'sleep 2; xmodmap "$HOME/.Xmodmap"'
X-GNOME-Autostart-enabled=true
NoDisplay=false
EOF

After logging back in, the session behaved badly:

Firefox / Proton Pass did not load correctly
qBittorrent had startup trouble
Birdtray crashed
Cinnamon reported session-client timeouts
removing the autostart file and rebooting restored normal behavior

I am not certain whether the .desktop file itself directly caused the application startup failures, or whether it exposed/raced with a broader Cinnamon session startup issue. I am including the escalation because the timing was clear:

manual xmodmap ~/.Xmodmap worked during the live session
adding the Cinnamon autostart entry was followed by a broken login session
removing the autostart entry and rebooting restored normal application startup
Relevant log excerpts

From the affected boot/session:

cinnamon-session: Client '/org/gnome/SessionManager/Client30' failed to reply before timeout
cinnamon-session: Client '/org/gnome/SessionManager/Client31' failed to reply before timeout

Birdtray coredump:

systemd-coredump: Process birdtray dumped core
Found module libxkbcommon.so.0
Found module libxkbcommon-x11.so.0
Found module libxcb-xkb.so.1
Found module birdtray

Keyboard layout reset at greeter/login boundary:

slick-greeter-set-keyboard-layout: Current keyboard configuration: rules: evdev
slick-greeter-set-keyboard-layout: Applying keyboard configuration:
['setxkbmap', '-model', 'pc105', '-layout', 'us', '-variant', '', '-option', '', '-v']

Result:
Warning! Multiple definitions of keyboard model
Warning! Multiple definitions of keyboard layout



### Steps to reproduce

Configure keyboard layout:
setxkbmap -layout us -variant intl -option '' \
  -option grp:win_space_toggle \
  -option terminate:ctrl_alt_bksp \
  -option lv3:ralt_switch
Apply custom mapping:
cat > ~/.Xmodmap <<'EOF'
keycode 49 = grave asciitilde grave asciitilde section plusminus section plusminus
keycode 94 = backslash bar backslash bar less greater less greater
keycode 108 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
add mod5 = ISO_Level3_Shift
EOF

xmodmap ~/.Xmodmap
Confirm working output:
`  ~  §  ±
\  |  <  >
Add Cinnamon autostart entry:
mkdir -p ~/.config/autostart

cat > ~/.config/autostart/xmodmap-keyfix.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=K860 key symbol fix
Comment=Load custom Xmodmap mappings for Logitech ERGO K860
Exec=sh -c 'sleep 2; xmodmap "$HOME/.Xmodmap"'
X-GNOME-Autostart-enabled=true
NoDisplay=false
EOF
Logout and log back in.
Observed result: several unrelated startup applications failed to load correctly, including Proton Pass, qBittorrent, Birdtray, and Firefox. After rebooting and removing the autostart file, the system recovered.

### Expected behavior

Expected behavior
Right Alt / AltGr should remain ISO_Level3_Shift after login if configured as the third-level chooser.
Custom key mappings should not revert keycode 108 to Multi_key.
Loading a simple xmodmap ~/.Xmodmap command from Cinnamon autostart should not disrupt unrelated startup applications.

### Additional information

Current workaround:

Remove the Cinnamon autostart file:

rm -f ~/.config/autostart/xmodmap-keyfix.desktop

Then manually reload the mapping after login or after keyboard layout changes:

xmodmap ~/.Xmodmap

This restores:

`  ~  §  ±
\  |  <  >



Questions:
Is Cinnamon or slick-greeter expected to reset user keyboard options at login in a way that can turn Right Alt back into Multi_key?

Is there a supported Cinnamon-native way to persist ISO_Level3_Shift / AltGr and per-key mappings without racing the session startup?

Could running xmodmap ~/.Xmodmap from Cinnamon autostart interfere with early session clients, or is the application startup failure likely unrelated?

Which additional logs would be useful to capture if I can reproduce this again?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions