Nixpkgs: Can't run `getcap` in steam-run (symbol lookup error: getcap: undefined symbol: cap_get_nsowner)

Created on 9 Jul 2020  路  3Comments  路  Source: NixOS/nixpkgs

Describe the bug
A clear and concise description of what the bug is.

You can't run getcap inside steam-run (returns getcap: symbol lookup error: getcap: undefined symbol: cap_get_nsowner).

This makes SteamVR's vrstartup script think that no capability is set on vrcompositor-launcher which causes it to show a popup prompt on every SteamVR startup asking for superuser permissions and then an error message becasue of https://github.com/NixOS/nixpkgs/issues/69338.

To Reproduce
Steps to reproduce the behavior:

  1. steam-run getcap

Expected behavior
A clear and concise description of what you expected to happen.

It should print usage and, when pointed at a file, the capabilities of the file.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

https://github.com/NixOS/nixpkgs/issues/71554

Notify maintainers

@abbradar

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.6.19, NixOS, 20.09pre233323.dc80d7bc4a2 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.6
  • channels(root): "nixos-20.09pre233323.dc80d7bc4a2, nixpkgs-mozilla, nixos-stable-20.03.2310.fb6c3a6831c, nixos-unstable-20.09pre231796.22a81aa5fc1"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
bug steam

Most helpful comment

The linker error is caused by using nixpkgs getcap with libcap from steamrt. Adding libcap to the steam FHS multiPkgs fixes this, but seems to break other things:

diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix
index 56e1a09f36e..ea8cd3bc39c 100644
--- a/pkgs/games/steam/chrootenv.nix
+++ b/pkgs/games/steam/chrootenv.nix
@@ -111,6 +111,9 @@ in buildFHSUserEnv rec {
     libuuid
     libbsd
     alsaLib
+
+    # needed by getcap for vr startup
+    libcap
   ] ++ (if (!nativeOnly) then [
     (steamPackages.steam-runtime-wrapped.override {
       inherit runtimeOnly;
@@ -144,7 +147,6 @@ in buildFHSUserEnv rec {
     expat
     dbus
     cups
-    libcap
     SDL2
     libusb1
     dbus-glib
~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher: error while loading shared libraries: libcap.so.2: cannot open shared object file: No such file or directory

This made me think about RPATH / LD_LIBRARY_PATH / RUNPATH and the implications of getcap using RUNPATH instead of RPATH.

Fixing getcap gets rid of the popup if you manually setcap, but that causes other issues you've already discovered.

I'm going to leave this for now. I just wanted to document my investigation.

All 3 comments

The linker error is caused by using nixpkgs getcap with libcap from steamrt. Adding libcap to the steam FHS multiPkgs fixes this, but seems to break other things:

diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix
index 56e1a09f36e..ea8cd3bc39c 100644
--- a/pkgs/games/steam/chrootenv.nix
+++ b/pkgs/games/steam/chrootenv.nix
@@ -111,6 +111,9 @@ in buildFHSUserEnv rec {
     libuuid
     libbsd
     alsaLib
+
+    # needed by getcap for vr startup
+    libcap
   ] ++ (if (!nativeOnly) then [
     (steamPackages.steam-runtime-wrapped.override {
       inherit runtimeOnly;
@@ -144,7 +147,6 @@ in buildFHSUserEnv rec {
     expat
     dbus
     cups
-    libcap
     SDL2
     libusb1
     dbus-glib
~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher: error while loading shared libraries: libcap.so.2: cannot open shared object file: No such file or directory

This made me think about RPATH / LD_LIBRARY_PATH / RUNPATH and the implications of getcap using RUNPATH instead of RPATH.

Fixing getcap gets rid of the popup if you manually setcap, but that causes other issues you've already discovered.

I'm going to leave this for now. I just wanted to document my investigation.

This fixes the issue, I am now able to run the regular vrstartup.sh from steam-run without any popup after setting the cap manually (automatic setcap via SUID wrappers doesn't work because of https://github.com/NixOS/nixpkgs/issues/69338).

It does not fix the issue in Steam itself though oddly, not even when Steam is run from within steam-run.

Which are those "other things" your patch breaks? I was able to run SteamVR and Beat Saber without any issue (well, none that I didn't have before).

As for your shared library issue, that's fixed by #55973.

Which are those "other things" your patch breaks?

I was just referring to ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher: error while loading shared libraries: libcap.so.2: cannot open shared object file: No such file or directory

Was this page helpful?
0 / 5 - 0 ratings