Wrong keyboard layout in VirtualBox VM accessed via TurboVNC

57 views
Skip to first unread message

torsten

unread,
May 4, 2018, 6:28:00 AM5/4/18
to TurboVNC User Discussion/Support
Hi,

on the host I'm connected via TurboVNC I have a VirtualBox VM. Inside this VM I obviously get the default english keyboard layout instead of the german one I'm really using. When I sit at the console and work with the VM without using the TurboVNC session, all keys are correct. All other software on the host accessed via TurboVNC gets the correct keys too  The wrong layout comes back, when I use the local TurboVNC Client connecting the same session and start the VM within it. Is there a way to get the correct keyboard layout in the VM accessed via TurboVNC?

Kind Regards
Torsten

DRC

unread,
May 4, 2018, 10:22:27 AM5/4/18
to turbovn...@googlegroups.com
I'm not sure I'm clear on exactly what is happening. When you say
"wrong layout", what is the visible symptom of the problem? Do you mean
that the keys are not translated correctly between client and server?
Or is the layout within the guest operating system actually changing?

Also, when you run VirtualBox within TurboVNC, are you running it
exclusively, or are you using a window manager as well? (what are the
contents of your ~/.vnc/xstartup.turbovnc file?)

torsten

unread,
May 4, 2018, 1:25:41 PM5/4/18
to TurboVNC User Discussion/Support
Hi DRC,


Am Freitag, 4. Mai 2018 16:22:27 UTC+2 schrieb DRC:
I'm not sure I'm clear on exactly what is happening.  When you say
"wrong layout", what is the visible symptom of the problem?  Do you mean
that the keys are not translated correctly between client and server?
Or is the layout within the guest operating system actually changing?

No, all OSs involved here (the guest OS, the host OS and the Client OS) think, they use the german layout. There is no change in keyboard layout configuration. Fact is, I get the characters in this table (hope you can read this table format):

