You are not logged in.

#51 2014-08-12 19:16:08

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: xorg-server 1.16 issues

Trilby wrote:

However, then the error output is banished never to be seen again.

Right, so about that... I tried to have a look into it, and here's what I ended up with:

Basicaly, when X starts, it tries to determine which tty it is running from. When running from the same as the vt it was asked to run in (i.e. from tty2 with vt02 as argument) it will auto-enable keeptty, which means it won't "detach from its controlling tty", which is rather important since otherwise some ioctl calls would fail with a permission error.
And in fact, when redirecting stderr the error I get is indeed a permission denied for VT_ACTIVATE, and it comes from having detached from the controlling tty. Whereas when I don't redirect, I get in the Xorg.log something that reads "controlling tty is VT number 2, auto-enabling KeepTty"

So here's for a quick workaround so you can start rootless X while still redirecting everything you want: simply specify server option -keeptty


Now as for why this fails, I wish I knew. What I'm seeing is that X will check if STDIN_FILENO, STDOUT_FILENO or STDERR_FILENO (in that order) are a tty. As soon as one is found, it'll use it to compare with the vt it is expected to run on. Now you'd think that stdin is indeed your tty, so that's a match and it should always work. But in fact, what I'm seeing is that only STDERR_FILENO is actually the stderr, which is why it is essential and cannot be redirected to a file.

I'm not sure what's up with the other two though, but if I check fileno(stdin), fileno(stdout) & fileno(stderr) then only the later works (2), the other two return -1, which means invalid stream. What does that actually mean, why it happens, I don't know. But indeed the fstat call on those fd does get some "odd" results, as in it doesn't fail but return info that aren't what you'd expect, e.g. for STDOUT_FILENO I get a socket apparently...

Offline

#52 2014-08-12 19:43:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: xorg-server 1.16 issues

Thanks, this works perfectly (so far):

... && exec xinit -- vt1 -keeptty > ~/.xorg.log 2>&1

(ellipsis for my case statement conditionals)

note: vt1 is used explicitly as one of the conditionals checks which tty it's on.  For a more general case one should, of course, use vt$XDG_VTNR.

Last edited by Trilby (2014-08-12 19:45:08)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#53 2014-08-14 03:13:53

PReP
Member
From: Sweden
Registered: 2010-06-13
Posts: 359
Website

Re: xorg-server 1.16 issues

Stole the trilby intel which was borrowed and derived from jjacky. Thanks smile


. Main: Intel Core i5 6600k @ 4.4 Ghz, 16 GB DDR4 XMP, Gefore GTX 970 (Gainward Phantom) - Arch Linux 64-Bit
. Server: Intel Core i5 2500k @ 3.9 Ghz, 8 GB DDR2-XMP RAM @ 1600 Mhz, Geforce GTX 570 (Gainward Phantom) - Arch Linux 64-Bit
. Body: Estrogen @ 90%, Testestorone @ 10% (Not scientific just out-of-my-guesstimate-brain)

Offline

#54 2014-08-17 14:51:23

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: xorg-server 1.16 issues

So for the record, I believe I figured out the reason of the odd results I observed: both stdin & stdout are actualy closed earlier on, so the code there doesn't do what was meant, except for stderr. I'm not sure how to fix this, but I've opened a bug report upstream: https://bugs.freedesktop.org/show_bug.cgi?id=82732

Offline

#55 2014-08-21 05:12:54

kamocat
Member
Registered: 2014-08-21
Posts: 24

Re: xorg-server 1.16 issues

So, from my understanding, we have a workaround for getting the stdout from Xorg, but we're waiting on a patch to be applied to xorg-server in order to run multiple sessions.
Is this correct?

Offline

#56 2014-08-21 08:29:42

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: xorg-server 1.16 issues

The workaround is to start a rootless X while redirecting stderr; The fix to run more than one rootless X is actually in systemd (logind), and is included in the upcoming 216.

Offline

#57 2014-08-27 04:28:16

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,418
Website

Re: xorg-server 1.16 issues

Well, I've updated to 216 and while there was clearly some change in logind (I had to restart it, else ALSA would complain on missing permissions), I still can't seem to run more than one X server... at least as the same user.

