You are not logged in.
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
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
Stole the trilby intel which was borrowed and derived from jjacky. Thanks
. 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
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
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
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
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
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.
edit: after another reboot it seems startx > ~/.xorg.log 2>&1 fails with the same VT_ACTIVATE error.. 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
startx -- -keeptty > ~/.xorg.log 2>&1
seems to work for both redirection and multiple instances. Thanks jjacky.
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline
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
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
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
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:
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
...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
What exactly do you mean? What kind of trouble? Why would explaining require a reboot??
Offline
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
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
@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
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
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
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
How exactly are you starting X? I'm using the alias I posted. Any black magic in your ~/.xinitrc?
Offline
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