Bug 1033876

Summary: x2go session does not set correct keyboard type
Product: [Fedora] Fedora Reporter: Roderick Johnstone <rmj>
Component: x2goserverAssignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 20CC: igeorgex, orion, rmj
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nx-libs-3.5.0.22-1.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-28 21:06:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roderick Johnstone 2013-11-23 23:20:58 UTC
Description of problem:
x2go KDE session does not have correct keyboard type

Version-Release number of selected component (if applicable):
This is seen on Fedora 20 beta
x2goserver-4.0.1.6-5.fc20.x86_64

x2goclient 4.0.0.3 on Windows XP

How reproducible:
Every time.

Steps to Reproduce:
1. From a Windows XP laptop with UK keyboard, configure an x2go session with
Session preferences / settings /
keyboard layout: gb
keyboard model: pc105/gb
2. Start x2go session to Fedora 20 beta
3. Type on the keyboard

Actual results:
Keyboard is incorrectly mapped.
eg Shift 3 gives # instead of £.
| key gives >
~ key gives |
# key gives \
" key gives @
@ key gives "
etc

Seen in konsole, firefox, gedit etc.

Expected results:
Keys give the symbols printed on them

Additional info:
Correct keyboard mapping can be recovered by giving the command:
setxkbmap gb

The file: /tmp/.x2go-testuser/session-C-testuser-51-1385245333_stDKDE_dp32.log

contains the message:
nxagentXkbGetRules: WARNING! Failed to stat file [/usr/lib64/nx/X11/xkb/rules/xorg]: Unknown error -1.
keyboard file created

Comment 1 Orion Poplawski 2013-11-24 21:31:15 UTC
Can you try https://admin.fedoraproject.org/updates/x2goserver-4.0.1.8-1.fc20

The changelog mentions some keyboard fixes, but not sure if it covers this.

Comment 2 Roderick Johnstone 2013-11-24 22:28:56 UTC
I'm afraid that new version doesn't help.

For info, in the session directory there is a file 'keyboard' which contains:
rules=xorg
model=pc105
layout=gb
variant=
options=grab:break_actions

which seems to be correct, but this keyboard type is not being set.

The session.log file still has:
nxagentXkbGetRules: WARNING! Failed to stat file [/usr/lib64/nx/X11/xkb/rules/xorg]: Unknown error 
-1.

I wonder if this is relevant?

Roderick

Comment 3 Orion Poplawski 2013-11-25 04:54:47 UTC
Do you have xkeyboard-config installed on the server?  If not, please test with it installed.

Comment 4 Roderick Johnstone 2013-11-25 08:52:19 UTC
Yes, that was already installed on the server.

Comment 5 Orion Poplawski 2013-11-26 03:38:43 UTC
I'm not really familiar with how this is supposed to work.  My guess is that it is trying the run the following command:

setxkbmap -rules xorg -model pc105 -layout gb -option grab:break_actions

What is the output of that command if you run it directly?

If that does not result in an error, can you edit /etc/x2go/x2goserver.conf and set loglevel=info.  The when you start a session you should get some messages regarding the keyboard in /var/log/messages.

Also, what happens if you do not set the keyboard preferences in the client?

Does it help if you link:

ln -s /usr/share/X11/xkb /usr/lib64/nx/X11/

Comment 6 Roderick Johnstone 2013-11-26 13:16:17 UTC
Orion

> setxkbmap -rules xorg -model pc105 -layout gb -option grab:break_actions
> What is the output of that command if you run it directly?

The command successfully changes the keyboard map and gives no output.

> If that does not result in an error, can you edit /etc/x2go/x2goserver.conf and set loglevel=info.  The when > you start a session you should get some messages regarding the keyboard in /var/log/messages.

I can send a complete log, but the relevant lines seem to be (I have changed the real host and user names):

Nov 26 12:11:57 dummyhost /usr/bin/x2gostartagent: blocking creation of agent's keyboard file /home/dummyuser/.x2go/C-dummyuser-59-1385467913_stDKDE_dp32/keyboard as requested by session startup command
Nov 26 12:11:59 dummyhost /usr/bin/x2gosetkeyboard: x2gosetkeyboard called with options:
Nov 26 12:11:59 dummyhost /usr/bin/x2gosetkeyboard: /home/dummyuser/.x2go/C-dummyuser-59-1385467913_stDKDE_dp32/keyboard is blocked, not setting keyboard parameters from client-side settings

I wonder what the bit about session startup blocking agent's keyboard file is about? That file does not seem to be created, but in Comment 2 I did have a keyboard file.

