Skip to content

Setting CAP_SYS_NICE=eip on vrcompositor-launcher crashes SteamVR #92798

Closed

Description

@Atemu

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

SteamVR crashes when you set CAP_SYS_NICE=eip on vrcompositor-launcher.

To Reproduce
Steps to reproduce the behavior:

  1. sudo setcap CAP_SYS_NICE=eip ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher
  2. steam-run strace ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher

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

On an FHS distro it looks for libs in /lib32 /lib64 and the like. It should either do that or look under /steamrt/.

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

Additional context
Add any other context about the problem here.

See #71554

I booted up a Pop!_OS live env, installed SteamVR, set the CAP and straced vrcompositor-launcher.

It first started looking for libcap.so.2 in the SteamVR bin and then regular FHS paths like /usr/lib etc. where it found libcap under /lib/x86_64-linux-gnu/libcap.so.2.
On NixOS it only tries to look in a few FHS paths under ${pkgs.glibc} which is obviously nonsensical and fails.

Seems like this happends due to Nix-specific patches to dynamic linking because we're also doing something that makes vrcompositor-launcher try to preload from /etc/ld-nix.so.preload which, countrary to LD_PRELOAD, also actually works. I made use of this and modified buildFHSUserEnv to create a file in that location inside the chroot to preload libcap.so.2 and libstdc++.so.6 from the steamrt.
With these patches, SteamVR can be launched with CAP_SYS_NICE=eip set on vrcompositor-launcher.

https://github.com/Atemu/nixpkgs/tree/steamvr-lib-loading-fixes

This is obviously not a solution, only for troubleshooting. Could someone more knowledgeable about dynamic linking in Nix to have a look at this now that we know what our issue is?

While doing this I have also discovered that the chronic stuttering issue (1-3 purple spikes ever second or so) is greatly reduced or even completely eliminated (depending on the mood of SteamVR) when a preloaded ${pkgs.steamPackages.steam-runtime}/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 replaces the libSDL from the SteamVR bin it'd normally try to load. This can also be achieved by replacing the lib with a symlink to the one in the steamrt.
I'd love to hear more reports on this so that we can take this information to Valve as I had the same issue on Pop!_OS.

Notify maintainers

@jagajaga @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:

Activity

  1. added
    0.kind: bug
    on Jul 9, 2020
  2. added
    6.topic: steam
    on Jul 10, 2020
  3. Atemu commented on Jul 28, 2020

    @Atemu
    MemberAuthor

    FIxed by #55973

  4. added a commit that references this issue on Nov 6, 2020
    6b094f1
  5. pwaller commented on Jan 13, 2023

    @pwaller
    Contributor

    This was working for me in the past, but seems broken again currently.

    Fri Jan 13 14:01:11 GMT 2023 - Error: setcap of vrcompositor-launcher failed.
    

    nixos-unstable @ a518c77

  6. pwaller commented on Jan 13, 2023

    @pwaller
    Contributor

    Oh, there was a hidden background dialog with 'OK, proceed anyway' which did work, so maybe the error can be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bug6.topic: steam

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions