title: How to change the keyboard layout from the Vagrantfile
body: <p>I'm using the DevBox of JHipster, which is a XUbuntu Vagrant box.</p>
  
  <p>I want to change the keyboard layout during the provisionning of the box, and make it effective even on the login page, without the need of a reboot, so the user can just use it directly after the first start of the VM.</p>
  
  <p>I tried several commands to change the keyboard layout:</p>
  
  <ul>
  <li><code>setxkbmap fr</code> (won't work since shell provisionning is done with root and setxkbmap can't be used with root)</li>
  <li><code>loadkeys fr</code> (no errors but no result)</li>
  <li><code>sed -ie '/^XKBLAYOUT=/s/".*"/"fr"/' /etc/default/keyboard</code> (apparently works but have to be "sourced")</li>
  </ul>
  
  <p>and several commands to apply the changes:</p>
  
  <ul>
  <li><code>udevadm trigger --subsystem-match=input --action=change</code></li>
  <li><code>dpkg-reconfigure -f noninteractive keyboard-configuration</code> (<code>noninteactive</code> because it is a shell script)</li>
  <li><code>setupcon --force</code> (<code>force</code> because without it it complains that it's not a Linux terminal)</li>
  </ul>
  
  <p>None of them worked (or more precisely, the combination of <code>sed</code> and <code>udevadm</code> seemed to work, but when I tried it with a newly installed VM, it did not).</p>
  
  <p>Any idea on how to make it work ?</p>
  
  <p>EDIT:</p>
  
  <p>Ok it was a serious case of PEBKAC...</p>
  
  <p>For the record, the correct combination for me was: sed -ie '/^XKBLAYOUT=/s/".*"/"fr"/' /etc/default/keyboard &amp;&amp; udevadm trigger --subsystem-match=input --action=change</p>
  
  <p>I just badly refactored the variable containing the language (fr here), so it printed nothing...</p>
  
  <p>EDIT:</p>
  
  <p>Well it wasn't just a PEBKAC, it works fine on the login page but not once I'm logged in (even if it worked before I reinstalled everything).</p>