Keymapping erased when disconnecting/connecting keyboard

Yasuhiro Kimura yasu at
Tue Jun 29 21:55:34 UTC 2021

From: Kristofer via freebsd-questions <freebsd-questions at>
Subject: Keymapping erased when disconnecting/connecting keyboard
Date: Mon, 28 Jun 2021 17:17:57 +0000

> I have another issue that I have not seen before FreeBSD 13.0. I frequently unplug the keyboard to use on another machine and I have been doing this for many years on older FreeBSD installations without any issues. Now with 13.0, every time I plug in the keyboard again, I have US keymap and it ignores the setting I have in /etc/rc.conf. locale is also unmodified, as epxected. The kaymap is correctly set to Swedish keymap when I log in, but as soon as I remove/re-add the keyboard, it is lost.
> On top of that, I haven't been able to figure out how to get get the keymap back without rebooting the machine. There has got to be some simple thing I'm missing here.
> For reference, the keyboard in question is identified this way in /var/log/messages in case that makes any difference to how I should solve it
> kernel: ukbd0: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint, class 0/0, rev 2.00/3.30, addr 4> on usbus3
> TIA,
> Kristofer

If you change keyboard settings by setting such variables as keymap,
keyrate, keybell, etc. in /etc/rc.conf, then you can restore the
status of boot time by executing `service syscons restart` with root

There are two points to note.

1. This restores settings of console, i.e. either vt(4) or syscons(4).
   If you want to restore that of X server, I'm not sure if you can
   restore without restarting it.
2. Keep in mind terminating X server before executing the command.
   Though I have never tried it, it is very likely it results in
   chaotic situation if you forgot it.

Yasuhiro Kimura

More information about the freebsd-questions mailing list