I'm trying to have a mac keyboard behavior on my ubuntu/trusty32 virtual machine, and had some problems with it so far.

Using sudo dpkg-reconfigure keyboard-configuration seemed to work at first, but there was no way to keep the changes after a reboot, and the command sudo udevadm trigger --subsystem-match=input --action=change worked neither.

The /etc/default/keyboard content was :





After some reading and tests I discovered that XKBVARIANT="mac" has better effects. I have now to type the command sudo udevadm trigger --subsystem-match=input --action=change to obtain the behavior expected, even after a reboot.

So I am wondering if I misreaded the sentence

After modifying /etc/default/keyboard, you can apply the changes to the Linux console by running setupcon. If X is configured to use that file too, then the changes will become visible to X only if udevadm trigger --subsystem-match=input --action=change is called, or the system is rebooted.

How to make the reboot take into account the new keyboard configuration ?


One way on an Ubuntu desktop to persistently set "French (Macintosh)" for the current user is to run this command:

gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'fr+mac')]"


On a server I think that this command gives the same result:

setxkbmap -layout fr -variant mac

However, if the system refuses to recognize XKBVARIANT when reading /etc/default/keyboard (can't explain why), you may need to have that command run at the start of each session.

  • did not work, still the same, despite a change with the gsettings output command : – Etienne Jouin Nammalvar Dec 22 '16 at 10:54
  • @EtienneJouinNammalvar: Please see edited answer. – Gunnar Hjalmarsson Dec 22 '16 at 11:50
  • same effect indeed, I'll run the command at each session start. Many Thanks. – Etienne Jouin Nammalvar Dec 22 '16 at 16:25
  • gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'fr+mac')]" works for me !! thanks alot. Great trick. That was a problem and solved it :) – RedArrow Dec 19 '20 at 15:16

I've found the hitch, thanks to Gunnar Hjalmarsson again.

The VM was provided with a "oh-my-zsh" configuration, and the last line of the .zshrc stated setxkbmap fr

So every attempt was reverted as soon as I launched the terminal.

Very funny afterwards. :-/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.