| Key pressed on keyboard | character appearing in VM |
| zZ                      | yY                        |
| &                       | /                         |
| (                       | )                         |
| *                       | (                         |
| \                       | #                         |
| >                       | :                         |
| +                       | `                         |
| #                       | §                         |
| -                       | ß                         |
| "                       | Ä                         |
| /                       | -                         |
| )                       | =                         |
| =                       | '                         |
| ?                       | _                         |
| '                       | ä                         |
| _                       | ?                         |
| :                       | Ö                         |
| ;                       | ö                         |
| {                       | Ü                         |
| [                       | ü                         |
| ]                       | +                         |
| }                       | *                         |
| \                       | #                         |
| ~                       | °                         |
| @                       | "                         |
| yY                      | zZ                        |

Keep in mind to search these keys on a german keyboard! For some of them Shift or AltGr has to be hit additionally. Some keys (like Ä e.g.) normally providing a character do nothing in the VM.
 
Also, when you run VirtualBox within TurboVNC, are you running it
exclusively, or are you using a window manager as well?

The VM runs in a window managed by the window manager of the host.
 
 (what are the
contents of your ~/.vnc/xstartup.turbovnc file?)

I found this file, but I never did any changes to it. It is in its original state like created by TurboVNC. And it is older than the installation of VirtualBox and the VM. It is attached here.

Kind Regards
Torsten
 
xstartup.turbovnc

torsten

unread,
May 5, 2018, 1:15:58 PM5/5/18
to TurboVNC User Discussion/Support
Hi all,

I just found a solution for the keyboard layout issue: VirtualBox has its own RDP Server, so a VM can be accessed via RDP. Now I can see the VM twice, once in the TurboVNC Client showing the VM through the VirtualBox Viewer, and once in the RDP window. In the latter one all keys provide the correct character in the VM. But there is a new problem: The RDP window needs about 8-9 seconds to show the result, while in the TurboVNC Client it is visible without any delay. So now I could use the RDP window only for keyboard typing and the TurboVNC Client only for seeing the response. But that's not practical, since any mouse action must happen in the RDP window too for not loosing the keyboard focus. So now I must try to accelerate the RDP connection considerably. But I think, this I must ask otherwhere. Or has anyone an idea?

Kind Regards
Torsten

DRC

unread,
May 5, 2018, 1:24:12 PM5/5/18
to turbovn...@googlegroups.com
RDP is always going to be fundamentally slower than TurboVNC. That's
one of the reasons why TurboVNC exists. The ultimate solution is going
to be to fix the keyboard mapping problem, but I need to sit down and
try to reproduce it first. Hopefully I will have time to do so this week.

torsten

unread,
May 5, 2018, 2:45:13 PM5/5/18
to TurboVNC User Discussion/Support
OK, that sounds to be a good deal. Many thanks in advance, DRC!

torsten

unread,
May 13, 2018, 11:36:21 AM5/13/18
to TurboVNC User Discussion/Support
Hi DRC again,

since my issue with starting the TurboVNC server at boot time is solved now, this issue remains. Could you reproduce it in meantime?

Kind Regards
Torsten

DRC

unread,
May 13, 2018, 12:08:37 PM5/13/18
to turbovn...@googlegroups.com
I will look into it, but I have several other things I need to do first.
Be patient.
> --
> You received this message because you are subscribed to the Google
> Groups "TurboVNC User Discussion/Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to turbovnc-user...@googlegroups.com
> <mailto:turbovnc-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/turbovnc-users/b63b1fec-a568-4a6c-b981-3cf9da63a755%40googlegroups.com
> <https://groups.google.com/d/msgid/turbovnc-users/b63b1fec-a568-4a6c-b981-3cf9da63a755%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

DRC

unread,
May 21, 2018, 4:35:23 PM5/21/18
to turbovn...@googlegroups.com

It seems the basic problem is that, by running VirtualBox in a window manager window, an additional level of key mapping is introduced.

To explain how TurboVNC normally works in this regard:

The actual key symbol transmitted to the TurboVNC Server depends on the client's keyboard layout, so if your client has a German layout, pressing the key corresponding to '/' on an English keyboard will send '-', pressing the key corresponding to 'Z' on an English keyboard will send 'Y', and pressing the key corresponding to '[' on an English keyboard will send umlaut U ('ü').  Since the baseline, unextended RFB protocol transmits key symbols instead of key codes, the server will interpret those key events as (respectively) '-', 'Y', and 'ü', regardless of the keyboard layout that is selected in the TurboVNC Server session.

Focusing on just those three keys, what I observe is the following when running VirtualBox in a window manager window:

- Client layout: English, TurboVNC Server layout: English, Windows guest layout: English

  'Z' key on English keyboard => 'Z' in TurboVNC Server and Windows guest
  '/' key
on English keyboard => '/' in TurboVNC Server and Windows guest
  '[' key on English keyboard => '[' in TurboVNC Server and
Windows guest

- Client layout: German, TurboVNC Server layout: English, Windows guest layout: English
  'Z' key
on English keyboard => 'Y' in TurboVNC Server and Windows guest
  '/' key
on English keyboard => '-' in TurboVNC Server and Windows guest
  '[' key on English keyboard => 'ü' in TurboVNC Server, nothing in
Windows guest

- Client layout: English, TurboVNC Server layout: English, Windows guest layout: German
  'Z' key on English keyboard => 'Z' in TurboVNC Server, 'Y' in Windows guest
  '/' key
on English keyboard => '/' in TurboVNC Server, '-' in Windows guest
  '[' key on English keyboard => '[' in TurboVNC Server, 'ü' in Windows guest

- Client layout: German, TurboVNC Server layout: English, Windows guest layout: German
  'Z' key on English keyboard => 'Y' in TurboVNC Server, 'Z' in Windows guest
  '/' key
on English keyboard => '-' in TurboVNC Server, 'ß' in Windows guest
  '[' key on English keyboard => 'ü' in TurboVNC Server, nothing in Windows guest

- Client layout: English, TurboVNC Server layout: German, Windows guest layout: English
  'Z' key on English keyboard => 'Z' in TurboVNC Server, 'Y' in Windows guest
  '/' key
on English keyboard => '/' in TurboVNC Server, '&' in Windows guest
  '[' key on English keyboard => '[' in TurboVNC Server, '8' in
Windows guest

- Client layout: German, TurboVNC Server layout: German, Windows guest layout: English
  'Z' key
on English keyboard => 'Y' in TurboVNC Server, 'Z' in Windows guest
  '/' key
on English keyboard => '-' in TurboVNC Server, '/' in Windows guest
  '[' key on English keyboard => 'ü' in TurboVNC Server, '[' in
Windows guest

- Client layout: English, TurboVNC Server layout: German, Windows guest layout: German
  'Z' key on English keyboard => 'Z' in TurboVNC Server, 'Y' in Windows guest
  '/' key
on English keyboard => '/' in TurboVNC Server, '&' in Windows guest
  '[' key on English keyboard => '[' in TurboVNC Server, '8' in Windows guest

- Client layout: German, TurboVNC Server layout: German, Windows guest layout: German
  'Z' key on English keyboard => 'Y' in TurboVNC Server and Windows guest
  '/' key
on English keyboard => '-' in TurboVNC Server and Windows guest
  '[' key on English keyboard => 'ü' in TurboVNC Server and Windows guest

Conclusions:
- When running VirtualBox in a window manager window, the keyboard layout in the guest O/S determines which key symbol is actually received by applications running in the guest.  That means that a German keyboard layout must be selected in the
Windows guest in order for the guest O/S to properly interpret certain German key symbols.
- The client keyboard layout must match the TurboVNC Server session's keyboard layout in order to avoid keyboard mapping errors.

You can also run VirtualBox without a window manager, by creating a script and passing it to vncserver using the -xstartup option.  For instance, here is a script I use:

# cat ~/3dscript
vglrun -nodl VirtualBox --startvm "Windows 7" --fullscreen

# /opt/TurboVNC/bin/vncserver -xstartup ~/3dscript

When started in this manner, the default behavior is the same as if an English keyboard layout had been selected in the (non-existent) window manager, because the TurboVNC Server defaults to a US XKEYBOARD layout (this can be changed in custom TurboVNC Server builds by altering the XKB_DFLT_* CMake variables.)  At run time, you can change the layout to German by adding 'setxkbmap -layout de' to the custom xstartup script prior to launching VirtualBox.

Note that there is a proposed feature (https://github.com/TurboVNC/turbovnc/issues/108) that will allow for optionally sending key codes from client to server instead of key symbols, which means that only the keyboard layout in the TurboVNC Server session would matter.  There are benefits to that approach in terms of overall keyboard compatibility, since TurboVNC would not have to translate O/S-specific or Java-specific key events on the client into X11 key symbols.  Sending key codes would most likely prevent this situation with VirtualBox.  At the very least, it should make it so that VirtualBox behaves the same within a TurboVNC Server session as it does on the local display.  Unfortunately, however, that feature is in need of funding, so it won't make it into TurboVNC 2.2.  Hopefully it will be in 2.3.  In the meantime, use the workaround described above.

DRC
--
You received this message because you are subscribed to the Google Groups "TurboVNC User Discussion/Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbovnc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/turbovnc-users/1d25c323-7eb6-4a41-8dc2-8c049ac0f183%40googlegroups.com.

torsten

unread,
May 22, 2018, 3:32:37 PM5/22/18
to TurboVNC User Discussion/Support
Hi DRC,

thanks for your response. Currently I'm slightly confused by these many different key mappings. And your script solution seems to be not really practical to me. I have decided to subsequently transfer all the workspaces I currently use inside the VM to its host. So, when this is done, I won't need the VM anymore and will delete it. This will be a much better solution for me than the script. Until this is done, I can live with the wrong key interpretation inside the VM. However, many thanks for your detailed analysis on this issue!

Kind Regards
Torsten

DRC

unread,
May 22, 2018, 4:22:00 PM5/22/18
to turbovn...@googlegroups.com
I don't know how to make it any more clear. This is a limitation of the
RFB protocol, and the only way to overcome that limitation is to
implement the aforementioned RFB extension that sends key codes instead
of key symbols. It is not necessary to use a script. I was just
pointing out that use case for completeness, because other people may
stumble upon my answer via Google.

In a nutshell, you can continue to use TurboVNC as you are currently
using it. You just need to ensure that:

- The German keyboard layout is selected in the guest operating system
that is running inside the VM

- The keyboard layout in the TurboVNC Server session and on the client match

That's it.


On 5/22/18 2:32 PM, torsten wrote:
> Hi DRC,
>
>   '/' keyon English keyboard => '/' in TurboVNC Server and Windows guest
>   '[' key on English keyboard => '[' in TurboVNC Server and Windows
> guest
>
> - Client layout: German, TurboVNC Server layout: English, Windows
> guest layout: English
>   'Z' keyon English keyboard => 'Y' in TurboVNC Server and Windows guest
>   '/' keyon English keyboard => '-' in TurboVNC Server and Windows guest
>   '[' key on English keyboard => 'ü' in TurboVNC Server, nothing in
> Windows guest
>
> - Client layout: English, TurboVNC Server layout: English, Windows
> guest layout: German
>   'Z' keyon English keyboard => 'Z' in TurboVNC Server, 'Y' in
> Windows guest
>   '/' keyon English keyboard => '/' in TurboVNC Server, '-' in
> Windows guest
>   '[' key on English keyboard => '[' in TurboVNC Server, 'ü' in
> Windows guest
>
> - Client layout: German, TurboVNC Server layout: English, Windows
> guest layout: German
>   'Z' keyon English keyboard => 'Y' in TurboVNC Server, 'Z' in
> Windows guest
>   '/' keyon English keyboard => '-' in TurboVNC Server, 'ß' in
> Windows guest
>   '[' key on English keyboard => 'ü' in TurboVNC Server, nothing in
> Windows guest
>
> - Client layout: English, TurboVNC Server layout: German, Windows
> guest layout: English
>   'Z' key on English keyboard => 'Z' in TurboVNC Server, 'Y' in
> Windows guest
>   '/' keyon English keyboard => '/' in TurboVNC Server, '&' in
> Windows guest
>   '[' key on English keyboard => '[' in TurboVNC Server, '8' in
> Windows guest
>
> - Client layout: German, TurboVNC Server layout: German, Windows
> guest layout: English
>   'Z' keyon English keyboard => 'Y' in TurboVNC Server, 'Z' in
> Windows guest
>   '/' keyon English keyboard => '-' in TurboVNC Server, '/' in
> Windows guest
>   '[' key on English keyboard => 'ü' in TurboVNC Server, '[' in
> Windows guest
>
> - Client layout: English, TurboVNC Server layout: German, Windows
> guest layout: German
>   'Z' keyon English keyboard => 'Z' in TurboVNC Server, 'Y' in
> Windows guest
>   '/' keyon English keyboard => '/' in TurboVNC Server, '&' in
> Windows guest
>   '[' key on English keyboard => '[' in TurboVNC Server, '8' in
> Windows guest
>
> - Client layout: German, TurboVNC Server layout: German, Windows
> guest layout: German
>   'Z' keyon English keyboard => 'Y' in TurboVNC Server and Windows guest
>   '/' keyon English keyboard => '-' in TurboVNC Server and Windows guest
> <https://github.com/TurboVNC/turbovnc/issues/108>) that will allow
>> send an email to turbovnc-user...@googlegroups.com <javascript:>.
>> <https://groups.google.com/d/msgid/turbovnc-users/1d25c323-7eb6-4a41-8dc2-8c049ac0f183%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout
>> <https://groups.google.com/d/optout>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "TurboVNC User Discussion/Support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to turbovnc-user...@googlegroups.com
> <mailto:turbovnc-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/turbovnc-users/13e6e91f-385b-43de-aace-14cf593f6157%40googlegroups.com
> <https://groups.google.com/d/msgid/turbovnc-users/13e6e91f-385b-43de-aace-14cf593f6157%40googlegroups.com?utm_medium=email&utm_source=footer>.

torsten

unread,
May 24, 2018, 4:23:02 PM5/24/18
to TurboVNC User Discussion/Support
Hi DRC,


Am Dienstag, 22. Mai 2018 22:22:00 UTC+2 schrieb DRC:
I don't know how to make it any more clear.  This is a limitation of the
RFB protocol, and the only way to overcome that limitation is to
implement the aforementioned RFB extension that sends key codes instead
of key symbols.  It is not necessary to use a script.  I was just
pointing out that use case for completeness, because other people may
stumble upon my answer via Google.

In a nutshell, you can continue to use TurboVNC as you are currently
using it.  You just need to ensure that:

- The German keyboard layout is selected in the guest operating system
that is running inside the VM

This was and is ensured (by Ubuntu 14.04).
 
- The keyboard layout in the TurboVNC Server session and on the client match

In the client OS (Windows 10) the German keyboard layout is selected automatically. The host OS (Ubuntu 16.04), where the TurboVNC Server runs, has selected the German keyboard layout too. All three OSs use the same the keyboard layout. But nevertheless the keys produce wrong characters in the VM. Is there something to adjust in the TurboVNC Server configuration?
 
Kind Regards
Torsten

DRC

unread,
Jun 12, 2018, 5:50:35 PM6/12/18
to turbovn...@googlegroups.com
It might be worth trying to add

  setxkbmap -layout de

to the head of ~/.vnc/xstartup.turbovnc, or trying to run VirtualBox without a window manager (with a procedure similar to the one I previously described.)  Other than that, the only suggestions I have involve paying for my labor to either:

1. Log into your system remotely and diagnose the problem as it relates to your specific configuration
or
2. Implement this feature:  https://github.com/TurboVNC/turbovnc/issues/108

I can reproduce the problem, but in my testing, it was easily worked around.  I did not test on Ubuntu, however, so perhaps there is something different about that window manager that is causing problems.  You might also try using a different window manager, such as MATE, which would more closely approximate my test environment.

At the end of the day, the proper long-term solution to this is to modify TurboVNC such that the viewer sends key codes to the server instead of keysyms.  Any other solution is going to be a workaround.  I definitely want to support international keyboard users, and I've spent quite a bit of time (some paid, some not) trying to do this, but right now, I am completely broke and cannot afford to donate any further pro bono labor to TurboVNC for implementing new features.

DRC
To unsubscribe from this group and stop receiving emails from it, send an email to turbovnc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/turbovnc-users/ee5f0b09-5b9b-412f-90cd-5ea1c3e12d99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages