-
-
Notifications
You must be signed in to change notification settings - Fork 18k
pulseaudioFull: fix wrapGApp wrapping, fix vm tests #180976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for implementing your idea. I've successfully integrated your modified pulseaudio into my system, audio still works fine. But I still struggle a bit with understanding what happens there: $ ls -lsh /nix/store/4f9zi1250bcm869kk6c3zgqpci9ysgmj-pulseaudio-15.0/.bin-unwrapped
insgesamt 488K
84K -r-xr-xr-x 1 root root 83K 1. Jan 1970 pacat
44K -r-xr-xr-x 1 root root 43K 1. Jan 1970 pacmd
112K -r-xr-xr-x 1 root root 111K 1. Jan 1970 pactl
4,0K -r-xr-xr-x 1 root root 2,4K 1. Jan 1970 padsp
4,0K -r-xr-xr-x 1 root root 2,1K 1. Jan 1970 pa-info
4,0K lrwxrwxrwx 1 root root 5 1. Jan 1970 pamon -> pacat
4,0K lrwxrwxrwx 1 root root 5 1. Jan 1970 paplay -> pacat
4,0K lrwxrwxrwx 1 root root 5 1. Jan 1970 parec -> pacat
4,0K lrwxrwxrwx 1 root root 5 1. Jan 1970 parecord -> pacat
44K -r-xr-xr-x 1 root root 44K 1. Jan 1970 pasuspender
40K -r-xr-xr-x 1 root root 38K 1. Jan 1970 pax11publish
136K -r-xr-xr-x 1 root root 134K 1. Jan 1970 pulseaudio
4,0K -r-xr-xr-x 1 root root 2,7K 1. Jan 1970 start-pulseaudio-x11
$ ls -lsh /nix/store/4f9zi1250bcm869kk6c3zgqpci9ysgmj-pulseaudio-15.0/bin
insgesamt 208K
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pacat
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pacmd
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pactl
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 padsp
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pa-info
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pamon
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 paplay
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 parec
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 parecord
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pasuspender
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pax11publish
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 pulseaudio
16K -r-xr-xr-x 1 root root 16K 1. Jan 1970 start-pulseaudio-x11
$ file /nix/store/4f9zi1250bcm869kk6c3zgqpci9ysgmj-pulseaudio-15.0/.bin-unwrapped/pulseaudio
/nix/store/4f9zi1250bcm869kk6c3zgqpci9ysgmj-pulseaudio-15.0/.bin-unwrapped/pulseaudio: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped
$ file /nix/store/4f9zi1250bcm869kk6c3zgqpci9ysgmj-pulseaudio-15.0/bin/pulseaudio
/nix/store/4f9zi1250bcm869kk6c3zgqpci9ysgmj-pulseaudio-15.0/bin/pulseaudio: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/d2bpliayddadf6lx6l1i04w265gqw8n6-glibc-2.34-210/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not strippedDidn't Once I understand what's going on there, I additionally suggest to only enable that symlink-wrapper dance when it's actually needed, based on the same condition like for including wrapGApps. |
|
Okay, update, I now discovered that |
|
I got it, forgot to check the hidden files: $ ls -lshA /nix/store/080v37wdjqrcscljklimk7p6zhpqzwsj-pulseaudio-15.0/bin
total 508K
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pacat
64K -r-xr-xr-x 1 root root 61K Jan 1 1970 .pacat-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pacmd
24K -r-xr-xr-x 1 root root 21K Jan 1 1970 .pacmd-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pactl
92K -r-xr-xr-x 1 root root 90K Jan 1 1970 .pactl-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 padsp
4,0K -r-xr-xr-x 1 root root 2,4K Jan 1 1970 .padsp-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pa-info
4,0K -r-xr-xr-x 1 root root 2,1K Jan 1 1970 .pa-info-wrapped
4,0K lrwxrwxrwx 1 root root 5 Jan 1 1970 pamon -> pacat
4,0K lrwxrwxrwx 1 root root 5 Jan 1 1970 paplay -> pacat
4,0K lrwxrwxrwx 1 root root 5 Jan 1 1970 parec -> pacat
4,0K lrwxrwxrwx 1 root root 5 Jan 1 1970 parecord -> pacat
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pasuspender
24K -r-xr-xr-x 1 root root 23K Jan 1 1970 .pasuspender-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pax11publish
20K -r-xr-xr-x 1 root root 17K Jan 1 1970 .pax11publish-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 pulseaudio
112K -r-xr-xr-x 1 root root 112K Jan 1 1970 .pulseaudio-wrapped
16K -r-xr-xr-x 1 root root 16K Jan 1 1970 start-pulseaudio-x11
4,0K -r-xr-xr-x 1 root root 2,6K Jan 1 1970 .start-pulseaudio-x11-wrappedBut apparently we now have the same binaries in the package twice, Can we somehow remove one of the binaries or does the whole perceived path and executable logic not add up anymore? |
|
Thanks for your feedback, @schmittlauch .
This would certainly simplify the build process without
Hmm, you're looking into two different packages here. In the package |
|
The And regarding the seemingly-duplicated binaries, that's not an issue as well, sorry about that. The call chain for I just fell victim to diff following the symlinks. So for me this looks pretty good and I encourage you to convert this to a proper PR and go through with this. |
b3d9386 to
e854e3e
Compare
old URL returns 404
The test tries to detect the presence of pavucontrol's
window by looking for the tab label "Playback".
However, the OCR mechanism fails to resolve the
text, possibly due to the grey background color.
To fix this issue, we instead look for the name of the
sound device ("Dummy Output") which gets resolved by OCR.
Note: Strangely, the tab "Playback" *is* correctly
resolved when the test is run in interactive mode.
This might be due to the changed screen resolution,
but I didn't investigate further.
According to pulseaudio(1), a system wide pulseaudio instance can only be accessed by members of the `pulse-access` group. This name seems to be hardcoded in pulseaudio -- I didn't find any switch to change it. We need to define the group so users can connect to the deamon. This commit also fixes the systemwide pulseaudio vm test: Previously, the test user `alice` was just a member of the `audio` group. This blocked access to the daemon and failed the test. The commit changes the group assignment and fixes the vm test.
Since NixOS@7a2605e the pulseaudio build recipe incorporates the `wrapGAppsHook` wrapper setup-hook if `advancedBluetoothCodecs` are enabled. This wrapper setup-hook -- like most wrappers -- wraps binaries in `$out/bin` by first renaming them, then placing a wrapper script where the original binary was. Unfortunatelly, pulseaudio doesn't like its binary moved around after installation: It records the binaries path during installation time https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/e5ad31e873eed62bc580a86a61177047f9e8c491/meson.build#L154 then checks the path in `/proc/self/exe` and complains > Jun 16 19:06:48 nixosb pulseaudio[2219]: W: [.pulseaudio-wra] main.c: /proc/self/exe does not point to /nix/store/bqfyzxwpxa2ydmyvh3j32xrm4chxbj22-pulseaudio-15.0/bin/pulseaudio, cannot self execute. Are you playing games? if they don't match https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/e5ad31e873eed62bc580a86a61177047f9e8c491/src/daemon/main.c#L577 Somehow, this also results in a real bug: `pacmd` fails to connect to the pulseaudio server, see NixOS#177915 To fix this issue, the commit at hand changes the installation directory for binaries to `$out/.bin-unwrapped`. After the installation, `$out/bin` is created by hand and populated with symlinks to files in `$out/.bin-unwrapped`. `wrapGAppsHook` doesn't know or care about the `.bin-unwrapped` directory; it just sees all the symlinks in `bin`, renames them and places wrapper scripts beside them. Effectively, this leaves the original binary in `.bin-unwrapped` unchanged! So pulseaudio will find itself still in its oritinal place, and "users" of the package can call pulseaudio via the wrapper script in `bin` as usual.
Note that `pacmd` only connects to user session daemons, so we have to skip it in system wide mode.
e854e3e to
64d256a
Compare
|
Thanks, @schmittlauch , for your feedback and thorough testing! I just rebased and updated the branch. Unfortunatelly, the branch now conflicts with other changes in The core commit "pulseaudioFull: fix wrapGApp wrapping" is still retained, although some shell commands have been shortened (e.g. "mkdir -p" instead of "mkdir --parents") due to feeback in another pull request ( #182360 (review) ). While testing, I realized that all pulseaudio nixos vm tests currently fail, for various reasons. I fixed and extended the tests with more commits:
I tested this branch, based on current
Due to the conflict with current Thanks again, @schmittlauch, for you help with fixing this issue and preparing this branch. I will now turn it into a proper pull request for staging. Notifying pulseaudio maintainer: @lovek323 |
| ++ lib.optional pkgs.stdenv.isx86_64 testers.testPlay32; | ||
| } // lib.optionalAttrs systemWide { | ||
| users.users.alice.extraGroups = [ "audio" ]; | ||
| users.users.alice.extraGroups = [ "pulse-access" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@astro this is the exact problem we had on pulsebert
|
Do we want to backport this to 22.05? I suggest doing so as long as a backport just works, as breaking pactl is a regression introduced into the original 22.05 release and thus worthy fixing. |
|
I finally managed to build this on my laptop. Pulseaudio is still working fine (audio playback, device switching, Bluetooth audio) and a |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
It looks like there has been a change in pulseaudio which breaks If this could be merged ASAP that would be great! |
Since 7a2605e the pulseaudio build recipe incorporates the
wrapGAppsHookwrapper setup-hook ifadvancedBluetoothCodecsare enabled. This wrapper setup-hook -- like most wrappers -- wraps binaries in$out/binby first renaming them, then placing a wrapper script where the original binary was.Unfortunatelly, pulseaudio doesn't like its binary moved around after installation: It records the binaries path during installation time in https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/e5ad31e873eed62bc580a86a61177047f9e8c491/meson.build#L154 , then checks the path in
/proc/self/exeand complainsif they don't match: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/e5ad31e873eed62bc580a86a61177047f9e8c491/src/daemon/main.c#L577
Somehow, this also results in a real bug:
pacmdfails to connect to the pulseaudio server, see #177915 .Description of changes
To fix this issue, the commit at hand changes the installation directory for binaries to
$out/.bin-unwrapped. After the installation,$out/binis created by hand and populated with symlinks to files in$out/.bin-unwrapped.wrapGAppsHookdoesn't know or care about the.bin-unwrappeddirectory; it just sees all the symlinks inbin, renames them and places wrapper scripts beside them.Effectively, this leaves the original binary in
.bin-unwrappedunchanged! So pulseaudio will find itself still in its oritinal place, and "users" of the package can call pulseaudio via the wrapper script inbinas usual.Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notesMore comments
I tried
nixpkgs-reviewand it attempted a mass rebuild, which I had to abort. The mass rebuild is likely caused by this pull request also touchinglibpulseaudio. So it better targetsstaging...I tested a minimal (e.g., non-graphical) NixOS installation with
pulseaudioFulland the patch at hand applied. After some compiling, the system booted, pulseaudio started, it was able to play some music withpaplay, andpacmd infoalso worked, i.e., the patch fixes pulseaudioFull: pacmd cannot connect to daemon #177915 .The patch, in particular the new
.bin-unwrappeddirectory, feel a bit unorthodox. It attempts to fix a minor bug in the current implementation and I hope it doesn't introduce new ones. I can't test this on my productive system as I cannot rebuild everything, but good testing seems to be needed here.notifying maintainer: @lovek323
notifying bug report participant and author of the commit that introduced
wrapGAppsHook: @schmittlauch