How to start Xorg-server inside plain chroot

chrootx-server

when I runchroot /somepath /usr/bin/startxI got something what looks like an evdev problem… (I correctly –bind mounted /dev/ /dev/pts /dev/shm /proc /sys /tmp )

The screen is displayed and programs run normally, except I got no mouse nor keyboard and I can't switch to a local terminal, forcing me to hard reboot.

What is the cause of this?
Are there any solution to go ahead by making the server run?

Possible steps to reproduce (work on all distributions):

  • copy the root directory of a Linux distribution to a folder of you running distribution.

  • correctly bind mount everything (/dev/pts /var/run /dev/shm /sys/kernel/debugfs…)

  • run a shell with thechrootcommand.

  • Make sure not any X11 server is already running then launchxinit /usr/bin/some X11 program

You can now hard-reboot your computer! (if you didn't set up any remote access)

Best Answer

I realize this question is old, but for reference:

The screen is displayed and programs run normally, except I got no mouse nor keyboard and I can't switch to a local terminal, forcing me to hard reboot.

I correctly --bind mounted /dev/ /dev/pts /dev/shm /proc /sys /tmp

In addition to mounting the above, I also had to bind mount /run/udev to make the mouse and keyboard work in my chroot. I did not use an xorg.conf*, and Xorg was able to correctly detect my settings.

Entry in my /etc/schroot/default/fstab:

/run/udev /run/udev none rw,bind 0 0

If you are doing a standard chroot you could obviously put it in your /etc/fstab instead:

/run/udev /path/to/chroot/run/udev none rw,bind 0 0

...or mount --bind it.


*Well-- I tried using an xorg.conf initially, but it didn't work. I also tried adding

Section "ServerFlags" Option "AutoAddDevices" "false" EndSection in xorg.conf, which made my mouse work, but not the keyboard.

Related Question