> Also, what happens if you do not set the keyboard preferences in the client?
I've tried that, and setting the layout and model to auto. Always the same thing. US keyboard map is loaded.

>Does it help if you link:
>
>ln -s /usr/share/X11/xkb /usr/lib64/nx/X11/

No, just the same US keyboard layout.

IAll this has been starting a KDE session, so I tried gnome but get a sad face in my client and the words "Oh no! Something has gone wrong".

Then I tried a custom session with Terminal application and it works and the keyboard mappings are correct!

The x2gostartagent commands from /var/log/messages are:
x2gostartagent called with options: 800x600 adsl 16m-jpeg-9 unix-kde-depth_32 us pc105/gb 1 D KDE
x2gostartagent called with options: 800x600 adsl 16m-jpeg-9 unix-kde-depth_32 us pc105/gb 1 D GNOME
2gostartagent called with options: 800x600 adsl 16m-jpeg-9 unix-kde-depth_32 us pc105/gb 1 R TERMINAL

According to man x2gostartagent the fifth argument is the keyboard layout so this doesn't seem to be being passed down properly.

For some reason that doesn't seem to matter for the simple terminal case.

Thanks for your attention to this.

Roderick

Comment 7 Orion Poplawski 2013-11-28 00:15:16 UTC
Please try editing /usr/bin/x2gostartagent and here:

if [ "$X2GO_SET_KBD" == "0" ] || [ "$X2GO_KBD_TYPE" != "auto" ]; then
        $X2GO_LIB_PATH/x2gosyslog "$0" "info" "blocking creation of agent's keyboard file ${SESSION_DIR}/keyboard as requested by session startup command"
        mkdir -p ${SESSION_DIR}/keyboard
fi

change the != "auto" to == "auto".

Comment 8 Fedora Update System 2013-11-28 01:05:34 UTC
x2goserver-4.0.1.8-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/x2goserver-4.0.1.8-2.fc20

Comment 9 Fedora Update System 2013-11-28 01:05:48 UTC
x2goserver-4.0.1.8-2.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/x2goserver-4.0.1.8-2.el6

Comment 10 Fedora Update System 2013-11-28 01:06:01 UTC
x2goserver-4.0.1.8-2.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/x2goserver-4.0.1.8-2.fc19

Comment 11 Roderick Johnstone 2013-11-28 17:45:11 UTC
Orion

It still doesn't work. The x2gosetkeyboard messages are:
/usr/bin/x2gosetkeyboard: x2gosetkeyboard called with options:

ie the options are blank, but then a couple of lines later:

/usr/bin/x2gosetkeyboard: Setting X keyboard according to /home/testuser/.x2go/C-testuser-70-1385660130_stDKDE_dp32/keyboard

and this contains:
rules=xorg
model=pc105
layout=gb
variant=
options=grab:break_actions

which all looks correct.

Later there is:
 /usr/bin/x2goruncommand: launching session with Xsession-x2go mechanism, using STARTUP="startkde"

so I wonder if kde is somehow overriding what was set by x2gosetkeyboard, especially since the simple terminal session I described in comment #6 does have the correct keyboard mappings.

Roderick

Comment 12 Roderick Johnstone 2013-11-28 23:02:13 UTC
Orion

I put some debug messages into x2gosetkeyboard and it looks like this is now setting the correct keyboard type. This makes me suspicious that the startkde which is setting up the KDE session is overriding these keyboard mappings. However, I also tried an xfce session and that had the wrong keyboard mappings as well, so I'm confused. Only the plain terminal session seems to get the mappings right.

Roderick

Comment 13 Orion Poplawski 2013-11-29 15:17:47 UTC
What is the output of "setxkbmap -print"?  What does System Settings -> Input -> Keyboard -> Layout report in KDE?

Comment 14 Fedora Update System 2013-11-29 16:00:15 UTC
Package x2goserver-4.0.1.8-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing x2goserver-4.0.1.8-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-22368/x2goserver-4.0.1.8-2.fc20
then log in and leave karma (feedback).

