Bug 1226347 - display-manager.service unconditionally overwrites /etc/vconsole.conf on start
Summary: display-manager.service unconditionally overwrites /etc/vconsole.conf on start
Status: RESOLVED FIXED
: 1226819 (view as bug list)
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: X.Org (show other bugs)
Version: Leap 15.6
Hardware: Other Other
: P3 - Medium : Major (vote)
Target Milestone: ---
Assignee: Gfx Bugs
QA Contact: Gfx Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-14 13:49 UTC by Iakov Karpov
Modified: 2024-06-23 11:31 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iakov Karpov 2024-06-14 13:49:43 UTC
When display-manager.service starts, it unconditionally overwrites console configuration in /etc/vconsole.conf.
display-manager.service is a part of 'xdm' package. It contains a script /etc/X11/xdm/keytable, which is run at service start.
The script unconditionally changes system locale according to KEYMAP setting in /etc/vconsole.conf.
This is not an acceptable behavior!
For various reasons, user might want to have different values for KEYMAP and XKBLAYOUT. And sometimes, the preferred KEYMAP would not have an XKB counterpart leaving user without XKB settings at all. 

In my opinion, the keytable script should not unconditionally touch system configuration.

What happens now:

1. The keytable script looks for /etc/vconsole. If it exists, it reads $KEYMAP and $KEYMAP_TOGGLE variables
2. Then it looks for /etc/X11/xorg.conf.d/00-keyboard.conf file. If this file does not exist, it calls 'localectl  set-x11keymap us', which results in overwriting both $KEYMAP and $XKBLAYOUT variables in /etc/vconsole.conf, as localectl does automatic conversion of layout settings.
3. Then, it checks if previously stored $KEYMAP has a matching XKB layout in /us/share/systemd/kbd-model-map, but takes no action other than informing user with messages.
4. It calls 'localectl set-keymap $KEYMAP $KEYMAP_TOGGLE', overwriting /etc/vconsole.conf once more.
5. Last thing, script checks if /etc/X11/xorg.conf.d/00-keyboard.conf has appeared, and if it does not, it gives a warning.

To me, all above makes no sense. I have no idea why we need this script at all.
I believe, something like this should happen:

1. Script checks if /etc/X11/xorg.conf.d/00-keyboard.conf exists. If it is there, take no action and exit peacefully. It's not our business if the user has incorrect/inconsistent keyboard configuration.
2. If 00-keyboard.conf does not exist, script should check /etc/vconsole.conf for $XKBLAYOUT. If $XKBLAYOUT exists, it should be poke localectl with 'localectl --no-convert $XKBLAYOUT $XKBMODEL $XKBVARIANT $XKBOPTIONS' to generate new 00-keyboard.conf. Ideally, localectl should have an option to just touch XOrg config, without making changes to vconsole.conf.
3. If $XKBLAYOUT does not exists, or is empty, etc, it *might* be intentional, give a warning and let XOrg to start without 00-keyboard.conf file at all. I believe it should default to 'US' layout anyway.

On the other hand, the Tumbleweed XDM package contains no such script at all, and everything continues to work if I delete it on Leap 15.6 manually.
Comment 1 Stefan Dirsch 2024-06-17 12:25:36 UTC
keytable still exists on TW, but it's in 

/usr/etc/X11/xdm/keytable

But TW contains one more fix in keytable

-------------------------------------------------------------------
Thu Mar 23 12:12:36 UTC 2023 - Stefan Dirsch <sndirsch@suse.com>

- No longer run "localectl set-x11-keymap ..." and only run 
  "localectl set-keymap ..." if XKBLAYOUT is not set, i.e. if
  nobody was making use of "localectl set-x11-keymap" after
  installation (boo#1209594, comment#24)

Maybe that's the reason why you're happy with it on TW?
Comment 2 Stefan Dirsch 2024-06-17 12:44:48 UTC
Unfortunately we need this script to workaround limitations during installation when trying to create X11 configuration. See boo #1209594, coment #26
Comment 3 Stefan Dirsch 2024-06-17 12:46:30 UTC
(In reply to Stefan Dirsch from comment #2)
> Unfortunately we need this script to workaround limitations during
> installation when trying to create X11 configuration. See boo #1209594,
> comment #26

[...]
The main purpose of this script is to finish what YaST fails to do during installation.

* Wed Oct 18 2017 sndirsch@suse.com
- reintroduced /etc/X11/xdm/keytable script and the hook-up in
  /usr/lib/X11/display-manager to setup X11 keymaps, since YaST
  is not able to use localectl already during installation due to
  dbus and appropriate systemd services not running :-(
  (bsc#1046436)

I already killed it before, but I needed to revive it. :-(
[...]
Comment 4 Stefan Dirsch 2024-06-17 12:57:56 UTC
Closing as duplicate. 

Updating xdm for sle15-sp7/Leap 15.7 is on my TODO list now. Unfortunately I forgot to do this already for sle15-sp6/Leap 15.6. :-(

*** This bug has been marked as a duplicate of bug 1209594 ***
Comment 5 Iakov Karpov 2024-06-17 13:38:37 UTC
I am still not happy with automatic conversion of KEYMAP into XKBOPTIONS because it's not consistent and can lock you out of the system, making you unable to supply correct login/password, because you can't switch to latin symbols :(
Comment 6 Stefan Dirsch 2024-06-23 11:31:53 UTC
*** Bug 1226819 has been marked as a duplicate of this bug. ***