theNizo / linux_rocksmith

Guides to get Rocksmith 2014 running on Linux
https://thenizo.github.io/linux_rocksmith/
GNU General Public License v3.0
95 stars 10 forks source link

Game broken with PipeWire 1.2 (Debian) #48

Open KczBen opened 1 month ago

KczBen commented 1 month ago

Mainly posting to see if other distros are having the same issue, whether it's a packaging bug on Debian or an upstream PipeWire regression. Or maybe something totally unrelated (Steam update?)

The game also fails to start even if I remove RSASIO, just having that LD_PRELOAD causes the issue. But of course, the game doesn't have audio if I don't have the LD_PRELOAD in the launch options.

KczBen commented 1 month ago

I did some more testing, here's a quick rundown of what I found so far:

Unhandled exception: page fault on read access to 0x00000030 in 32-bit code (0xf6936b09).
0164:fixme:dbghelp:elf_search_auxv can't find symbol in module
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:f6936b09 ESP:0062f074 EBP:00000004 EFLAGS:00010202(  R- --  I   - - - )
 EAX:00000000 EBX:f6972e60 ECX:7e58ee5c EDX:00000001
 ESI:7e58ed90 EDI:7e58ee30
Stack dump:
0x0062f074:  00000000 00000001 00000000 7e5a18d0
0x0062f084:  f6936ae6 f6972e60 f6949b9f 7e58ee30
0x0062f094:  00000001 00000000 f7f13a30 00000000
0x0062f0a4:  7e5a18d0 7e5a18d0 f7ea6a95 7e5a18d0
0x0062f0b4:  7e58ee30 f7ec7c61 00000003 f6972e60
0x0062f0c4:  7e58ed90 7e405d90 bd4a5c00 7e58ee30
Backtrace:
=>0 0xf6936b09 (0x00000004)
0xf6936b09: pushl       0x30(%eax)

It wants more symbols. Not sure which ones though.

theNizo commented 1 month ago

Arch Linux, just set up a new prefix, doesn't work on my machine either. The start script still works though.

I noticed that

My game worked fine before the PipeWire update.

Since the VBASIO test worked for you, I wouldn't have thought that pipewire or wineasio are the problem. However, it might be an incompatibility with something Proton-related. Since I have the same issue, I'm gonna try and downgrade tomorrow to see if that's the problem.

the game doesn't have audio if I don't have the LD_PRELOAD

No audio patch RS_ASIO
No launch options Only output No audio
LD_PRELOAD Should have only output Should work

With "should" I mean "worked in the past, but currently it doesn't". Replacement made so the table can be read better.


Regarding your second comment: page faults don't exactly help, as they tell you "something's wrong", and it could be something you set up wrong, something wine doesn't support yet, maybe missing packages too... In this case I would guess the first one, but it gives me no clue what it could be.

theNizo commented 1 month ago

I also got two questions:

KczBen commented 1 month ago

I installed WineASIO from the kxstudio repo, which works without any issues other than needing LD_PRELOAD to work even on the system Wine install. I can look into building it from source though. Also, I have the exact same error on two Debian systems, one Sid and one Testing. Both run the same Proton version and use the same settings in the prefix. Testing got the PipeWire 1.2 update later, and thus also broke later.

I first got the terminal output by running Steam through the terminal, but I realised PROTON_LOG=1 in the launch options of the game is way more convenient since it just saves a file to $HOME. This part of the log might be more useful, though I haven't been able to do anything with it. But this is where the actual error comes from:

20056.438:018c:0190:trace:seh:dispatch_exception  info[0]=00000000
20056.438:018c:0190:trace:seh:dispatch_exception  info[1]=00000030
20056.438:018c:0190:warn:seh:dispatch_exception backtrace: --- Exception 0xc0000005 at 0xf5f00b09: /usr/lib/i386-linux-gnu/pipewire-0.3/libpipewire-module-protocol-native.so + 0x7b09.
20056.438:018c:0190:warn:seh:dispatch_exception EXCEPTION_ACCESS_VIOLATION exception (code=c0000005) raised

The address changes of course, but libpipewire-module-protocol-native.so + 0x7b09 is constant, as was in the first backtrace. Again, I don't know if this is of any use. You can also attach wine-gdb to the game, if you use PROTON_DUMP_DEBUG_COMMANDS=1. Somebody smarter than me might be able to get something useful out of that? I would recommend adding VBASIOTest32 as a non-Steam game for testing at least, it will only crash when you attempt to select WineASIO as the ASIO device.

KczBen commented 1 month ago

What I did for now is download the pipewire-jack:i386 1.0.5-1 deb package from Ubuntu, take the libjack.so from it and preload it to the game. It seems to work fine, even with PipeWire 1.2 installed on the system. It sure isn't ideal, but it is a usable workaround until there's a better solution.

theNizo commented 1 month ago

Since I have the same issue, I'm gonna try and downgrade tomorrow to see if that's the problem.

It isn't exactly tomorrow, but downgrading breaks my system's audio and honestly, I have no motivation to fix that in order to be able to identify whether it's the cause or not.

(Also, what's up with Debian providing such a recent version of a package?)

EDIT: Oh, well, I didn't read your last comment...

KczBen commented 1 month ago

I don't think preloading any other libraries will help, nor does the order matter. I did a simple, crude test by just putting all of my system libraries into the Proton lib and lib64 folders, which makes choose those libraries. I confirmed it by running VBAsioTest32 with LD_DEBUG=all to see what libraries get loaded. Sure enough, it never checks anywhere else as it can find everything it needs in Proton now.

Still get the page fault error. Also found something interesting: If I put the PipeWire libjack.so in the Proton lib folder, I can see that it searches for & finds the system libpipewire.so file in /usr/lib/i386-linux-gnu, but loading WineASIO still fails with the original missing symbol error.

theNizo commented 1 month ago

I'm currently working on the Debian-pipewire guide, testing on a machine running Debian Sid Bookworm. Newly set up.

I cannot replicate this issue this time.

No other changes, AFAIK.

KczBen commented 1 month ago

Interesting, so that works without any issues? Can you get me the outputs of apt list --installed | grep jack and systemctl --user status pipewire? I'm not sure how Sid sets things up by default as of now, so it might help to compare it to mine.

theNizo commented 1 month ago
john@device-name:~$ apt list --installed | grep jack

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libjack0/stable,now 1:0.126.0-2 amd64 [installed,automatic]
pipewire-jack/stable,now 0.3.65-3+deb12u1 amd64 [installed]
pipewire-jack/stable,now 0.3.65-3+deb12u1 i386 [installed]
john@device-name:~$ systemctl --user status pipewire
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Mon 2024-07-15 12:54:02 CDT; 1h 27min ago
TriggeredBy: ● pipewire.socket
   Main PID: 46900 (pipewire)
      Tasks: 2 (limit: 18682)
     Memory: 27.2M
        CPU: 57.841s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─46900 /usr/bin/pipewire

Jul 15 12:54:02 device-name systemd[46880]: Started pipewire.service - PipeWire Multimedia Service.
Jul 15 12:54:02 device-name pipewire[46900]: mod.rt: Can't find org.freedesktop.portal.Desktop. Is xdg-desktop-portal running?
Jul 15 12:54:02 device-name pipewire[46900]: mod.rt: found session bus but no portal
john@device-name:~$ 

(Debian Guide is published now btw.)

KczBen commented 1 month ago

You don't have the newest PipeWire installed, are you sure you aren't on Bookworm (Debian 12)? You have 0.3.65 installed, but Sid has 1.2.1 in its repos now.

theNizo commented 1 month ago

so that works without any issues?

With LD_PRELOAD yes, with the (Proton 9) start script apparently not.

theNizo commented 1 month ago

Okay, it's not Sid as I thought, but it's, in fact, bookworm. (at least that's what lsb_release -a tells me.)

Could it be because of the kxstudios repo? - But AFAIK there were no packages to update, so no... I, again, didn't check details. I'm sorry.

theNizo commented 1 month ago

And I broke my test setup by switching to Sid, because wineasio-register doesn't work anymore...

EDIT: and I can't reinstall because it consistently gets stuck...

KczBen commented 1 month ago

The easiest way to get a similar setup would be to install a Debian Testing image as your base, and then switch that to update from the Sid repos. You can get the testing netinst iso here. You could also just leave it as is, since Testing is usually only a week or two behind Sid but doesn't break as easily.

theNizo commented 1 month ago

Oh, there's a third way too. Yes, I can try that. (What I've tried so far: Debian 12 installation to Sid - setup doesn't work; mini.iso - setup freezes.)

KczBen commented 1 month ago

I will try Ubuntu 24.04 for some testing with PipeWire 1.0.5. Mainly I want to know whether preloading libpipewire also breaks that or not. If it does, then I don't think it's worth trying to solve the segmentation fault crash, and it may be better to make a simple dummy/shim library that provides the logging symbols needed by PipeWire JACK 1.2. If we aren't using logging, I think we can get away with not implementing any of it and just let the library think that the functions are present.

Edit: I made a shim but it still crashes. It crashes a bit later though, so that might be worth something. It gets far enough for VBAsioTest to show up in qpwgraph and for VBAsioTest to display some text for a moment. But it's very unpredictable and I don't really know what causes that crash. Whatever it is, it messes everything up and I can't even get GDB to break on the crash. I'm almost sure it isn't related to the logging functions though, because system WINE works when I preload the shim.

theNizo commented 1 month ago

Replicated.

theNizo commented 1 month ago

40 is related

I got it to work doing this (Proton 8, because getting the start script is easier):

  1. Create a clean prefix
  2. Run env WINEPREFIX=/path/to/221680/pfx wineasio-register
  3. Run env WINEPREFIX=/path/to/221680/pfx wineasio-settings
  4. Click okay
  5. Create start script
  6. Run LD_PRELOAD=/path/to/libjack.so PIPEWIRE_LATENCY=256/48000 /tmp/proton_$USER/run

EDIT: confirmed to be working with Proton 9 too.

KczBen commented 1 month ago

I'm starting to get the feeling that there's some general incompatibility between PipeWire 1.2.1 and WineASIO. Native JACK applications have no issues, but VBAsioTest repeatedly (but not reliably) segfaults with PipeWire JACK 1.2.1 running on my system WINE. It does not seem to happen with 1.0.5 though.

Would it be reasonable to provide an older libjack.so and instruct people to put it in Proton's lib folder? That also avoids the need for LD_PRELOAD since it will automatically be loaded by WineASIO when it looks for libjack.so.0. Since Steam games are already running on Debian libraries through the Steam Runtime, I don't see any issues with also providing a Debian (or Ubuntu) built PipeWire JACK library with regards to compatibility.

theNizo commented 1 month ago

segfaults with PipeWire JACK 1.2.1 running on my system WINE

My findings on Debian are documented, on Arch you can still just do (without LD_PRELOAD)

./wineasio-register
wine /path/to/VBASIOTest32.exe

On Debian, I took wineasio from the kxstudios repo (which is most likely compiled against an older version of pipewire), but on Arch I compiled it myself. Could that be the root of a problem?

I'm starting to get the feeling that there's some general incompatibility between PipeWire 1.2.1 and WineASIO

I'm not sure why they behave different. But I want to test this on Fedora too, before saying that.

Would it be reasonable to provide an older libjack.so

I have some thoughts on this:

KczBen commented 1 month ago

It shouldn't matter which version of PipeWire you have at the time of compilation, WineASIO is compiled and linked against jackd2. PipeWire doesn't have any of its own Jack development headers/libraries, it only takes the place of jackd2 at runtime.

The Steam Runtime that's used by Proton 8 and above ship their own PipeWire libraries. This doesn't include PipeWire Jack, but as long as the libjack.so loaded by the user is compatible with the version of PipeWire in the Steam Runtime, it should be fine. Theoretically, loading an earlier libjack.so (anything before 1.2.0) should work on every distro since the system-wide PipeWire libraries won't be touched.

In my opinion, this is the cleanest approach for solving this issue. The new logging symbols needed by 1.2.0 won't make it into a Steam Runtime until at least 2025, when a new release is made based on Debian 13. And even if one does provide the logging symbols now in a dummy/shim library, it will crash with a segmentation fault in Proton.

theNizo commented 1 month ago

Regarding Distribution, I'll advise people to download these .deb files and extract the .so from there.

KczBen commented 1 month ago

Probably easiest if there's a command to easily download it in the terminal so people don't accidentally get the wrong arch and get confused about why it doesn't work. Some distros come with curl and some come with wget, so this should cover both cases.

wget https://snapshot.debian.org/archive/debian/20240416T025914Z/pool/main/p/pipewire/pipewire-jack_1.0.5-1_i386.deb or curl -O https://snapshot.debian.org/archive/debian/20240416T025914Z/pool/main/p/pipewire/pipewire-jack_1.0.5-1_i386.deb