Last edited by Alad (2014-08-27 04:28:49)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#58 2014-08-28 08:33:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: xorg-server 1.16 issues

Did you reboot after the update? How exactly are you starting X and what fails when trying to start the second X server as a user?

Offline

#59 2014-08-28 19:49:34

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,418
Website

Re: xorg-server 1.16 issues

Found out the issue - I was using the xinit -keeptty workaround (which mentioned how X was already in use); with startx and systemd 216 both redirection and multiple instances work fine. smile

edit: after another reboot it seems startx > ~/.xorg.log 2>&1 fails with the same VT_ACTIVATE error.. neutral so you either have redirection -or- multiple instances?

Last edited by Alad (2014-08-28 20:10:24)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#60 2014-08-28 21:09:32

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: xorg-server 1.16 issues

You still need to use -keeptty (e.g. in your ~/.xserverrc) if you want to use redirection of stderr, otherwise you'll get the permission denied error for VT_ACTIVATE.

Offline

#61 2014-08-29 00:57:00

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,418
Website

Re: xorg-server 1.16 issues

startx -- -keeptty > ~/.xorg.log 2>&1

seems to work for both redirection and multiple instances. Thanks jjacky. smile


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#62 2014-09-05 19:20:57

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: xorg-server 1.16 issues

If you start a couple X servers this way you should specify something other than just ~/.xorg.log as the log. What would be the best filename?

alias s="startx -- -keeptty > ~/.xorg-vt$XDG_VTNR-$(date +"%Y-%m-%d-%H:%M:%S").log 2>&1"
$ type s
s is aliased to `startx -- -keeptty > ~/.xorg-vt1-2014-09-05-21:14:06.log 2>&1'

I think it's time to properly fix https://wiki.archlinux.org/index.php/Start_X_at_Login



Does anyone else get a broken console after quiting X? Pressing 'Enter' produces a new prompt but on the same line etc. I have to blindly type 'exit' and re-log to get a usable console.

Offline

#63 2014-09-05 19:30:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: xorg-server 1.16 issues

karol wrote:

Does anyone else get a broken console after quiting X?

Yes.  It's not broken, the standard streams have just been redirected.  Personally I consider this a bug: if a program opts to redirect standard streams, that's fine, but it should reset them when it's done.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#64 2014-09-05 21:13:08

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: xorg-server 1.16 issues

karol wrote:

If you start a couple X servers this way you should specify something other than just ~/.xorg.log as the log. What would be the best filename?

alias s="startx -- -keeptty > ~/.xorg-vt$XDG_VTNR-$(date +"%Y-%m-%d-%H:%M:%S").log 2>&1"
$ type s
s is aliased to `startx -- -keeptty > ~/.xorg-vt1-2014-09-05-21:14:06.log 2>&1'

You want single quotes instead of double quotes when defining the alias, so the expansions are done later.
Personally I'd just use +%s as the date format.


This silver ladybug at line 28...

Offline

#65 2014-09-06 10:35:41

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,418
Website

Re: xorg-server 1.16 issues

Trilby wrote:
karol wrote:

Does anyone else get a broken console after quiting X?

Yes.  It's not broken, the standard streams have just been redirected.  Personally I consider this a bug: if a program opts to redirect standard streams, that's fine, but it should reset them when it's done.

If you put "exec" before startx in your alias, killing X (or exiting your WM) logs you out from the console, if you prefer. You can also return to a usable console by typing "reset".

Re redirection, I've come up with a more complex solution that filters duplicate lines and compresses the log if it gets too large:

http://pastie.org/9533549

should prevent 20 GB logs if things go AWOL.

edit: meh, blocks redirection after the first awk.

Last edited by Alad (2014-09-07 10:24:40)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#66 2014-09-09 12:05:56

tomgg
Member
Registered: 2013-05-01
Posts: 40

Re: xorg-server 1.16 issues

jasonwryan wrote:

...Fix for me:

Jasonwryan, does the rootless X server give you trouble when quitting, say, dwm?^{1} ...I'd elaborate but it would require a whole bunch of mindless rigmarole (reboot included).

--
1. I know that you use dwm.

EDIT; I should've read more that the first 7 posts in the thread.

Last edited by tomgg (2014-09-09 12:06:43)

Offline

#67 2014-09-10 19:06:39

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: xorg-server 1.16 issues

