Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I start up Xephyr inside of X, my keyboard map becomes wonky mostly just for non-printing characters. I can't use arrow keys. According to xev, The down arrow gets mapped to Super_R. The up arrow is Print Screen. PgDown is mapped to "Menu". My keyboard works fine in the original X display (:0), but in the Xephyr subdisplay (:1), nothing else quite works right.

I don't have any funky xmodmap things going on in my main X display that I'm aware of. All I really do is setxkbmap -option ctrl:swapcaps.

You're not using SSH, right? Or in other words: you're using the exact same keyboard and X server with Xephyr like you use without it? And any better results when using the older Xnest? I don't know how that knowledge will help you, but maybe it does. ;-) –  Arjan Nov 14 '09 at 18:17
Yep. no ssh. Same keyboard and server. I'll try Xnest. –  qedi Nov 14 '09 at 22:02
Xnest did the same thing, but at least it pointed me to the solution. –  qedi Nov 14 '09 at 22:24

6 Answers 6

up vote 4 down vote accepted

I found Bug 19365 which solved my problem:

Starting Xnest / Xephyr with -kb.

And no more need for xmodmap either, I hope? Good find! –  Arjan Nov 14 '09 at 22:28
(I think you can accept your own answer after 48 hours? Please come back to do so. Thanks!) –  Arjan Nov 14 '09 at 22:29

You can also run xkbcomp $DISPLAY :1 in X session in which Xephyr was started. This command will copy keyboard map from current server to your newly created. I use it like this:

Xephyr -screen 800x600 :1 > /dev/null &
sleep 2 && xkbcomp $DISPLAY :1
DISPLAY=":1" ./runcommand

It seems you're not using SSH for this, right? Still, the following might get you started; it's what I scribbled down to troubleshoot keyboard issues when using ssh -Y:

You can save the current keyboard mapping (when not running Xephyr) using:

xmodmap -pke > ~/my_xmodmap

Then, in Xephyr, you could try to explicitly load that:

xmodmap ~/my_xmodmap

And using xev you can monitor keyboard events. That probably won't help much by itself, but might help you Googling more helpful articles as that command is sometimes mentioned in such articles.

That makes some other keys work, but not all. xev claims, for example that the keypad slash is XF86_Ungrab, not KP_Divide as it is defined in the xmodmap file I've dumped and used. –  qedi Nov 14 '09 at 17:25

The -kb option doesn't work in Ubuntu 10.04. Here's what worked for me:

Xephyr -keybd ephyr,,,xkbmodel=evdev -ac -screen 800x600 -br -reset -terminate :1


For me (using german keyboard), it only works the combination of the previous solution pointed by Arjan together with the solution pointed by panzi in Xephyr keyboard layout, that is:

Start Xephyr:

Xephyr -keybd ephyr,,,xkbmodel=evdev,xkblayout=de -ac -reset -screen 800x600 -retro :1 &

Save current keyboard mapping and start an xterm loading the mapping:

xmodmap -pke > /tmp/my_modmap ; xterm -display :1 -ls -e "xmodmap /tmp/my_modmap; bash" &

Xephyr server: xserver-xephyr 2:1.9.5-1

Thanks to the original posters!

I found a better solution: see my other answer to this question. –  Alberto Apr 21 '11 at 8:18

After more unsuccessful googling, man setxkbmap finally pointed me into an easier solution:

USING WITH xkbcomp

If you have an Xserver and a client shell running on different computers and XKB configuration files on those machines are different you can get problems specifying a keyboard map by model, layout, options names.[...] You can solve this problem by running the xkbcomp on the client side too.[..] For example, the command

setxkbmap us -print | xkbcomp - $DISPLAY

makes both steps run on the same (client) machine and loads a keyboard map into the server.

That is,

  • launch Xephyr:

    Xephyr -ac -reset -screen 800x600 -retro :50 &

    (no need to provide keyboard info)

  • and configure the new xsession:

    setxkbmap de -print | xkbcomp - :50

    (you need to know your keyboard layout)

Note: setxkbmap is your friend, and from version 1.2.0 the useful -query option is available to help you troubleshooting your keyboard (see the corresponding patch log).

In this answer I indicate how to launch Xephyr to have it properly configured. –  Alberto Apr 21 '11 at 8:17

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .