Re: [DNG] [ASCII][PATCH] startx to a new tty
Steve Litt il 18-09-18 00:29:59 ha scritto: > Your idea merits more research. The "we must cover every corner case" > crowd can use startx in its Redhat-diminished state, while people like > us use a <20 line shellscript. Perhaps call it viverna. I call it "ax" (acronym for Avvia (italian word for starts) X). At first I wrote "ax" because I liked change WM/DE very often. I like lxde and openbox but I used gnome2 (in the past) and I use rarely kde and play with other WM/DE. Change .xinitrc is easy but not immediate and I developed several years ago a personal shell script. So when I want run lxde: ax lxde when I want run openbox: ax openbox... and so on. Almost a year ago I rewrite this shell script to be suitable for distribution, I will be happy if it may be useful for someone: https://notabug.org/viverna/ax Execute: ax [your_favorite_wmde] for example: ax lxde ax kde ax without parameters run last WM/DE or the default. ax understands WM/DE reading $ETCPREFIX/etc/ax/client (for me $ETCPREFIX is /usr/local). "client" file has a very simple syntax: NAME_WMDE NAME_EXECUTABLE MULTIPLE_ARGS_EXECUTABLE for example: https://notabug.org/viverna/ax/src/master/etc/client usage: https://notabug.org/viverna/ax/src/master/USAGE.txt xinit args are the output of args.sh file in $ETCPREFIX/etc/ax/ I use everyday and works well but it is my personal case and it needs more tests. -- viverna ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
On Mon, 17 Sep 2018 23:53:39 +0200 viverna wrote: > Steve Litt il 16-09-18 22:21:11 ha > scritto: > > Then here's a solution that bridges all the options: Release Dario's > > version of startx under some other name, so that Gnome/KDE people > > can still have their "features", and everyone else can have X that > > works and leaves the system in good shape when it terminates. Put > > it in the same package that startx comes in. Just use Dario's patch > > to make it, each time Debian changes startx. > Good solution. But I think Dario's solution should be the > default. > Another possibility is don't use startx and execute xinit from a > personal shell script and (fine grained) control all parameters > passed to xinit. This is my approach. If you are interested I write a > simple shell script and I will be happy if it may be useful for > someone. > The shellscript calling xinit was my first thought. Then I put startx in an editor. It does a WHOLE LOT of stuff I don't have the knowledge to recreate. It's 200 lines of bash, for gosh sakes. So, trying to prove your xinit idea couldn't possibly work, I did the following: xinit -- :8 Of course nothing that simplistic would work. Oops, it came right up in Openbox, same as my normal startx initiated vt7. Dmenu worked, gnumeric worked, Chromium didn't because it started itself in vt7 instead of vt8, but you usually have only one X at a time. Your idea merits more research. The "we must cover every corner case" crowd can use startx in its Redhat-diminished state, while people like us use a <20 line shellscript. Perhaps call it viverna. SteveT Steve Litt September 2018 featured book: Quit Joblessness: Start Your Own Business http://www.troubleshooters.com/startbiz ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
Steve Litt il 16-09-18 22:21:11 ha scritto: > Then here's a solution that bridges all the options: Release Dario's > version of startx under some other name, so that Gnome/KDE people can > still have their "features", and everyone else can have X that works > and leaves the system in good shape when it terminates. Put it in the > same package that startx comes in. Just use Dario's patch to make it, > each time Debian changes startx. Good solution. But I think Dario's solution should be the default. Another possibility is don't use startx and execute xinit from a personal shell script and (fine grained) control all parameters passed to xinit. This is my approach. If you are interested I write a simple shell script and I will be happy if it may be useful for someone. -- viverna ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
Hi Dario, On Sun, Sep 16, 2018 at 09:35:52PM +0200, Dario Niedermann wrote: > Il 16/09/2018 alle 18:43, Andreas Messer ha scritto: ddd> > I see. Anyway I strongly doubt that any DE relies on startx internally: > it's a shell script that's intended to provide a convenient user > interface to console users who want to spawn an X session. Yes a DE does not care how the X-server was started - by startx, by a display manager or something else. But startx can of course start a DE like KDE. And KDE depends on session management - at least some of its functionality. And for that to work properly, the session associated with KDE needs to be "active". > Also note that startx will *always* run X as root, even the stock Devuan > version. My patch doesn't change that. The 'needs_root_rights' variable As far as I understand this only happens when xserver-xorg-legacy package is installed. If this package is not installed, X will never run as root. > I add to 'Xwrapper.config' is only there for Xwrapper (a short lived > program called by startx) to be able to allocate a new tty. After which > it spawns X and quits. Manualpage of Xorg.wrap says something different. My understanding is, that for example using DRI - which actually means using a modern graphics card at all - either requires root permissions of the x server or a working session management. (Session management daemon will adjust permissions such that DRI is available to non-root) > With the stock RedHat-derived version, instead, a new tty is not > allocated: the current tty is taken over by X when you issue startx. > After X quits, the current tty is released, but is now owned by root > (no longer by your user). Which is not the way the XFree86 / Xorg > devs intended startx to work. I dont know much about that. My feeling about this is, that it is something which can not really be solved to fit all needs. From my point, there are two ways: Either have a working session management with running X without root permission or having no session management and running X as root. In the later case, X should have its own tty allocated indeed. So the decision if a new tty shall be allocated actually corellates to if X is running as root or not. Since only Xorg.wrap knows finally if it will run X with root permission or not, its the first place for me were modifications need to be made. Maybe the whole combination of startx/xinit/Xorg.wrap needs adjustments. Both affected packets (xinit, xserver-xorg-legacy) are currently taken unchanged from Debian. So if we were to modify them, forks of these packages have to be created in Devuan package git repos. There we can put the modifications for test and possible future integration. Decision on that is not mine. @Dario: If you want to see this changed, I'd like to encourage you to create an account on Devuan git and just start to work on this topic. cheers, Andreas signature.asc Description: PGP signature ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
On Sun, 16 Sep 2018 18:43:12 +0200 Andreas Messer wrote: > Hi Dario, > > On Sun, Sep 16, 2018 at 10:59:52AM +0200, Dario Niedermann wrote: > > Il 16/09/2018 alle 10:01, Andreas Messer ha scritto: > > > > [...] > > In short: their addition was a kludge, 100% due to systemd: the only > > thing that was causing problems for them, with the X session being > > seen as "inactive", was systemd's logind component. > > Thanks for pointing that out. Unfortunately, many DEs have hopped on > the systemd train and therefore depend on its services. In particular, > the missing logind was the main barrier to have DEs like Gnome or KDE > fully working on Devuan. Last I heard we weren't even trying to get Gnome working on Devuan, because it was too ententicalated with systemd. > With fully working I refer to how standard > users would expected an desktop environment to behave. > > Therefor elogind was added to Devuan as a replacement for systemd's > logind. But actually elogind is just the logind component from > systemd mangled to run standalone. I expect it to show almost the > same behavior like the original one. > > > So, Devuan's stock startx is running code that's only there to > > accommodate systemd, and causes incorrect/non-traditional behaviour > > on a systemd-less OS. > > If we were to provide a modified version startx, we have to consider > constraints pointed out above. I'm not sure if /usr/bin/startx is > part of a packet currently manged/modified by Devuan at all. > (Most packets are original Debian ones, without any modification) Then here's a solution that bridges all the options: Release Dario's version of startx under some other name, so that Gnome/KDE people can still have their "features", and everyone else can have X that works and leaves the system in good shape when it terminates. Put it in the same package that startx comes in. Just use Dario's patch to make it, each time Debian changes startx. SteveT Steve Litt September 2018 featured book: Quit Joblessness: Start Your Own Business http://www.troubleshooters.com/startbiz ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
Il 16/09/2018 alle 18:43, Andreas Messer ha scritto: > Thanks for pointing that out. Unfortunately, many DEs have hopped on > the systemd train and therefore depend on its services. In particular, > the missing logind was the main barrier to have DEs like Gnome or KDE > fully working on Devuan. With fully working I refer to how standard users > would expected an desktop environment to behave. > > Therefor elogind was added to Devuan as a replacement for systemd's > logind. But actually elogind is just the logind component from systemd > mangled to run standalone. I expect it to show almost the same > behavior like the original one. I see. Anyway I strongly doubt that any DE relies on startx internally: it's a shell script that's intended to provide a convenient user interface to console users who want to spawn an X session. Also note that startx will *always* run X as root, even the stock Devuan version. My patch doesn't change that. The 'needs_root_rights' variable I add to 'Xwrapper.config' is only there for Xwrapper (a short lived program called by startx) to be able to allocate a new tty. After which it spawns X and quits. With the stock RedHat-derived version, instead, a new tty is not allocated: the current tty is taken over by X when you issue startx. After X quits, the current tty is released, but is now owned by root (no longer by your user). Which is not the way the XFree86 / Xorg devs intended startx to work. Later, -- Dario Niedermann. Also on the Internet at: gopher://darioniedermann.it/ <> https://www.darioniedermann.it/ ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
Hi Dario, On Sun, Sep 16, 2018 at 10:59:52AM +0200, Dario Niedermann wrote: > Il 16/09/2018 alle 10:01, Andreas Messer ha scritto: > > [...] > In short: their addition was a kludge, 100% due to systemd: the only > thing that was causing problems for them, with the X session being seen > as "inactive", was systemd's logind component. Thanks for pointing that out. Unfortunately, many DEs have hopped on the systemd train and therefore depend on its services. In particular, the missing logind was the main barrier to have DEs like Gnome or KDE fully working on Devuan. With fully working I refer to how standard users would expected an desktop environment to behave. Therefor elogind was added to Devuan as a replacement for systemd's logind. But actually elogind is just the logind component from systemd mangled to run standalone. I expect it to show almost the same behavior like the original one. > So, Devuan's stock startx is running code that's only there to > accommodate systemd, and causes incorrect/non-traditional behaviour > on a systemd-less OS. If we were to provide a modified version startx, we have to consider constraints pointed out above. I'm not sure if /usr/bin/startx is part of a packet currently manged/modified by Devuan at all. (Most packets are original Debian ones, without any modification) cheers, Andreas -- gnuPG keyid: 8C2BAF51 fingerprint: 28EE 8438 E688 D992 3661 C753 90B3 BAAA 8C2B AF51 signature.asc Description: PGP signature ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
Il 16/09/2018 alle 10:01, Andreas Messer ha scritto: > Well, this is not really a Devuan Problem. It is more likely related > to session management present in most modern linux distros. [...] > As indicated with one of your links, this "keep-tty" stuff was introduced > to properly handle session management. Without the X-Session from "startx" > will considered "inactive" by session management and in turn several things > wont work as expected. E.g. udisks based mounting of Filessystems - This > covers for example Plug and Play use of USB-Sticks. Hi Andreas, if you follow the link in the patch* you can read the whole discussion that took place at RedHat, and led to their _adding_ the 5 lines to startx that my patch is deactivating. In short: their addition was a kludge, 100% due to systemd: the only thing that was causing problems for them, with the X session being seen as "inactive", was systemd's logind component. So, Devuan's stock startx is running code that's only there to accommodate systemd, and causes incorrect/non-traditional behaviour on a systemd-less OS. * https://bugzilla.redhat.com/show_bug.cgi?id=806491 -- Dario Niedermann. Also on the Internet at: gopher://darioniedermann.it/ <> https://www.darioniedermann.it/ ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] [ASCII][PATCH] startx to a new tty
Hello Dario, On Wed, Sep 12, 2018 at 03:28:23PM +0200, Dario Niedermann wrote: > Hello! After trying Devuan ASCII, I noticed a problem with `startx' that > I never had before: the X server occupies the same tty where `startx' > was issued. It should allocate the first unused tty instead > (default: tty07). Well, this is not really a Devuan Problem. It is more likely related to session management present in most modern linux distros. > === Why it is a problem === > > Once you quit X, the tty is no longer owned by you, but by root. > If, for example, you try to reattach to a `screen' session, > that will fail. Also, losing a logged-in tty during the X11 session > can be inconvenient. This can only happen when running X as root. But with new session management, X normally does not with root permissions. > [...] > The added conditional was copied from another systemd-less distro > (VoidLinux, possibly it got there from somewhere upstream). > I also comment out a '-keeptty' option that was in the Devuan version > (but those lines are no longer being executed anyway). The point here is, Devuan has also session management. Its based on elogind or consolekit. It should not be tested for presence of some directories, it should be tested if session is registered with one of the session management services. And it should be tested if x will be running with root permissions. > The Devuan 'Xwrapper.config' file wasn't setting the 'needs_root_rights' > variable. So, the patched `startx' would lack permission to allocate > the first available tty, and it would fail - except when issued by root. This is a site specific configuration. Its matter of site admin to decide on this. From (Devuan) maintainers view, the setting should be the least permissive one. As indicated with one of your links, this "keep-tty" stuff was introduced to properly handle session management. Without the X-Session from "startx" will considered "inactive" by session management and in turn several things wont work as expected. E.g. udisks based mounting of Filessystems - This covers for example Plug and Play use of USB-Sticks. If you like to use your system like that, you're free to do so, but the expectation of other Devuan users might be different. Not all of them are advanced Linux users, they just want use it. cheers, Andreas -- gnuPG keyid: 8C2BAF51 fingerprint: 28EE 8438 E688 D992 3661 C753 90B3 BAAA 8C2B AF51 signature.asc Description: PGP signature ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
[DNG] [ASCII][PATCH] startx to a new tty
Hello! After trying Devuan ASCII, I noticed a problem with `startx' that I never had before: the X server occupies the same tty where `startx' was issued. It should allocate the first unused tty instead (default: tty07). Now, if you have no problem with that, you may disregard the rest of this message. If it's not even happening to you, I'd be interested in comparing notes. === Why it is a problem === Once you quit X, the tty is no longer owned by you, but by root. If, for example, you try to reattach to a `screen' session, that will fail. Also, losing a logged-in tty during the X11 session can be inconvenient. === Origin === It might be that the `startx' script -- and possibly the 'Xwrapper.config' file -- were altered upstream, taking for granted the presence of systemd. The following patch changes these 2 files as needed, in order for `startx' to work correctly and traditionally, without systemd. VvvP:A:T:C:H===F:O:L:L:O:W:S**T:H:I:S===S:I:D:E===U:P=== -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message devuan-startx-newtty patch by 12-Sep-2018 === How to apply this patch === # cd / && patch -p1 < /path/to/devuan-startx-newtty.patch There is no need to trim any text, before or within the patch itself: the `patch' program knows what to skip. === Part 1 === A conditional is added to `startx' to check for the presence of systemd. If the conditional fails, the nested block will not be executed. On Devuan, that amounts to removing the 5 lines now encased in the conditional. Those lines were responsible for passing `xinit' (and in turn `Xorg') a 'vt' option followed by the current tty number. We must avoid that, if we want a new tty. The added conditional was copied from another systemd-less distro (VoidLinux, possibly it got there from somewhere upstream). I also comment out a '-keeptty' option that was in the Devuan version (but those lines are no longer being executed anyway). --- /usr/bin/startx.orig2015-10-19 03:54:32.0 +0200 +++ /usr/bin/startx 2018-09-11 21:18:14.812510159 +0200 @@ -104,10 +104,12 @@ # 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"; -tty=$(tty) -if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then -tty_num=$(echo "$tty" | grep -oE '[0-9]+$') -vtarg="vt$tty_num -keeptty" +if [ -x /usr/lib/systemd/systemd -o -x /lib/systemd/systemd ]; then + tty=$(tty) + if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then + tty_num=$(echo "$tty" | grep -oE '[0-9]+$') + vtarg="vt$tty_num" # -keeptty" + fi fi === Part 2 === The Devuan 'Xwrapper.config' file wasn't setting the 'needs_root_rights' variable. So, the patched `startx' would lack permission to allocate the first available tty, and it would fail - except when issued by root. --- /etc/X11/Xwrapper.config.orig2018-09-09 07:46:44.216064832 +0200 +++ /etc/X11/Xwrapper.config 2018-09-11 22:38:43.086092849 +0200 @@ -13,3 +13,4 @@ # again, run the following command as root: # dpkg-reconfigure xserver-xorg-legacy allowed_users=console +needs_root_rights = yes -BEGIN PGP SIGNATURE- iQIcBAEBAgAGBQJbmO3DAAoJEPJFaEEGrTgGYZEP/iPkZ8VTXveSOvmgbFIxiL1m p9oq0oKPlK+/rO0i6hheNPzylgnddvRNgpp0vrrnJPYFK9KCFBC1R4j3ePNJawPu 8ysnDDwWtjxdg7t8rDtRH0JEwDY+FPv+EqBxTb65wULGpjwG302FpjXr7LmlJzJP PCPSO5flIjJ+RzCfmp2BK/sP2N498bcO+vQcKkv0bTAJ/sIsHHnbEnPxilKjeb1Q EwGZKBRTn61OTE7x+Jh0pzFoBeZaIsrCmu+BjwphQ3meOiCZq+PDFO5VgbhsrGLv tpP15awlXAQdR8GGxj6fAOfqlMJ59cwbHpwuI5CfPhIrrQDjMmUgW3X6ifxNqK9x 7L5kcc8OeqYLFcd0u8IawxGEIiWmaO+M/WKTVsd+pqjGqPfWk6JvAcrMoFwMmjQG iWa7D0dO0xGJayuyBwBMo/hBxgeCAjDh0ij9hEC8QJ4WEOXfxIgDuGx6zxurAyst vcguMdNNfU+552Zc/58dq79+e3gG+5DY+fIXUAV0PvAH3FdrSAnUEpbNBS+bhJ3o Il8P3NnQDBxNzx8QxpUojMiinooFqDBAboM78Rio7qil+ZF5cyFZ2fP5fwRk9NOg jjLlnicyvFyT0oGb5WK/y5O0pagb3J2T31Apz+TaLzg/EdW51826kNGSCCw/B/+q +cj4iYqOcoJR/erfxCfo =xj6f -END PGP SIGNATURE- ==END==OF==PATCH=*=*=*** -- Dario Niedermann. Also on the Internet at: gopher://darioniedermann.it/ <> https://www.darioniedermann.it/ ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng