VirtualBox Images CentOS keyboard settings problem

I was using readymade CentOS images for VirtualBox from VirtualBoxes CentOS images. I noticed that some of the images come with weird keyboard settings, such that you can’t use the pipe (passing information from command to command), dash (for command parameters), @ (email sign), etc keys. In other words, when you try to type these keys, other keys would appears and vice versa. All of these keys are crucial to running any commands on the CentOS server.

The problem is that the VirtualBox image stores the keyboard setting that was used when it was created. Since this server image was built in Italy, and I am located in the US, there were obviously key differences.

The obvious solution is to change it to your preferred keyboard layout. There are 2 ways of doing it:

  1. Easier way: Install system-config-keyboard through yum. The caveat is this will install 75+ other bloat packages that you probably don’t need. However the command system-config-keyboard would configure your keyboard for you.
    yum install system-config-keyboard
  2. Advanced way: Use
    loadkeys

    command to change the keys temporarily and then make a change to

    /etc/sysconfig/keyboard

    to make a permanent change (after restart).

    loadkeys us # or your own locale
    vim /etc/sysconfig/keyboard # replace KEYTABLE value to your locale

7 thoughts on “VirtualBox Images CentOS keyboard settings problem”

  1. There’s a much simpler option if you are booted in graphical mode. Just go to “System->Preferences->Keyboard->Layouts” and add “USA/USA” keyboard and make that default. It worked for me.

  2. Hi, I found Ctrl-C and like is not working with CentOS 6.3 vbox image, and I guess the weird characters displayed were control characters. I have changed the keyboard layout, any idea what’s wrong?

    Thanks,
    kc

  3. Thanks much!! I had the same problem; I used your second method as I certainly didn’t want unnecessary stuff. Worked like a charm.

Leave a Comment