Alt-right key not enabled after login

Asked by Martin Maletinsky


I am using Ubuntu 14.04 on a HP EliteBook 8530 notebook with a Swiss German keyboard and I experience a problem with all desktops I use.
After I log in to a desktop, the right alt key does not work. E.g. alt right key + 2 should provide the "@" sign, but a "2" appears. There is a workaround to the problem (which I found browsing the internet), which consists in running the following command which provides the following console output:
sudo dpkg-reconfigure keyboard-configuration
[sudo] password for malemar:
Your console font configuration will be updated the next time your system
boots. If you want to update it now, run 'setupcon' from a virtual console.
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
update-initramfs: Generating /boot/initrd.img-3.19.0-33-generic

When asked to answer various questions, I just confirm the existing settings by pressing Enter. These settings are as follows:

Keyboard model:
"Hewlett-Packard Pavilion ZT11xx"

Country of origin for the keyboard:

Keyboard layout:
"Switzerland - German (Switzerland, legacy)"

Key to function as AltGr:
"Right Alt (AltGr)"

Compose key:
"Right Control"

Use Control+Alt+Backspace to terminate the X server:

Once the command completes, the alt right key works. I would however be happy to get rid of the necessity to run dpkg-reconfigure every time I log in.

This problem does not appear when I log in to a console (which I reach pressing Ctrl Alt F4). It does appear on all desktops that I have installed, which are the following:
Gnome Flashback (Compiz)
Gnome Flashback (Metacity)
Gnome Classic

thank you for any help and hints
kind regards

Question information

English Edit question
Ubuntu software-center Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :

If you run:
sudo gedit /etc/rc.local

add the line:
dpkg-reconfigure keyboard-configuration

above the "exit 0" line and it will run at boot. Does this make it OK?

Revision history for this message
Martin Maletinsky (martin-maletinsky) said :


Thank you for this hint.

Just some questions related to this:
- Is this line ("dpkg-reconfigure keyboard-configuration") usually part of rc.local (and has it been removed on my system by some mistake, accident, ...) or is you suggestion just an 'automatisation' of the workaround I am currently using?
- What actually does dpkg-reconfigure keyboard-configuration do?

If it is just an automatized execution of the workaround, I would still be interested to understand the root cause of the problem and know how the problem can be solved 'properly'.

thank you
kind regards

Revision history for this message
actionparsnip (andrew-woodhead666) said :

By default the rc.local does nothing, but you can add commands there that run as root just before the login page shows.

I have no idea what the command does, but you seem to have found the necessary command so we can add it to the bootup and make the system work as expected.

You may want to add:
dpkg-reconfigure keyboard-configuration &

(note the additional ampersand) to the rc.local file instead.

Yes it is just automating the workaround.

Revision history for this message
Martin Maletinsky (martin-maletinsky) said :


Thank you. I will definitely implement this automatization of my workaround.

What does the ampersand do (compared to your first recommendation without ampersand)?

Also on a long term, I would still be interested to understand why it is necessary to run this command at all and also to know if there isn't a way to adress the root cause of the problem.

thank you
kind regards

Revision history for this message
actionparsnip (andrew-woodhead666) said :

The ampersand puts the process to the background so that the boot continues as normal but the command runs as well. Without it, the system boot will wait until the command finishes.

Can you help with this problem?

Provide an answer of your own, or ask Martin Maletinsky for more information if necessary.

To post a message you must log in.