Apart from my default X server, which I run on tty1, I would like to start another one from within a linux container.

On tty2 (Ctrl+Alt+F2) I log in, then run sudo lxc-start -n c --foreground.

Then, from within the container I execute DISPLAY=:2 startx -- :2, getting these messages/errors:

_XSERVTransSocketCreateListener: failed to bind listener            
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed                                                                   
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for unix                                                               

X.Org X Server 1.19.5                                               
Release Date: 2017-10-12          
X Protocol Version 11, Revision 0                                   
Build Operating System: Linux 4.9.54-1-lts x86_64                   
Current Operating System: Linux c 4.13.12-1-ARCH #1 SMP PREEMPT Wed Nov 8 11:54:06 CET 2017 x86_64                             
Kernel command line: BOOT_IMAGE=../vmlinuz-linux root=/dev/sda1 rw 
Build Date: 12 October 2017  09:59:53PM

Current version of pixman: 0.34.0
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.2.log", Time: Mon Dec  4 16:22:11 2017
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)
Please consult the The X.Org Foundation support
         at http://wiki.x.org
 for help.
(EE) Please also check the log file at "/var/log/Xorg.2.log" for additional information.
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Couldn't get a file descriptor referring to the console

(Note that it refers to /dev/tty0)

How can I run a containers X server (on a separate tty)?

  • 1
    I did some tries to run Xorg in docker some time ago. IIRC it was important to add capabilities TTY_CONFIG and SYS_RAWIO. Also I had to share some device files for keyboard and mouse and at least one tty. For mouse and keyboard, I had to create an xorg.conf. I got it mostly to work, but could not switch back with CTRL+ALT+Fn. After hard-rebooting my system several times checking this out, I gave up. Some on this topic you can read here: github.com/mviereck/x11docker/issues/7 – mviereck Dec 5 '17 at 19:38
  • 1
    If you are interested in running GUI apps in containers, have a look at x11docker. Though, it does not run X itself in a container. – mviereck Dec 6 '17 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.