Earnestly / sx

Start an xorg server
MIT License
231 stars 16 forks source link

Can't suppress both stdout and stderr #27

Closed Barbaross93 closed 2 years ago

Barbaross93 commented 2 years ago

As the title says, attempting to suppress both stdout and stderr causes X to never launch. If I only suppress one of the two, sx is able to launch Xorg fine.

Earnestly commented 2 years ago

Try setting allow_users to anybody in /etc/X11/Xwrapper.confg.

I vaguely remember this happening to me once before even while using startx (e.g. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=801529) when I was attempting to redirect stdout and stderr to a logger.

It may also be an issue with the version of Xorg that you are using as the bug report notes. Otherwise check your ~/.local/share/xorg/Xorg.$n.log for any indication.

Barbaross93 commented 2 years ago

Unfortunately setting allow_users to anybody seems to have no effect. I am able to redirect stdout and stderr with &>/dev/null using startx. I can't quite determine the Xorg version used in the bug report (1:7.7+12?), but I am using xinit 1.4.1 and sx 2.1.7 on void linux.

Earnestly commented 2 years ago

I'm using X.Org X Server 1.20.13 and can't reproduce this issue. It even have something to do with logind, you'll have to look at the logs.

Barbaross93 commented 2 years ago

I am also using xorg-xserver 1.20.13. Since I don't have systemd, I do not have logind or elogind currently. Do I need to try with elogind then?

Earnestly commented 2 years ago

Look at the server logs

Barbaross93 commented 2 years ago

When I run with exec sx &>~/.local/share/xorg/x.log I get this line in x.log:

/usr/libexec/Xorg.wrap: Only console users are allowed to run the X server
Barbaross93 commented 2 years ago

With a bit of google-fu, it turns out that adding allowed_users = anybody rather than just allow_users = anybody solves my issue. Apparently this will cause problems if multiple people try to login to the same X session, but for a single user setup, this shouldn't be an issue. Thanks for the help.

Earnestly commented 2 years ago

Why would setting allow_users to anyone not help if the error message returned by Xorg.wrap is telling you that it's attempting to run as a console user?

The server log if running as root would be written to /var/log/Xorg.$n.log.

Edit: I see, it's allowed_users and not allow_users.

Barbaross93 commented 2 years ago

Because allow_users isn't a real setting. allowed_users (with emphasis on the ed) is a legitimate setting. I'm also not running X as root by setting needs_root_rights = auto in my /etc/X11/Xwrapper.config

Barbaross93 commented 2 years ago

Ah woops, just saw that you edited your response. Sorry to redundantly explain. I do think it odd that I can't redirect both stdout and stderr as the console user. Maybe I'll tinker with the Xwrapper.config settings to see if any other combo besides allowing root works.

EDIT: Fun fact, an Xwrapper.config with:

allowed_users = anybody
needs_root_rights = no

also works

Earnestly commented 2 years ago

Yes, that is what I've ended up using over the years. I've forgotten the details as to why