Sunday, December 30, 2007

3 Solutions to GNOME/VNC keyboard mapping issue

I am trying to connect to my workstation in the office via vncviewer and I got scrambled keys in GNOME before I applied one of the fixes below. This has bugged me for more than a week and Google couldn't really give me a good answer until I searched for:

asdf abfh vnc

Try.

It is a bug reported at #108928 and duplicated at #112955. Appears more like a GNOME issue than a VNC issue.

Solution #1: Use vnc4server -extension XFIXES

No, I did not try this because I simply do not want to change my client. The workaround basically requires you to remove tightvncserver and use vnc4server instead. Refer to this and this for more information.

Solution #2: Avoid executing gnome-session

Instead of running gnome-session, run the following commands in your xstartup script or manually in xterm:

gnome-wm &
gnome-panel &
gnome-cups-icon &
gnome-volume-manager &

Suggested by Randy at this link.

Solution #3: Reset the keyboard layout via gconf-editor

This solution works the best in my opinion, suggested by Will at this link. Open up gconf-editor in your X then navigate to:

desktop > gnome > peripherals > keyboard > kbd

You will probably be seeing empty value [] or [us] for the layouts. Enter anything say foo, close the application and your problem should now be fixed.

- yc, one problem in life down

22 comments:

Anonymous said...

Re Solution #3: You can perform the same setting without the graphical gconf-editor using the following command (e.g. via SSH):

gconftool --set /desktop/gnome/peripherals/keyboard/kbd/layouts --type List --list-type String [aa]

Denis Howe said...

The command-line version did it for me. Thanks guys.

Is there a proper fix for this in some distro somewhere.

Carl-Johan Sveningsson said...

Thanks for documenting this - it enabled me to use gnome-session in my Ubuntu Feisty again. However, whenever I kick up the keyboard settings again, it happens all over again, and I still can't set it to accept my Mac keyboard properly, you got any ideas?

dcatdemon said...

Perhaps you can try this:

1. edit your $HOME/.vnc/xstartup
2. put the line "export XKL_XMODMAP_DISABLE=1" before your gnome-session.
3. restart vncserver.

and lo, it works :).

credit must go to this link.
http://bugs.gentoo.org/show_bug.cgi?id=190865#c7

Aras said...

This post solved my problem too. Thanks!

Anonymous said...

put the line "export XKL_XMODMAP_DISABLE=1" before your gnome-session. is an great tip, thanks.

Daniel said...

Ditto on using "export XKL_XMODMAP_DISABLE=1". Worked like a charm, and is really easy.

lain gallery said...

Yeah!! Adding the "export XKL_XMODMAP_DISABLE=1" worked - thanks!

Anonymous said...

Thank You dcatdemon!

just put the line "export XKL_XMODMAP_DISABLE=1" solved for me!

David said...

The solution of export XKL_XMODMAP_DISABLE=1 worked for me to. In fact I am typing this on my properly mapped VNC right now. Thank you!!

nor said...

I am using Ubuntu 9.04. putting "export XKL_XMODMAP_DISABLE=1" in $HOME/.vnc/xstartup
works great. Thanks dcatdemon

Anonymous said...

# in .vnc/xstartup
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1 # the fix
gnome-session &


Works in ubuntu 9.10 (headless) too. Thanks for the tip.

/lars

Unknown said...

Absolutely, dcatdemon's post worked for me as well! Thank you for fixing this irritating bug!

John said...

Solution #3... awesome. Thank you

Anonymous said...

export XKL_XMODMAP_DISABLE=1 worked for me - brilliant! thanks

Ross said...

YES! Adding the "export XKL_XMODMAP_DISABLE=1" worked - thanks!

Unknown said...

# in .vnc/xstartup
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1 # the fix
gnome-session &

Excellent worked for me too :)

Javier said...

It works to me too!!! Thanks a lot

:-)

Anonymous said...

Good for macports tightvnc on Mac OS X 10.6.2 to Debian Lenny, too. Thanks!

Unknown said...

me too! thanks.

Rajendra Boppana said...

After incorporating the suggested change i was still facing problem with small 's' and small 'm'. I removed mail and shutdown symbol or shortcuts from right side top corner of the panel and then every thing was working as expected ...

thanks for the help Yuen-Chi Lian ...

Anonymous said...

Solution 2# worked magic for me after a whole week of stress. I owe this forum a bunch. Thanks