Keychron C2 Keyboard Function Keys fix

Hi,

I use a Keychron C2 mechanical keyboard. It has a well know Linux issue - the function keys are on by default, so this fix is necessary (it works fine on my Linux system):

In dom0 I did:

echo 0 | sudo tee /sys/module/hid_apple/parameters/fnmode
echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo dracut --regenerate-all --force

Shutdown and restart.

cat /sys/module/hid_apple/parameters/fnmode
1

This has to be 0 though. Even the temporary change (the first command) seems to have no effect.

Then I repeated the same thing in sys-usb. The temporary change worked fine. The persistent one (second command) did not though. After reboot fnmode is still 1. Something more: after the reboot ‘history’ does not even show the 3 commands I typed before rebooting which is really weird.

How to make this work in Qubes OS, please?

1 Like

Do you have a disposable sys-usb? If yes, it’s whole filesystem is reset on every reboot (and it’s good for your security). You can either make it non-disposable (not recommended), make the changes in the template, or use bind-dirs AFAIK.

Looking at sys-usb’s settings I see that:

  • Template is set to “fedora-34-dvm (current)” and it is non modifiable
  • in the Advanced tab “Disposable template” is not checked
  • Default disposable template is set to “default (fedora-34-dvm) (current)”

I suppose this means it is disposable, right?

If yes, it’s whole filesystem is reset on every reboot (and it’s good for your security).

Then how come it remembers the rest of the typed commands in history? Does that come from the template? If yes, then should one ‘ln -s ~/.bash_history /dev/null’ in the all templates?

make the changes in the template

Do you mean the necessary commands in fedora-34-dvm template?

or use bind-dirs AFAIK.

Considering the particular case, which method is better - bind-dirs or template change - and why?

For anyone else facing this issue in the future, here is the solution I found:

To have the keyboard Fn keys working properly during Qubes OS installation add kernel boot time parameters:

hid_apple.fnmode=2

My experience shows that this can be removed after installation as it seems to have no effect (I don’t know why).

On an installed Qubes OS system do this the template fedora-xx:

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

To persist the change:

echo "options hid_apple fnmode=2" | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo dracut --regenerate-all --force

Use 2 instead of 0, so that Fn keys work when pressing ‘Fn’ key.