What exactly do you mean? What kind of trouble? Why would explaining require a reboot??

Offline

#68 2014-09-22 00:40:58

tomgg
Member
Registered: 2013-05-01
Posts: 40

Re: xorg-server 1.16 issues

karol wrote:

What exactly do you mean? What kind of trouble? Why would explaining require a reboot??

Sorry, I'd forgotten that this happened---I don't reboot too frequently.

Upon exiting dwm, I'll be issued a repeating sequence of---and I'm paraphrasing; I don't know where this is logged (Where is this logged?)---"sending KILL to all processes", "waiting on X", "could not close X", which doesn't appear to ever end.

Sorry I can't give a clearer picture. I can post that log if you know where it is. Meanwhile, I'll pay a bit more attention next time I replicate the issue, which is only an issue (for me) when I'm playing around with dwm patches.

Offline

#69 2014-09-24 08:01:48

funny
Member
Registered: 2008-01-28
Posts: 44

Re: xorg-server 1.16 issues

Hi, after my last update xserver often shutdown.
I see a error in my Xorg.0.log

 Backtrace:
[ 12121.882] (EE) 0: /usr/bin/Xorg.bin (xorg_backtrace+0x56) [0x593a46]
[ 12121.882] (EE) 1: /usr/bin/Xorg.bin (0x400000+0x197b99) [0x597b99]
[ 12121.882] (EE) 2: /usr/lib/libc.so.6 (0x7f9dfcf5a000+0x339f0) [0x7f9dfcf8d9f0]
[ 12121.882] (EE) 
[ 12121.882] (EE) Segmentation fault at address 0x0
[ 12121.882] (EE) 
Fatal server error:
[ 12121.882] (EE) Caught signal 11 (Segmentation fault). Server aborting

I use 64bit arch and xfce4

Last edited by funny (2014-09-24 08:02:35)

Offline

#70 2014-09-24 08:09:20

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: xorg-server 1.16 issues

@funny, the error message is not very helpful. You should probably open another thread for this, but prepare more background and info, becaue it will be needed for anyone to get a clue where to start.


This silver ladybug at line 28...

Offline

#71 2014-09-24 10:37:26

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: xorg-server 1.16 issues

I think it is related to the message

xorg-server has now the ability to run without root rights with
the help of systemd-logind. xserver will fail to run if not launched
from the same virtual terminal as was used to log in.
Without root rights, log files will be in ~/.local/share/xorg/ directory.
 
Old behavior can be restored through Xorg.wrap config file.
See Xorg.wrap man page (man xorg.wrap).

that we had when we have upgraded xorg-server. For some reason, you are not on a physical console when you use an alias. I guess that it will work if you "restore the old behavior". Even if I am right, it is strange that using an alias or running the command directly can make a difference. What happens if you use a shell script instead of an alias?

Last edited by olive (2014-09-24 10:38:14)

Offline

#72 2014-12-02 03:46:21

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: xorg-server 1.16 issues

Before I mark this as solved, I'd like to check if anyone got a fix or an even better workaround for the broken tty after quiting X: https://bbs.archlinux.org/viewtopic.php … 7#p1453977
I've added '; reset' to my alias:

$ type s
s is aliased to `startx -- -keeptty > ~/temp/.xorg-vt$XDG_VTNR-$(date +"%Y-%m-%d-%H:%M:%S").log 2>&1; reset'

Works for me ...

Offline

#73 2014-12-02 12:23:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: xorg-server 1.16 issues

I don't know when it happened, but this was 'fixed' for my in one of the updates shortly after 1.16.  I can startx/xinit, then when I quite I am back at a working tty.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#74 2014-12-02 12:24:20

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: xorg-server 1.16 issues

How exactly are you starting X? I'm using the alias I posted. Any black magic in your ~/.xinitrc?

Offline

#75 2014-12-02 12:27:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: xorg-server 1.16 issues

Nope.  In my bashrc

if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then
	read -s -n 1 -t 0.25 key
	[[ $? -eq 142 ]] && exec xinit -- vt1 -nolisten tcp
fi

But I will also frequently hit a key to prevent this from running to be able to work in the tty - then I use 'xinit -- vt1' and if/when I exit that session I'm also back at a workting tty.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB