[blfs-support] startx failes to work

Bruce Dubbs bruce.dubbs at gmail.com
Sat Sep 24 09:48:03 PDT 2016

Douglas R. Reno wrote:
> On Sat, Sep 24, 2016 at 2:34 AM, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
>> Thanos Baloukas wrote:
>>> On 23/09/2016 09:21 μμ, Rob wrote:
>>>> BLFS-7.10 Systemd
>>>> We're now in the section of Chapter 24 called
>>>> Testing Xorg
>>>> When I tried running
>>>> startx
>>>> I got a lot of messages, but it basically said at the end:
>>>> Fatal server error:
>>>> (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
>>>> I thought adding my normal user to the
>>>> video
>>>> group would have fixed that. Was I wrong?
>>>> Thank you all for the help.
>>>> That possibly happens because Xorg wants to start on tty0
>>> while you login on another tty. If systemd is compiled with
>>> pam it sets the XDG_VTNR var to the tty number the login occurs,
>>> otherwise I think sets tty var to /dev/ttyn
>>> To force Xorg to start on the tty you are on try
>>> startx -- -vt<tty number>
>>> To make that permanent put in ~/.xserverrc
>>> #!/bin/sh
>>> exec /usr/bin/Xorg -nolisten tcp "$@" vt<$XDG_VTNR or ${tty#/dev/tty} or a
>>> tty number>
>>> and run plain startx
>> In xinit, we make a change so that Xorg starts up on the first unused
>> terminal, usually vt7.  See the seds on that page.
>> I do not know if systemd modifies the startx script command or not, but I
>> doubt it since Xorg is installed after systemd.
>> I have never had to modify ~/.xserverrc.  That file does not even exist on
>> my systems.
>> Make sure the PATH is set properly so xauth is found.  On debugging
>> technique is to edit /opt/xorg/bin/startx.  At the bottom is the line:
>> xinit "$client" $clientargs -- "$server" $display $serverargs
>> copy that line and on the first copy add echo to the front to see what it
>> is really executing.  It may also be useful to redirect the output of that
>> echo to something like /tmp/xinit.debug.  If you followed the BLFS
>> instructions, the $display variable should be vt7.
>> The whole line will probably be something like:
>> xinit xterm -- /opt/xorg/bin/X vt7
>> Note that the screen normally comes up black in twm with some xterms.  You
>> have to click the mouse sometimes to see the cursor.  Also, make sure you
>> run ldconfig so libraries can be found after installation.

> Has anyone actually had success with those seds? They cause me nothing but
> problems. I've never once gotten X to launch with it in there. I've always
> had to remove it from my build scripts, otherwise I get a similar problem.
> We normally have users rebuild systemd with logind support as part of X
> server. I wonder if that sed causes an incompatibility there. With logind
> enabled, systemd controls who owns what DRI devices and what TTY's they are
> available on. That being said, I wonder if X doesn't have privileges to
> claim the TTY device.

The sed only changes three characters.  Ther original script has:

if [ "$have_vtarg" = "no" ]; then
     serverargs="$serverargs $vtarg"

The sed inserts ': "' (colon-space-hash) at the beginning of the 
serverargs line (on my system, line 137).

This may well be a problem for systemd as there is a comment in the startx 

     # When starting the defaultserver start X on the current tty to avoid
     # the startx session being seen as inactive:
     # "https://bugzilla.redhat.com/show_bug.cgi?id=806491"

It looks like the sed should be marked sysv only.

Douglas, if you do that, please fix the note that refers to 
/usr/bin/startx.  It should be $XORG_PREFIX/bin/startx.

   -- Bruce

More information about the blfs-support mailing list