Bug 711061

Summary: Setting X11 keyboard layout from command line doesn't work
Product: [openSUSE] openSUSE 11.4 Reporter: Hauke Hhaaa <haukeh>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED INVALID QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None    
Version: Final   
Target Milestone: ---   
Hardware: i686   
OS: openSUSE 11.4   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: y2logs.tgz after Y2DEBUG=ALL yast2 keyboard set layout=german

Description Hauke Hhaaa 2011-08-08 16:54:09 UTC
User-Agent:       Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0

Hello,

I'm trying to set the keyboard layout, the language and LDAP via command line and yast2 unsuccessfully under openSUSE 11.4. The configuration should be done via a script so no GUI is possible to use. yast2 seems to have the needed functionality, but it doesn't work.

With

yast2 keyboard set layout=german
yast2 language set lang=de_DE

the layout and the language should be set to "German", but it remains US English. Manually to "de" edited layout in /etc/X11/xorg.conf.d/90-keytable.conf disappears and gets set back to "us" after reboot.

When I run

yast2 keyboard summary
yast2 language summary

it says that "German" is set. But keyboard is still english. If I use the yast2 text gui the language is set properly.

LDAP configuration is not working too (text gui doesn't work either).

yast2 ldap pam enable server="192.168.1.2" base="dn=nodomain" tls=no mkhomedir=yes
yast2 ldap pam enable

Debian/Ubuntu systems can authentificate with this LDAP server.

Are this bugs?

Do workarounds exists or do I make anything wrong?

Would be nice, if anybody could help.

Reproducible: Always

Steps to Reproduce:
1. yast2 keyboard set layout=german
2. yast2 language set lang=de_DE
3. yast2 keyboard summary
4. yast2 language summary
5. Try to write German letters

6. yast2 ldap pam enable server="192.168.1.2" base="dn=nodomain" tls=no mkhomedir=yes
7. yast2 ldap pam enable
8. Try to log in with your LDAP credentials
Actual Results:  
No German letters, no LDAP login

Expected Results:  
German letters, LDAP login possible
Comment 1 Thomas Fehr 2011-08-09 09:48:59 UTC
Reassigned to maintainer of yast2-country (which happens to also be maintainer of yast2-ldap)
Comment 2 Jiří Suchomel 2011-08-09 12:21:12 UTC
I assume setting language is working well: what does 'locale' say when for non-root user? Are German packages installed?

The problematic part is keyboard, I'll try to reproduce.

About LDAP: was /etc/ldap.conf modified? What does 'pam-config -q --ldap' say? And what about 'pam-config -q --sss'? Are any new packages installed (pam_ldap or sssd)?
What does it look like when you run yast2 ldap-client? (with UI)
Comment 3 Jiří Suchomel 2011-08-09 12:29:00 UTC
(In reply to comment #2)

> The problematic part is keyboard, I'll try to reproduce.


OK, X11 keyboard layout is not set when you run YaST in text mode. Try calling the command in xterm of your graphical environment.

I assume that the console keyboard layout got changed to German, right?

(BTW, it would help to open different bug for that LDAP part)
Comment 4 Hauke Hhaaa 2011-08-09 13:45:04 UTC
Hi,

thank you for your quick reply.

When I login via ssh "locale" prints the following:

LANG=de_DE@euro
LC_CTYPE="de_DE"
LC_NUMERIC="de_DE"
LC_TIME="de_DE"
LC_COLLATE="de_DE"
LC_MONETARY="de_DE"
LC_MESSAGES="de_DE"
LC_PAPER="de_DE"
LC_NAME="de_DE"
LC_ADDRESS="de_DE"
LC_TELEPHONE="de_DE"
LC_MEASUREMENT="de_DE"
LC_IDENTIFICATION="de_DE"
LC_ALL=de_DE

When I log in locally, the following is shown:

LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

I think this are the language packages:

bundle-lang-common-de.noarch
bundle-lang-gnome-de.noarch
bundle-lang-gnome-extras-de.noarch
bundle-lang-kde-de.noarch

When I set the language via the text mode yast2 gui, then the language is set correctly, but not when I set via "yast2 keyboard set layout=german" and "yast2 language set lang=de_DE".

PS. I've opened another bug report for the LDAP problem: https://bugzilla.novell.com/show_bug.cgi?id=711258
Comment 5 Hauke Hhaaa 2011-08-09 13:52:33 UTC
When executing "yast2 keyboard set layout=german" in konsole under KDE 4 as root, the layout is set correctly for root and the other user the X session belongs to.

/etc/X11/xorg.conf.d/90-keytable.conf still contains:

Option  "XkbLayout"     "us"

A workaround how to change the layout (without yast) by editing a file or so would be great, because I have to change the language/layout on a huge amount of clients with a script, so no clicking and no X session are possible to do so.

I'm thankful for any hint ;-)
Comment 6 Jiří Suchomel 2011-08-09 14:00:13 UTC
I think that language configuration works correctly.

No, for keyboard:

Normally, YaST is calling setxkbmap to set the layout, but if called in text 
mode, it ends with

"Cannot open display "default display"

Steffen, is there any way to set X11 keyboard laout from text mode?
Comment 7 Stefan Dirsch 2011-08-09 14:18:00 UTC
You need to write the KEYTABLE variable to do this. The mapping is specified in  /etc/X11/xdm/Keyboard.map. /etc/X11/xorg.conf.d/90-keytable.conf is generated by /etc/X11/xdm/keytable, which is started by /etc/init.d/xdm init script.
Comment 8 Jiří Suchomel 2011-08-09 14:30:54 UTC
(In reply to comment #7)
> You need to write the KEYTABLE variable to do this. The mapping is specified in
>  /etc/X11/xdm/Keyboard.map. /etc/X11/xorg.conf.d/90-keytable.conf is generated
> by /etc/X11/xdm/keytable, which is started by /etc/init.d/xdm init script.

So where should I write the KEYTABLE variable? 
I guess that not to  /etc/X11/xorg.conf.d/90-keytable.conf, which would be rewritten by  /etc/init.d/xdm.
Comment 9 Stefan Dirsch 2011-08-09 14:36:37 UTC
Sorry, this information somehow got lost. KEYTABLE is a variable in /etc/sysconfig/keyboard.
Comment 10 Jiří Suchomel 2011-08-09 14:59:45 UTC
Oh, but this is written by YaST. So, it should be enough to write it (as YaST does) and restart xdm.


Hauke, is the correct keyboard layout present after reboot? (or rcxdm restart)
Comment 11 Jiří Suchomel 2011-08-10 08:50:25 UTC
I just tested and for me the keyboard layout change really works after reboot.
Comment 12 Hauke Hhaaa 2011-08-10 12:32:02 UTC
Great!

Setting 'KEYTABLE="de"' in /etc/sysconfig/keyboard and "rcxdm restart" worked :-)

At least for the KDM4.

Do assume right that all settings in /etc/sysconfig/ are the basis for overwriting other values in /etc files?

Is there a way to trigger the regeneration of the files in /etc when I have changed a value in a /etc/sysconfig/ file?
Comment 13 Jiří Suchomel 2011-08-10 12:39:31 UTC
(In reply to comment #12)
> Great!
> 
> Setting 'KEYTABLE="de"' in /etc/sysconfig/keyboard and "rcxdm restart" worked
> :-)

You do not have to write it value manually. The point is, that your 'yast2 keyboard set layout=german' command should write it, so it is indeed capable of setting the keyboard layout right. You haven't seen it before because xdm restart (or reboot) is needed.


AFAIK xdm script always reads the sysconfig value on start, so that should answer your other question.
Comment 14 Jiří Suchomel 2011-08-10 14:13:13 UTC
So, I'm closing this as invalid, because using yast from command line actually works.
Comment 15 Hauke Hhaaa 2011-08-13 16:48:43 UTC
Hi,

unfortunately the issue is not resolved.

"yast2 keyboard set layout=german" doesn't set the needed value in /etc/sysconfig/keyboard.

I did it by hand, because yast2 didn't set it. After my manual editing (setting 'KEYTABLE="de"' in /etc/sysconfig/keyboard), "rcxdm restart" enabled the correct keyboard layout.

Maybe my post (that it worked, by manual edit) was misleading.
Comment 16 Hauke Hhaaa 2011-08-13 16:49:33 UTC
Forgot to reopen.
Comment 17 Jiří Suchomel 2011-08-15 06:55:58 UTC
I did not close it based on your description, but on my own testing. When I call

"yast2 keyboard set layout=german"

KEYTABLE value in /etc/sysconfig/keyboard is changed to "de-latin1-nodeadkeys.map.gz", I imediatelly have changes the keyboard layout on console and after reboot, also X11 keyboard layout is German.

So, are you sure your /etc/sysconfig/keyboard is not touched when you run yast2 keyboard?

Please run 'Y2DEBUG=ALL yast2 keyboard summary' and attach new YaST2 log files. Change the keyboard layout to something different before (e.g. US), so it can actually do some change.
Comment 18 Hauke Hhaaa 2011-08-16 13:41:44 UTC
Yes, I'm sure. KEYTABLE="de" I set by hand in /etc/sysconfig/keyboard.

1. grep "^KEYTABLE=" /etc/sysconfig/keyboard
KEYTABLE="de"
2. yast2 keyboard set layout=german
3. grep "^KEYTABLE=" /etc/sysconfig/keyboard
KEYTABLE="de"

To be sure, I set KEYTABLE="" by hand in /etc/sysconfig/keyboard.
1. grep "^KEYTABLE=" /etc/sysconfig/keyboard
KEYTABLE=""
2. yast2 keyboard set layout=german
3. grep "^KEYTABLE=" /etc/sysconfig/keyboard
KEYTABLE=""

So the value keeps untouched.

Y2DEBUG=ALL yast2 keyboard summary
Aktuelle Tastaturbelegung: german

That looks good, but I don't know where "german" comes from while KEYTABLE="".

On the other hand

yast2 sysconfig set KEYTABLE="de"

changes the KEYTABLE to "de" correctly.
Comment 19 Jiří Suchomel 2011-08-16 13:52:00 UTC
Sorry, I wanted to say: run

Y2DEBUG=ALL yast2 keyboard set layout=german

and attach fresh y2logs just after that.
Comment 20 Hauke Hhaaa 2011-08-17 14:13:26 UTC
Created attachment 446199 [details]
y2logs.tgz after Y2DEBUG=ALL yast2 keyboard set layout=german

Here the y2logs.tgz after "Y2DEBUG=ALL yast2 keyboard set layout=german".

PS. The tests I do in a VirtualBox machine. Would it help you, if I export the machine and upload it somewhere for you?
Comment 21 Jiří Suchomel 2011-08-17 14:48:33 UTC
(In reply to comment #20)

> PS. The tests I do in a VirtualBox machine. Would it help you, if I export the
> machine and upload it somewhere for you?

Yes, that may be interesting, I'm also testing it VirtualBox.
Comment 22 Jiří Suchomel 2011-08-18 06:41:04 UTC
Well, it looks like it ends because YaST things no change has to be done.

Please first change your layout to something different (yast2 keyboard set layout=english-us), than try to call your change command for german. Watch sysconfig file changes between these calls.

Do not just change manually your KEYTABLE variable, YaST looks for other values (YAST_KEYBOARD).
Comment 23 Hauke Hhaaa 2011-08-18 15:50:18 UTC
Great, now it works!

Many thanks for your help :-)

Running

1. yast2 keyboard set layout=english-us
2. yast2 keyboard set layout=german

sets the keyboard layout correctly in /etc/sysconfig/keyboard.

Is it possible that the error ocurred, because my first setting "yast2 keyboard set layout=german" was with the old version of yast2?
Comment 24 Jiří Suchomel 2011-08-19 07:25:41 UTC
(In reply to comment #23)

> Is it possible that the error ocurred, because my first setting "yast2 keyboard
> set layout=german" was with the old version of yast2?

Actually I think it worked from the first time, but at that time you did not know you need to restart xdm.

Later, when you wrote that sysconfig/keyboard was not modified by YaST, this was caused by your manual changes to that file, see comment 22.


Finally, this can be closed as invalid (= no bug).