X in a chroot

Alexander Leidinger Alexander at Leidinger.net
Wed Mar 2 11:32:21 GMT 2005


John Baldwin <jhb at freebsd.org> wrote:

> On Tuesday 01 March 2005 04:33 pm, Michael D. Harnois wrote:
>> Shut my mouth and call me stupid, but I cannot for the life of me
>> figure out how to run X programs inside a /compat/linux chroot on an
>> amd64. No matter what I try, I get
>>
>> cannot open display: :0

X11 tries to open the display over an unix domain socket. If the server is in
a chroot, then it's in the chroot /tmp dir. You can try to set the DISPLAY
variable to "localhost/tcp:0" or "localhost:0". You X server needs to listen
on TCP connections for this.

> Maybe need to copy or nullfs mount /tmp/.X11-unix and friends into 
> /tmp in the chroot.

A copy doesn't help, since it contains an unix domain socket. Doing a nullfs
mount in the proposed direction helps when a X11 program is run in the
chroot. If the linux program is just started normaly (without calling
chroot(8)), another workaround is to remove /compat/linux/tmp (f it exists),
this way the program should see the FreeBSD /tmp directory instead of
/comapt/linux/tmp.

If the X Server is run in a chroot (and a program not in the chroot has to
connect to it), the nullfs mount has to be the other way around or a symlink
into the chroot should be provided which does the same in this case.

Bye,
Alexander.

-- 
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137
The penalty for laughing in a courtroom is six months in jail; if it
were not for this penalty, the jury would never hear the evidence.
		-- H. L. Mencken




More information about the freebsd-amd64 mailing list