Xorg 6.8.1: can't switch VT or resolution (partially solved)

Glynn Clements glynn.clements at virgin.net
Wed Oct 20 10:21:06 PDT 2004


Corey Hickey wrote:

> =========first question=========
> I tried using
> setxkbmap -layout us -model microsoft -rules xorg
> 
> ...before I ended up using
> setxkbmap -print | xkbcomp - :1.0
> 
> ...but I can't make that work in xorg. If I run it straight from a
> terminal emulator, it reports:
> Error loading new keyboard description
> 
> ...and the vt from which I started xorg says:
> /usr/local/X11R6.8/lib/X11/xkb/xkbcomp: error while loading shared
> libraries: libxkbfile.so.1: cannot open shared object file: No such file
> or directory
> 
> I gather that setxkbmap uses xkbcomp, and that LD_LIBRARY_PATH is lost
> before xkbcomp is called. If I run xkbcomp directly from xinitrc (with
> LD_LIBRARY_PATH set) it doesn't have a problem. Nor is there a problem
> when I run it directly from a terminal emulator.
> 
> Why does this happen? Neither setxkbmap nor xkbcomp are setuid/setgid.
> Is this something particular to setxkbmap or will I run into problems
> with other programs doing the same thing?

	$ sudo strings /usr/X11R6/bin/XFree86 | fgrep xkbcomp
	xkbcompat
	"Errors from xkbcomp are not fatal to the X server"
	"The XKEYBOARD keymap compiler (xkbcomp) reports:"
	xkbcomp -w %d -xkm - -em1 %s -emp %s -eml %s "%s%s.xkm"
	%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s "%s%s.xkm"
	%s/xkbcomp -w %d -R%s -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm
	xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm
	%s/xkbcomp -R%s/%s -w %ld -l -vlfhpR '%s'
	xkbcomp -R%s -w %ld -l -vlfhpR '%s'
	xkbcomp returned exit code %d

This suggests that the X server is running xkbcomp itself. That
tallies with the fact that the error message is being dumped to the VT
from which the X server was started.

To get this to work in general, there would need to be some way to
have the X server set LD_LIBRARY_PATH itself. I don't know if that's
possible. If it isn't, then any programs which are spawned by the X
server itself will run into this problem.

One possible solution for this specific case is to rename the xkbcomp
executable, and replace it with a script which re-sets LD_LIBRARY_PATH
before running the original executable.

> ==========second question==========
> I had some trouble earlier because I was using:
> setxkbmap -print | xkbcomp - $DISPLAY
> 
> ...in my xinitrc. It actually seems that $DISPLAY is not set until
> later; I suppose this is xinit's fault, but does anyone know exactly
> when $DISPLAY is set? I'm just curious.

$DISPLAY *should* be set for the xinitrc script, otherwise none of the
clients which are started in that script will work. Environment
variables are passed down from parent to child; if it isn't set in the
parent (i.e. xinitrc), it won't be set in the child, and nothing which
xinit does subsequently will change that.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the xorg mailing list