Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial RDP connection always uses "us" keyboard, reconnect uses correct keyboard #1350

Open
mo-markcrossland opened this issue May 23, 2019 · 5 comments
Labels

Comments

@mo-markcrossland
Copy link

On the initial login to an xrdp session using xorgxrdp, we always get a US keybaord layout once logged in. We're based in the UK and run RHEL 7.6 at the moment, and getting a US keyboard effectively means that the session is broken as the pipe character can't be used and other characters are not where we expect them to be. If we disconnect from the session and then re-connect, we then get (almost) the proper keyboard layout.

Our users are using Windows 10 to connect to a RHEL7.6 server running xrdp.

This is waht we get on initial login:

$  setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file ./rules/base...
Trying to load rules file /usr/share/X11/xkb/rules/base...
Success.
Applied rules from base:
rules:      base
model:      pc104
layout:     us
options:    terminate:ctrl_alt_bksp
Trying to build keymap using the following components:
keycodes:   xfree86+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+terminate(ctrl_alt_bksp)
geometry:   pc(pc104)
xkb_keymap {
	xkb_keycodes  { include "xfree86+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+terminate(ctrl_alt_bksp)"	};
	xkb_geometry  { include "pc(pc104)"	};
};

When we disconnect from the session and re-connect to it, we get (almost) the correct keyboard layout, as follows:

$ setxkbmap -print -verbose 10
Setting verbose level to 10
locale is C
Trying to load rules file /usr/share/X11/xkb/rules/base...
Success.
Applied rules from /usr/share/X11/xkb/rules/base:
rules:      /usr/share/X11/xkb/rules/base
model:      pc104
layout:     gb
Trying to build keymap using the following components:
keycodes:   xfree86+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+gb
geometry:   pc(pc104)
xkb_keymap {
	xkb_keycodes  { include "xfree86+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+gb"	};
	xkb_geometry  { include "pc(pc104)"	};
};

The locale of the server is set to "en_GB.utf8"

$ localectl
   System Locale: LANG=en_GB.utf8
       VC Keymap: uk
      X11 Layout: gb
       X11 Model: pc105
     X11 Options: terminate:ctrl_alt_bksp

We've made the following change to xrdp_keyboard.ini to force UK keyboard on the login screen (otherwise some peple can't login):

; <rdp layout name> = <X11 keyboard layout value>
[default_layouts_map]
rdp_layout_us=gb
rdp_layout_us_dvorak=dvorak

If we SSH into the server, we get the correct keyboard layout detected at all times:

$ setxkbmap -print -verbose 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:      pc105
layout:     gb,gb
variant:    ,
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+gb+gb:2+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+gb+gb:2+inet(evdev)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
@mo-markcrossland
Copy link
Author

Wow. Almost two years since I raised this issue.

@mbrozzo
Copy link

mbrozzo commented Apr 18, 2024

I have a workaround for Ubuntu 22.04 (see #337 (comment)) that might fork for anyone using Gnome Desktop.

@matt335672
Copy link
Member

@mo-markcrossland - I apologise for the lack of progress on this. Is this still a configuration you are using?

@mo-markcrossland
Copy link
Author

@mo-markcrossland - I apologise for the lack of progress on this. Is this still a configuration you are using?

I wasn't expecting any response so we just took the option of forcing the keyboard to en_GB using some profile scripts:

# Try to set a GB keyboard if using xrdp - this it to try to prevent having
# to use a "connect -> disconnect -> reconnect" cycle to get the keyboard
# to be correct.
#

if /bin/who am i | /bin/awk '{print $5}' | /bin/grep --quiet --extended-regexp '^\(:[0-9]+(\.[0-9]+)?\)?'; then
    /bin/setxkbmap -layout gb,gb -types complete -compat complete -symbols pc+gb+gb:2+inet -geometry pc -keycodes xfree86+aliases
fi

We then forgot about having to worry about it.

@matt335672
Copy link
Member

If that works for you, great.

You can also now force a keyboard layout in /etc/xrdp/xrdp.ini for 0.9.17 and later - see #1952. This is primarily a debugging tool, but if you're a single layout shop (and I imagine you are) this could do the job just as well.

Let me know if you want some help to get to the bottom of this (and I'd quite understand if you don't). We've spent a bit of time on the input system recently so I'm quite keen on squishing any remaining bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants