Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Network doesn't work in Xorg after switching TTY
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
e8root
n00b
n00b


Joined: 09 Feb 2024
Posts: 71

PostPosted: Tue Mar 05, 2024 9:58 pm    Post subject: [SOLVED] Network doesn't work in Xorg after switching TTY Reply with quote

When I start eg. download in Firefox and switch to different TTY for few minutes and go back to session where I started download then I see that progress in all this time was zero or it timed out. Most noticeable effect of it is audio from YT or Tidal-HIFI stops playing after they use up their buffers. It can be pretty long so its definitely not an audio issue. Also audio can play with X11 session being inactive because mvp, vlc and even firefox itself will happily play local flac file so it is not an issue with even firefox/chrome being suspended. Videos from local files also play okay.

I tested downloading the same file using wget from xterm and it downloaded the file so it seems to be Xorg related but not sure.
I used default network configuration from gentoo handbook.

Any suggestions what to configure/check?
_________________
Unix Wars - Episode V: AT&T Strikes Back


Last edited by e8root on Wed Mar 06, 2024 7:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
Banana
Veteran
Veteran


Joined: 21 May 2004
Posts: 1392
Location: Germany

PostPosted: Wed Mar 06, 2024 6:38 am    Post subject: Reply with quote

What desktop enviroment do you use? I can only think of a suspend or logout as you switch to TTY, which woul result into a broken download
_________________
My personal space
My delta-labs.org snippets do expire

PFL - Portage file list - find which package a file or command belongs to.
Back to top
View user's profile Send private message
e8root
n00b
n00b


Joined: 09 Feb 2024
Posts: 71

PostPosted: Wed Mar 06, 2024 10:50 am    Post subject: Reply with quote

My packages: https://pastebin.com/Hj5UJm0G
System is regularly updated.
I use x11-base/xorg-server-21.1.11
Code:
x11-base/xorg-server-21.1.11::gentoo was built with the following:
USE="systemd udev xorg xvfb -debug (-elogind) -minimal (-selinux) -suid -test -unwind -xcsecurity -xephyr -xnest" ABI_X86="(64)"
FEATURES="usersync qa-unresolved-soname-deps unknown-features-warn distlocks pkgdir-index-trusted unmerge-logs userpriv unmerge-orphans sfperms buildpkg-live ipc-sandbox fixlafiles sandbox strict binpkg-logs config-protect-if-modified binpkg-multi-instance assume-digests protect-owned multilib-strict merge-sync usersandbox ebuild-locks news parallel-fetch xattr userfetch network-sandbox pid-sandbox preserve-libs binpkg-dostrip binpkg-docompress"


The relevant information I didn't provide at the time as I didn't think its relevant was the profile I am using:
default/linux/amd64/17.1/desktop/systemd/merged-usr (stable)

As b tags imply I now suspect systemd - its security looks way too complex for home system like mine... whereas anyone with physical access to my computer can easily do rm -r ~/ if they so desire because nothing prevents me from leaving session with logged in user/root on other TTYs so in this sense default security is non-existent.

As for desktop environment I can use startx /bin/firefox as root and switch to other root TTY and the issue persist. In other words it is not very likely this issue is related to desktop environment.

Not sure if its network related itself because wget and qBittorrent work just fine.
Firefox can play audio and even videos in background when its local files. Only issue I noticed so far network on Firefox/Chromium/SeaMonkey and Tidal-HIFI (which is pretty much electron so also chrome/chromium based application) does not work.
Of course and this was to be expected Windows applications run just fine and eg. I can listen to YT for hours using Windows build of SeaMonkey. At least it makes it possible to listen to music in TTYs but why do I need to use Windows apps for that?

To me this whole thing looks like issue with default systemd security policy. The way it is configured serves no purpose other than limit and annoy the user. Observed behavior doesn't make any sense for any kind of system and if anything it all should be designed in such a way that permits everything but user can explicitly say what to do when they leave active session or go back to it. Default for desktop/home computer should never be to block anything when switching TTYs. Especially since the way it is configured is completely inconsistent. Some applications loose access to internet while others work just fine. It doesn't make any sense.
_________________
Unix Wars - Episode V: AT&T Strikes Back
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2575
Location: Here and Away Again

PostPosted: Wed Mar 06, 2024 3:05 pm    Post subject: Reply with quote

Seems at least similar to something I started seeing when I switched from nvidia to amdgpu back in 2020.

I don't use systemd, so if it's the same issue, it's definitely not caused by that (at least not directly).

Not coming up with a better place, I filed a bug [1] on the xserver tracker in 2022, but I'm not sure anyone has even seen it.

It would be interesting to know if this also happens with intel graphics, and if not, perhaps it actually is amdgpu specific.

Haven't looked into it any deeper since then. Yet.

1. https://gitlab.freedesktop.org/xorg/xserver/-/issues/1406
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
e8root
n00b
n00b


Joined: 09 Feb 2024
Posts: 71

PostPosted: Wed Mar 06, 2024 3:30 pm    Post subject: Reply with quote

Jackpot! :!:

I removed AMDGPU and radeonsi from VIDEO_CARDS from make.conf and rebuilt few packages which used it (X11 related) and now Tidal-HIFI runs in the background just fine 8)

Usability of system +10 but also -100
And I started trying to read through systemd documentation and felt my sanity falling away. In fact I already lost it because I rebuilt sys-apps/systemd to always return session is active... surprisingly the only side-effect was switching from X11 to other TTY and then trying to switch back to X11 would result in black screen and system freeze.

Anyways, if the Radeon drivers are the issue then I'll try modesetting driver, some settings and otherwise take look in to offending source code.

Big thanks. This is the kind of hint I needed!
_________________
Unix Wars - Episode V: AT&T Strikes Back
Back to top
View user's profile Send private message
e8root
n00b
n00b


Joined: 09 Feb 2024
Posts: 71

PostPosted: Wed Mar 06, 2024 5:27 pm    Post subject: Reply with quote

Fixed it quite quickly via magic of having source based distribution :)

https://i.imgur.com/twZJQad.png

I can switch back and forth and everything seems to work just fine. GLX gears keep spinning in the background like there was no tomorrow!

BTW. Now I wonder if I can hack these functions to eg. push processes running on X11 to E-cores and back to P/E-cores when returning to X11. It will be glorious!

ps. I will of course check if whatever these changes can be made be less nonsensical by going deeper in to functions which I commented to see what they do and maybe there is nicer approach to do it but for now I want to test if nonsense coding will cause any issues.
_________________
Unix Wars - Episode V: AT&T Strikes Back
Back to top
View user's profile Send private message
e8root
n00b
n00b


Joined: 09 Feb 2024
Posts: 71

PostPosted: Mon Mar 11, 2024 8:20 pm    Post subject: Reply with quote

So of course just commenting calls to glxSuspendClients() and glxResumeClients() is enough.
I tested this workaround thoroughly and any issues I found (there were two) happened to also happen without this change on unmodified xorg-server.

I dug deeper as to what this change was for and found origin: https://bugs.freedesktop.org/show_bug.cgi?id=7916
So it is workaround (cause I do not consider it a proper fix - something that prevents multitasking is terrible solution!) for such an useless feature (at least for us today) as compositors. I tested how removing this call to suspend clients works with Xfce4 compositor and... actually surprisingly X11 server gets completely frozen. Well, not completely because audio from firefox still played just fine.

So conclusion is simple: X11 compositors cannot be used with my fix.
Thankfully X11 compositors are unnecessary with TearFree option (at least on amdgpu driver) and by design are just burden for the system. Not to mention can interfere with VRR. At least Xfce4 compositor causes VRR to not work.

BTW. I tried to filter suspended processed by their name to only not suspend firefox and bunch of other processes but Xfce4 compositor still froze X11 session. Not that I care for compositor. I will still use my workaround. If I run in to some issues that don't happen without this fix I will report back.
_________________
Unix Wars - Episode V: AT&T Strikes Back
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2575
Location: Here and Away Again

PostPosted: Wed Mar 13, 2024 1:16 pm    Post subject: Reply with quote

Many thanks for experimenting and sharing your findings!

It's very good to know I am not alone with the issue. :]

I'll see if I can push the bug report forward in some way, in case the original issue could be resolved in some other way today, ~18 years later.

I do tend to use (KWin) compositing, though might be able to learn to live without as well...
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
e8root
n00b
n00b


Joined: 09 Feb 2024
Posts: 71

PostPosted: Sun Mar 17, 2024 7:08 pm    Post subject: Reply with quote

I didn't test Kwin that much uninstalling it the next day but I am pretty sure the issue was not happening there.
Blocking issue also doesn't affect wlroots based sway or wayfire.

BTW if anyone is interrested xorg-server patch. Just drop it to /etc/portage/patches/x11-base/xorg-server/glx-unsuspend.diff and re-emerge x11-base/xorg-server
Code:
diff -Naru p/glx/glxext.c xorg-server-21.1.11/glx/glxext.c
--- p/glx/glxext.c   2024-03-17 07:24:31.069768548 +0100
+++ xorg-server-21.1.11/glx/glxext.c   2024-03-17 07:24:55.546434739 +0100
@@ -651,28 +651,28 @@
 void
 glxSuspendClients(void)
 {
-    int i;
-
-    for (i = 1; i < currentMaxClients; i++) {
-        if (clients[i] && glxGetClient(clients[i])->client)
-            IgnoreClient(clients[i]);
-    }
-
-    glxBlockClients = TRUE;
+//    int i;
+//
+//    for (i = 1; i < currentMaxClients; i++) {
+//        if (clients[i] && glxGetClient(clients[i])->client)
+//            IgnoreClient(clients[i]);
+//    }
+//
+//    glxBlockClients = TRUE;
 }
 
 void
 glxResumeClients(void)
 {
     __GLXcontext *cx, *next;
-    int i;
+//    int i;
 
     glxBlockClients = FALSE;
 
-    for (i = 1; i < currentMaxClients; i++) {
-        if (clients[i] && glxGetClient(clients[i])->client)
-            AttendClient(clients[i]);
-    }
+//    for (i = 1; i < currentMaxClients; i++) {
+//        if (clients[i] && glxGetClient(clients[i])->client)
+//            AttendClient(clients[i]);
+//    }
 
     for (cx = glxPendingDestroyContexts; cx != NULL; cx = next) {
         next = cx->next;

As stated before it is incompatible with compositors. Other than that I didn't notice any issues.
_________________
Unix Wars - Episode V: AT&T Strikes Back
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum