Scrambled Keys in feisty ubuntu desktop

Bug #108928 reported by Finn Andersen
This bug report is a duplicate of:  Bug #112955: vino (vnc) keyboard mapping problem. Edit Remove
26
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gnome-control-center
New
Undecided
Unassigned
control-center (Ubuntu)
New
Undecided
Unassigned

Bug Description

Upon login to gdm after upgrading from 6.10 to 7.04 the keyboard is messed up.
Also it complains that there is a mismatch between X settings and gnome.
Gnome settings was set to US keyboard. Changed it to Norwegian, and xorg.conf is also set to use no layout.

typing "qwerty" gives "c.gvn " This only happens in X and by using VNC to the machine.
Ssh into the machine works fine.

my keyboard setup in xorg.conf
Section "InputDevice"
        Identifier "Generic Keyboard"
        Driver "kbd"
        Option "CoreKeyboard"
        Option "XkbRules" "xorg"
        Option "XkbModel" "pc105"
        Option "XkbLayout" "no"
EndSection

I don't know if this is relevant, but this happend when I killed X, so that it would restart

xiphias@tweety:/usr/share/doc/ontv$ ps -ef | grep X
root 22073 22070 0 Apr20 tty7 00:00:05 /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
xiphias 32384 20291 0 15:30 pts/2 00:00:00 grep X
xiphias@tweety:/usr/share/doc/ontv$ sudo kill 22073
xiphias@tweety:/usr/share/doc/ontv$ ps -ef | grep X
root 32389 32388 99 15:30 tty7 00:00:02 /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
root 32396 32389 0 15:31 tty7 00:00:00 sh -c "/usr/bin/xkbcomp" -w 1 "-R/usr/share/X11/xkb" -xkm "-" -em1 "The XKEYBOARD keymap compiler (xkbcomp) reports:" -emp "> " -eml "Errors from xkbcomp are not fatal to the X server" "/var/lib/xkb/server-0.xkm"
root 32397 32396 0 15:31 tty7 00:00:00 /usr/bin/xkbcomp -w 1 -R/usr/share/X11/xkb -xkm - -em1 The XKEYBOARD keymap compiler (xkbcomp) reports: -emp > -eml Errors from xkbcomp are not fatal to the X server /var/lib/xkb/server-0.xkm
xiphias 32399 20291 0 15:31 pts/2 00:00:00 grep X

Revision history for this message
Finn Andersen (finn-wax) wrote :

It's not only the "qwerty" letters that are messed up. It's the whole keyboard layout. Nothing is where it supposed to be.
Gnome desktop is useless without a working keyboard

Revision history for this message
LongInTheTooth (scavanagh) wrote :

I have seen this as well in a fresh feisty install, accessing through vnc.
See the thread here: http://ubuntuforums.org/showthread.php?t=411949&highlight=scrambled

Revision history for this message
Glenn Rempe (grempe) wrote :

This bug is also affecting my system, upgraded via apt-get based command line instructions from 6.10 to 7.04. I have a standard keyboard attached which works fine but primary access is through VNC. System is unusable through VNC as keyboard mappings are all wrong. Tried installing FreeNX as well and while I can use the remote desktop through FreeNX it suffers from the same scrambled keys. This is a CRITICAL bug for those who primarily access an Ubuntu system through a remote desktop solution. Note that my keymapping errors vary from previous posts with 'qwerty' showing as '-^^^wq' where ^ is an unprinted control character. I also saw the dialog upon startup of a mismatch between keyboard settings in X and those in Gnome being out of sync. I chose to use the Gnome settings. Previously when I got the message I chose the X settings and both behaved the same. I have tried various settings in the System > Preferences > Keyboard with no apparent affect.

Revision history for this message
Glenn Rempe (grempe) wrote :

I have confirmed that this bug seems to only be present if you are using the GNOME desktop. I installed kubuntu-desktop package and restarted my system. On login I chose KDE as my default session. For remote desktop test I connected using FreeNX (make sure to switch to UNIX > KDE in the prefs for FreeNX or your broken GNOME session will start again) and all works fine. I have not tested with VNC remote desktop but it should be the same.

Revision history for this message
Macknal (mark-mcnally) wrote :

I have the same problem. I installed Feisty from CD this weekend keeping the filesystem for /home and my personal files in place. I installed vncserver today using apt-get and connecting remotely I have scrambled keys exactly as the first post where "qwerty" becomes "c.gvn ".

Revision history for this message
John Williams (jswillms) wrote :

I have the same failure running gnome thru vnc. Worked fine on edgy.

Please suggest steps to debug....

Revision history for this message
John Williams (jswillms) wrote :

by the way, when you log into gnome, characters are proper. I see the scramble in vterm, gedit, firefox, etc.

Revision history for this message
Hugues Fournier (hugues-fournier) wrote :

On the GNOME login, gnome-session has not yet set the keyboard (something it does badly when it is VNC, because it has problems listing available keyboards from the Xvnc session)
This is why the GNOME login works right when VNCserver use XDMCP ( vncserver -query localhost) (XDMCP has to be activated too)

So there is a temporary solution (that won't work if instead of XDMCP, you are uglily launching gnome-session...) :

When you are using XDMCP, VNC first displays the splash login.
At this time, through ssh, through the same account that has launched vncserver, save the keyboard map :
xmodmap -pke -display :1 > ~/xmodmap.map ( if your VNC display is :1 )

Then on the Desktop, just create a script that will load this map with for example nano.
---
#!/bin/bash

cat ~/xmodmap.map | xmodmap -
---

chmod u+x it..

This will allow you to get a correct keymap after you have clicked on it (you can even configure your session through the Session menu to launch it automatically)
This ugly hack is obviously just a temporary fix..

Revision history for this message
Hugues Fournier (hugues-fournier) wrote :

Obviously you only have to create xmodmap.map once...

Revision history for this message
Hugues Fournier (hugues-fournier) wrote :

And to correct my thoughtlessness, the culprit is gnome-control-center, not gnome-session.

Revision history for this message
John Williams (jswillms) wrote :

Is tightVNC better at determining the correct map? That was suggested as something to try... Is this a vnc client or server issue? Is it possible to bring up the control center to correct this. Awaiting an upstream fix is a bit worrisome....

What changed to cause edgy to work and feisty to not. In my case I am running feisty in Dom0 (xen) and edgy and feisty in domU's. Edgy works fine and Feisty fails. Followed the XenOnFeisty howto to hack gdm...

Revision history for this message
LongInTheTooth (scavanagh) wrote :

Hmm. As workarounds go I'd think I'm better off with this one: http://ubuntuforums.org/showpost.php?p=2539412&postcount=4

At least until we get a better fix.

Revision history for this message
John Williams (jswillms) wrote :

This workaround also worked for me. Feisty value was us-101, was blank on edgy. Created new bogus value (easy since kbd is munged) of "c.b" and removed us-101 entry. exited the editor. btw, to bring up the gconf-editor, navigate thru the places menu to /usr/bin/gconf-editor and double click it. navigate to /desktop/gnome/peripherals/keyboard/kbd and edit the layout field. Leave the kbd.sysbackup alone. log out of to gdm screen and log back in...

Revision history for this message
Finn Andersen (finn-wax) wrote :

The temporary fix worked for me to. Hope someone qualified fixes this soon.
Miy kdb was empty in feisty.

Revision history for this message
frankO (frank-grant) wrote :

The fix is to use --extension XFIXES
This works for vnc4server. It does not work for vncserver.
The following will fix the scrambled keys and also give you the gnome desktop
ssh into your remote pc
sudo apt-get install vnc4server (make sure you do not have vncserver added. If you do then sudo apt-get remove vncserver)

Then run
vncserver :1 -query localhost -extension XFIXES

Refer https://bugs.launchpad.net/ubuntu/feisty/+source/vnc4/+bug/78282

Revision history for this message
Keith Ching (keching) wrote :

the scrambled keys also occur independent of any vnc (server)
because it also occurs if you start gnome-session and forward X to a remote
display.

Xnest :1 -geometry 1024x768 & ( on remote machine)
export DISPLAY= yourIP:1 ( on remote machine, new term)
ssh -X user@machineyouwanttosee
gnome-session & (once logged in)

Labanana's bogus layout hack (http://ubuntuforums.org/showpost.php?p=2539412&postcount=4) seems to restore normal keys in both cases.

Revision history for this message
Andy Ferguson (teknostatik) wrote :

Just to confirm that I can replicate this fault by logging in to a remote Ubuntu machine (2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux) from a Mac running OS X 10.4.9. The keyboard mapping is fine when logging in to GDM, but scrambles as soon as Gnome itself is launched. I've replicated this on three different macs logging into two different Ubuntu machines.

It's not just a problem with VNC, it seems to affect any graphical remote session.

Revision history for this message
eremos (hjbotha) wrote :

"Me too".

It works fine when I switch to standard X server (with automatic logon) and log in via shared desktop, but when I change gdm's X server to Xvnc I can log in okay but once gnome starts up it goes wonky again.

When I switch from Xvnc to X I get this message:
The X system keyboard settings differ from your current GNOME keyboard settings.
Expected was model "pc105", layout "us" and no options, but the the following settings were found: model "generic", layout "us" and no options.
Which set would you like to use?

The bug occurs regardless of which option I choose.

When I switch from X to Xvnc I get this message:
The X system keyboard settings differ from your current GNOME keyboard settings.
Expected was model "generic", layout "us" and no options, but the the following settings were found: model "pc105", layout "us" and no options.
Which set would you like to use?

In the end Labanana's hack worked for me as well.

Revision history for this message
Fabián Rodríguez (magicfab) wrote :

This looks like a duplicate of Bug #112955

Revision history for this message
primitiveworker (primitiveworker) wrote :

I've discovered a work-around which works for my particular environment, but which may also work for others. I suffered from the same symptoms, and eventually started booting into KDE to "fix" it, but it was still "broken", just slightly less so. For instance, my right-arrow key was mapped incorrectly.

I noticed that after working all day long in KDE, the right-arrow key would suddenly start working. It turns out that if my client machine goes to sleep, drops the remote connection, wakes up and rejoins the existing session, the keyboard is mapped perfectly.

YMMV, but it works for me.

My environment:
Xubuntu Fiesty, GDM, FreeNX, and the official NXClient running on a Macbook with OSX 10.4.10.

To reproduce:
Use your remote software on the client to log into GDM as you normally would, in your environment of choice (Xubuntu or GNOME).
Observe your keyboard is just as scrambled as you would expect.
Send your client machine into a sleep/hibernate mode.
Wake your client machine.
Observe the remote software (NXClient in my case) alerting you to the fact that the connection was lost.
Open the connection again, rejoining the previous session.
Observe your keyboard works perfectly.

I don't know if it will work for every combination of remote server/client software, but it works for mine. Good luck.

Revision history for this message
Amit Gurdasani (gurdasani) wrote :

I've also encountered this issue. My solution was to capture the xmodmap -pke output as ${HOME}/.Xmodmap at the login screen (DISPLAY=:0 XAUTHORITY=/var/lib/gdm/:0.Xauth sudo xmodmap -pke > ${HOME}/.Xmodmap). When gnome-settings-daemon starts up and finds an .Xmodmap, it asks if it should be loaded -- I answer yes. As a side effect, if gnome-settings-daemon were to be restarted without the .Xmodmap, it'd scramble the keyboard layout again. With an .Xmodmap in place, it'll load the .Xmodmap every time.

Due to another issue (#199245, gnome-settings-daemon crashing with BadWindow every time a window is mapped), I disabled the keyboard plugin using gconf-editor, at /apps/gnome_settings_daemon/plugins/keyboard. Since it's not being loaded, I suspect it might not garble the layout even if I remove the .Xmodmap now.

So maybe disabling the keyboard plugin is a better fix.

Revision history for this message
H3g3m0n (h3g3m0n) wrote :

I'm seeing the same problem on a Debian Lenny (testing) system so its not just Ubuntu.

When running Fluxbox instead of gnome-session it works fine.

Revision history for this message
Brian Kemp (brian-kemp) wrote :

Also affects 8.04. Our workaround is to use xfce as it is not affected.

Revision history for this message
Bob Wanamaker (rlw-nycap) wrote :

Another hack for this problem in feisty that works for me. Append the following lines to the Default file in /etc/gdm/PostSession :

KB_BACKUP="$HOME/.gconf/desktop/gnome/peripherals/keyboard/kbd.sysbackup"

if [ -d $KB_BACKUP ]; then
        rm -r $KB_BACKUP
fi

This eliminates the annoying keymap query when logging into the server after a VNC visit. It returns to the
originally configured xorg.conf setup. I haven't tested it when there are two logins to the same account.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.