Open steinuil opened 1 month ago
Ok, I looked into wireplumber and activated debug logs for the Lua scripts that are failing with systemd.user.services.wireplumber.environment.WIREPLUMBER_DEBUG = "s-monitors-*:D"
and noticed that the scripts have just been rewritten in master to simplify them (commit here). The bug that it closes has similar logs to mine. I guess I'll try compiling the git version and see how it goes...
I have a fix! There were two issues in both wireplumber and libcamera that caused this problem. This overlay will fix both and the other fixes above are not required:
{
nixpkgs.overlays = [
(final: prev: {
wireplumber = prev.wireplumber.overrideAttrs (_: {
version = "git";
src = prev.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "wireplumber";
rev = "71f868233792f10848644319dbdc97a4f147d554";
hash = "sha256-VX3OFsBK9AbISm/XTx8p05ak+z/VcKXfUXhB9aI9ev8=";
};
});
libcamera = prev.libcamera.overrideAttrs (_: {
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
});
})
];
}
Beware: overriding libcamera will cause a ton of stuff to be rebuilt. I don't recommend building this on the Surface tablet.
It looks like updating wireplumber to the git version fixed only part of the issue, and the other problem was caused by the IPA module signing mechanism in libcamera not liking Nix's fixup phase, which was fixed at some point in nixpkgs but then regressed.
In short, libcamera tries to sign the IPA modules during compilation, which I think involves hashing the .so
files using a private key generated at build time, but then Nix comes and strips them and changes all the RPATHs in the fixup phase, which invalidates the signature and causes libcamera to trigger its IPA module isolation feature. This feature spawns another process with the proxy binary I mentioned above, and I think it fails because it calls unshare
to run the binary in a separate namespace at some point, which only works as root...
Anyway: as for the issue with libcamera I opened an issue on nixpkgs https://github.com/NixOS/nixpkgs/issues/351842 and hopefully this fix makes its way in nixpkgs directly soon. For the wireplumber issue, there hasn't been a release with this fix yet so I suppose we can wait for 0.5.7 to eventually come out. I'll keep this issue open until both of those have been fixed upstream.
For the moment you can use this overlay :)
I just installed NixOS with the
nixos-hardware
module on a Surface Pro 5 and neither the camera nor the speaker work out of the box. As discussed in #970 this is caused by an issue with the camera's IPU3 inlibcamera
, which causeswireplumber
to crash and brings audio down with it. There was a workaround proposed in the thread, and it does fix the audio but since it disables the IPU3 kernel module it renders the camera unusable. I need to use the camera on this device so I can't use this workaround.Here is the error returned by wireplumber (when the IPU3 module is not disabled):
The stack trace from GDB says that the segfault is caused by the destructor for
IPAProxyIPU3
.Going from the error messages before the crash, it looks like the IPU3 IPA proxy (whatever that is) cannot be found. This proxy is in
${pkgs.libcamera}/libexec/libcamera/ipu3_ipa_proxy
and is supposed to be loaded at runtime bylibcamera
. The logs come from the constructor forIPAProxyIPU3
, which callsIPAProxy::resolvePath()
to find out where these this file is located.resolvePath()
first checks if the file exists inLIBCAMERA_IPA_PROXY_PATH
, so I tried providing this env variable to wireplumber:And this seems to work. But now I'm running into another error:
The cameras do work with libcamera and I tested this by running
qcam
directly with theLIBCAMERA_IPA_PROXY_PATH
env variable set.So I'm not sure what exactly is happening in wireplumber.