Desired result on a server without root:
1) Run Xvfb
without input devices, or
2) Just get Xvfb
to run
Background:
I have two machines both having nearly identical builds of CentOS. One machine has root access and internet and the other is sandboxed (no root access) with no package managers (no yum) and no Xserver. I'm trying to get Xvfb
(X virtual frame buffer) running in the target machine for experimenting with headless firefox. When Xvfb
is working, I can use xvfb-run
.
What I've tried:
I've successfully transferred the Xvfb
binary and the user shared libraries using this method (see the comment below the answer). I'm able to run Xvfb
like so
Xvfb :1 -nolisten tcp -screen 0 1680x1050x16
but then I get a keymap error (Aside: I'd also like to deal with that temp dir issue as I've set export TMPDIR=~/tmp
):
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
(EE)
Fatal server error:
(EE) Failed to activate core devices.(EE)
I don't need physical keyboard or mouse support at all. If someone could explain how to run Xvfb
without input devices, then we can stop here. I've searched for hours with no success.
How I tried to get xkb working:
My next action was to bring over xkbcomp
from the source machine along with the shared libraries. Next I exported the keymap file from the source machine like so:
xkbcomp -xkb $DISPLAY xkbmap
I tried to pass in the xkbdir
and xkbmap
to run the following with no success
Xvfb :1 -xkbdir ~/X11/xkb -xkbmap xkbmap -nolisten tcp -screen 0 1680x1050x16
because -xkbdir
is a valid parameter, whereas -xkbmap
is not despite the man page for Xvfb stating:
In addition to the normal server options described in the Xserver(1) manual page, Xvfb accepts the following command line switches:
and the man page for Xserver stating:
−xkbdir directory
base directory for keyboard layout files. This option is not available for setuid X servers (i.e., when the X server’s real and effective uids are different).
...
−xkbmap filename
loads keyboard description in filename on server startup.
If I just pass in -xkbdir
$ export PATH=~/bin:$PATH; # all copied binaries are here, including xkbcomp
$ Xvfb :1 -xkbdir ~/X11/xkb -nolisten tcp -screen 0 1680x1050x16
then I get
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root
sh: /usr/bin/xkbcomp: No such file or directory <-- WHY THIS PATH?
sh: /usr/bin/xkbcomp: No such file or directory
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
(EE)
Fatal server error:
(EE) Failed to activate core devices.(EE)
This is where I've been stuck for hours. On a machine without root, either
1) How can I run Xvfb
without input devices? or
2) How can I just get Xvfb
to run?
Xvfb
as user under Debian withXvfb :1 -screen 0 640x480x24 -nolisten tcp
on my desktop (of course with another X server as main display). No complaints about xkbd, and the owner of/tmp/.X11-unix
is root (because of the first server). So one guess is that you might be missing some necessary files./usr/bin/xkbcomp
is a binary that compiles keymap description files. Those files are in/usr/share/X11/xkb
on my system.strings
onXvfb
shows%s%sxkbcomp" -w %d %s -xkm "%s" -em1 %s -emp %s -eml %s "%s%s.xkm
, so there is some way to set the path (and that path appears to be hardwired). There's also a string/usr/share/X11/xkb
.XkbBinDirectory
in xkbInit.c. Though there seem to be patches that fix this. It depends on what CentOS does, I guess. The quickest option may be to patch the Xvfb binary with your path.RunXkbComp
inddxLoad.c
, and I don't see anything to change that path. So, patch path in the binary, install a fake xkbcomp binary first that shows you the arguments, then install the necessary keymap files.