When a guest OS is loaded using UEFI and connected with VNC, if the keyboard on the VNC client side is other than the US keyboard, some keys input may not be performed correctly.
For example, if you press the '@' key on a Japanese keyboard, the number '2' will be entered on the guest OS.
The cause is that the '@' key on the US keyboard is assigned to Shift + '2' keys.
In addition, there is a problem that keys that do not exist on the US keyboard cannot be entered. (example, Zenkaku-Hankaku key in the Japanese Keyboard)
In the current bhyve(13.x-RELEASE & 12.x-RELEASE), in the virtual PS2 keyboard driver, there is a conversion table that converts from the key entered from the VNC client side to the virtual keyboard scancode for the Guest OS.
However, since this conversion table is set for US keyboards, the above problem will occur if the client side is not a US keyboard.
Therefore, in order to solve this problem, the following two types of patches were created.
<Patch 1> Support for QEMU Extended Key Event Message.
By applying a patch that supports QEMU Extended Key Event message to bhyve, this patch bypasses the conversion process to keyboard scancode by the conversion table and sends the Keycode on the VNC client side directly to the guest OS.
If you're using TigerVNC, this method can solve keyboard layout issues without any bhyve boot options or VNC client settings.
However, it has no effect when using VNC clients that do not support QEM messages, such as tightVNC and ssvnc.
<Patch 2> Append Keyboard Layout specified option.
This patch adds the ability to overwrite the keyboard scancode conversion table that is causing the problem from the settings for the US key board to the settings for the language you want to use.
In addition, the content of the setting (conversion table) to be overwritten is an external layout setting file for each language so that the language to be used can be set from the bhyve command option.
This method will work fine with VNC clients that do not support QEMU Extended Key Event Message, such as tightVNC.
However, it is necessary to specify options according to the keyboard layout of the client on the hypervisor side, and it is necessary to prepare an external configuration file that matches the keyboard layout of each language.
(For each keyboard layout available on the FreeBSD console, we have created a layout configuration file that allows you to use the minimum keys, such as alphabets and numbers.)
Patch 1 and 2 are independent. Therefore, it is possible to apply only one or both.
This patch can be used only by applying the patch according to the following procedure and then building and installing the bhyve command.
VNC clients can only be used with QEMU Extended Key Event Messages, (e.g. tigerVNC)
The patch is stored in the qemu_ext_keyevent_msg directory.
1. cd /usr/src/usr.sbin 2. patch -u < bhyve_qemu_ext_key_event_msg_fbsd130r.patch 3. cd /usr/src/usr.sbin/bhyve 4. make 5. make install
First, please apply the patch to bhyve by following the steps below.
Then extract the keyboard layout settings files and then build and install it.
1. cd /usr/src/usr.sbin 2. patch -u < bhyve_kbdlayout_option_fbsd130r.patch 3. sh bhyve_kbdlayout_layoutfile.shar 4. cd /usr/src/usr.sbin/bhyve 5. make 6. make install
Second, please apply the patch to vmrun.sh.
7. cd /usr/src/share 8. patch -u < bhyve_kbdlayout_vmrunsh_fbsd130r.patchFinaly, if you use the bhyve command directly, specify the '-K layout' option for the bhyve command.
The layout specified option is changed to uppercase "-K", since the version of 2021/5/5.
Please note that if you are using an earlier patch, it will be INCOMPATIBLE!
* 2021/05/05 - Update for FreeBSD 13.0-RELEASE.(Along with this, the patch filename was changed) >> [Patch 1] & [Patch 2] - Change keyboard layout specification option to "-K" (uppercase K). (Because "-k" is used for other purposes in FreeBSD current's bhyve) >> [Patch 2] - for FreeBSD 13.0-RELEASE & 12.2-RELEASE - Fix the following issues on the FreeBSD review site. (Corrected the violation of man's notation rule by incorporating the content of the proposal on the review side.) (https://reviews.freebsd.org/D29473)
* 2021/01/24 - Initial Version as an archive file for osdn.net.
I'm currently posting on FreeBSD bugzilla to have the patches on this page merge into the bhyve src-tree of FreeBSD.
As a result, <Patch 1> has been merged into the latest basesystem. (Thanks to all the members of the FreeBSD / bhyve core team for their cooperation!)
Patch 2 is under review as of May 5, 2021.
The patches on this page will be updated irregularly until they are merged into the FreeBSD Release version.
Currently, the keyboard layout configuration file is generated from the FreeBSD console layout configuration file. (Excluding layout setting files for Japanese keyboards)
Therefore, there are the following problems.
Regarding the above, please add to the created layout setting file and cooperate with the test.
If the layout configuration file has been improved or tested, please report the results to the following FreeBSD bugzilla or email@example.com.
|bhyve_keyboard_layout_patch_20210102.tgz||22.05 k||2021-05-05 13:54:38||12|
|bhyve_keyboard_layout_patch_20210505.tgz||22.67 k||2021-05-05 13:54:06||1|
|cc1686d3||2021-05-05 13:42:00||Koine Yuusuke(koinec)||Update information for FreeBSD 13.0-RELEASE & patch fixes.|
|64183a61||2021-05-03 23:00:42||Koine Yuusuke(koinec)||* Change keyboard layout specification option to "-K" (up...|
|0fd314b5||2021-05-03 22:57:47||Koine Yuusuke(koinec)||* Update for FreeBSD 13.0-RELEASE.(Along with this, the p...|
|e5fa1dd3||2021-05-03 22:45:35||Koine Yuusuke(koinec)||* Update for FreeBSD 13.0-RELEASE.(Along with this, the p...|
|b74a2a2e||2021-05-03 22:32:34||Koine Yuusuke(koinec)||* Update for FreeBSD 13.0-RELASE.(Along with this, the pa...|
|741ffcc8||2021-01-24 19:51:56||Koine Yuusuke(koinec)||Fix bugs.|
|6ef7697d||2021-01-24 19:49:31||Koine Yuusuke(koinec)||Put keyboard layout setting file generation tools from Fr...|
|bd77d34f||2021-01-24 19:43:03||Koine Yuusuke(koinec)||Put Keyboar Layout file to git repository.|
|e74b1345||2021-01-24 13:25:37||Koine Yuusuke(koinec)||Create readme.txt.|
|a52e6fbb||2021-01-02 13:42:09||Koine Yuusuke(koinec)||kbdlayout: add patch for FreeBSD 12.2-RELEASE kbdlayout: ...|