Comment 15 Roderick Johnstone 2013-11-29 22:31:05 UTC
In a simple terminal session, setxkbmap -print gives:
#xkb_keymap {
        xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete+xfree86(grab_break)"  };
        xkb_symbols   { include "pc+gb+inet(pc105)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

In a KDE session, setxkbmap -print gives:
xkb_keymap {
        xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete+xfree86(grab_break)"  };
        xkb_symbols   { include "pc+us+inet(evdev)"     };
        xkb_geometry  { include "pc(pc104)"     };
};

System Settings -> Input -> Keyboard -> Layout report in KDE shows:
In the Layout Indicator:
Show layout indicator is checked is checked
Show label radio button is selected

In the Switching policy:
Global radio button is checked

Shortcuts for Switching Layout
Alternative shortcut is set to ctrl+alt+K
Other shortcuts are set to none.

Configure Layouts is unchecked and there are no layouts defined.

This is essentially the same as I see in my KDE session running on an NX3 server. The only difference is that on the NX server session all the shortcuts for switching layout are set to None.

Comment 16 Roderick Johnstone 2013-12-01 15:03:44 UTC
Orion

This may not be x2go's problem after all, but rather, a KDE configuration issue.

Having said that, I found a kludge that I had to put in last year for NX, which I had forgotten about. This involved calling a script using the setting UserScriptAfterSessionStart in nxnode.cfg to parse the session keyboard file and then call the correct setxkbmap command.

I'll ask on the x2go list what is the equilvalent in x2go.

I also found that by setting the correct keyboard hardware and layout in the KDE setting I could get the correct keyboard mapping ok. Curiously, this is not needed when logging in at the console.

However, although the KDE keyboard switcher can handle several different layouts its not obvious that it can handle switching between hardware models. Our use case is PC 104/5 keyboard at the PC console and then a Mac keyboard over x2go.

I'll ask on one of the kde lists about this.

Roderick

Comment 17 Orion Poplawski 2013-12-02 23:00:19 UTC
I'm starting to think this may be an issue with using an Windows client.  I've asked on the x2go-dev list.

Comment 18 Roderick Johnstone 2013-12-03 08:56:58 UTC
Orion

I may have solved this.

I had cause to disable the kscreen kded module as recommended here (https://bugs.kde.org/show_bug.cgi?id=319065) because it was causing problems by resetting the desktop session dimensions.

Since then, the keyboard mappings have been fine when connecting from my UK keyboard laptop. So, for the moment I think this could have been a kscreen issue.

However, I have made lots of changes in my testing account and in the x2go config while trying to sort this out and bits of the system see to have a memory, so I'm reserving final judgement for now. But, it is looking promising.

I'll try to give a status update in a few days time when I've had a chance to re-install my testing system from scratch.

Thanks for all your help with this.

Roderick

Comment 19 Roderick Johnstone 2014-01-01 20:22:14 UTC
Just to report that I have a workable x2go connection in the Fedora 20 release now with the keyboard set correctly.

I'm using: x2goserver-4.0.1.6-5.fc20.x86_64 and the windows client version 4.0.1.2.

I'm running with the kscreen2 daemon switched off so that the desktop doesn't get resized by it.

To get the keyboard mapping working reliably I found that I had to set the keyboard model and layout explicitly in the client and then:

1) touch /usr/share/X11/xkb/keymap.dir

2) remove all the ibus packages

Without step 2) the keyboard mapping is correctly set the first time you connect from a client, but subsequent connects from other clients with different keyboards get the keyboard mapping set from the first client connection.

Its possible that there is a way to configure ibus to work nicely with the x2go client but I haven't figured it out yet.

Comment 20 Fedora Update System 2014-01-03 14:28:30 UTC
nx-libs-3.5.0.21-5.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/nx-libs-3.5.0.21-5.fc20

Comment 21 Fedora Update System 2014-01-03 23:25:15 UTC
Package nx-libs-3.5.0.21-5.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nx-libs-3.5.0.21-5.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-0142/nx-libs-3.5.0.21-5.fc20
then log in and leave karma (feedback).

Comment 22 JM 2014-01-03 23:35:47 UTC
Any chance to get nx-libs-3.5.0.21-5 for Fedora 19 as well?

Comment 23 Orion Poplawski 2014-01-04 00:44:01 UTC
It's there:

https://admin.fedoraproject.org/updates/nx-libs-3.5.0.21-5.fc19

since this bug report is for F20, I only linked that update.

Comment 24 Fedora Update System 2014-01-07 03:06:00 UTC
nx-libs-3.5.0.22-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/nx-libs-3.5.0.22-1.fc19

Comment 25 Fedora Update System 2014-01-07 03:06:13 UTC
nx-libs-3.5.0.22-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/nx-libs-3.5.0.22-1.fc20

Comment 26 Fedora Update System 2014-01-07 03:06:20 UTC
nx-libs-3.5.0.22-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/nx-libs-3.5.0.22-1.el6

Comment 27 Fedora Update System 2014-01-28 21:06:24 UTC
nx-libs-3.5.0.22-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 28 Fedora Update System 2014-01-30 03:31:27 UTC
nx-libs-3.5.0.22-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 29 Fedora Update System 2014-01-30 03:36:26 UTC
nx-libs-3.5.0.22-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.