I want to start an Xorg server (which should only feature a minimal xterm
terminal emulator from a newly created "pristine" tty
). I have thought this to be as simple as issuing a xinit
or maybe a startx
however both have failed me. Therefore the question:
How to manually run/init/start a Xorg server on a different VT/TTY?
here the
Longer background story to the question at hand:
This is the backgroud and what I have tried already:
Looking at man openvt
I was able to run a shell on a newly created tty
(or vt
, cannot tell precisly the different vt<>tty) like this:
$> sudo openvt -s /bin/bash
the -s
of causes the direct switch to that new tty/vt
on that new tty I wanted to manually start a Xorg
server which according to man xinit
should start with a minimal xterm
application. On the new shell on the switched to tty I (created via openvt
) I hence issues this command:
$> su -c 'xinit xterm -display :4 -- :4' - mahr &>/tmp/output
and I receive this output
$> cat /tmp/output
X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-148-generic x86_64 Ubuntu
Current Operating System: Linux scitech 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-4.15.0-70-generic root=/dev/mapper/ubuntu--vg-root ro
Build Date: 03 June 2019 08:10:35AM
xorg-server 2:1.19.6-1ubuntu4.3 (For technical support please see http://www.ubuntu.com/support)
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: "/home/mahr/.local/share/xorg/Xorg.4.log", Time: Thu Nov 28 10:57:53 2019
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
(EE)
Fatal server error:
(EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/home/mahr/.local/share/xorg/Xorg.4.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
Session terminated, terminating shell...xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: unexpected signal 2
...terminated.
Best Answer
by my test, your commands will work well if you put this 2 lines in /etc/X11/Xwrapper.config :
it seems that X server starting is by default allowed only to user that is the owner of target virtual terminal and physically (keyboard) connected to it. (your case: root is vt-owner, and x tried to run as 'mahr').
This two lines overrides that request, and makes even possible starting all from one command, one terminal (useful for init scripts or remote x starting with ssh).