For background info, Steam Play is Valve's new compatibility layer that allows you to run any Windows-only game as long as you have Steam installed. Here is the announcement.
The feature partially works on NixOS. It allows you run a Windows game for about a minute but it eventually crashes with error eventfd: Too many open files
. This issue is documented here and is ultimately because the linux kernel is not configured to support enough file descriptors. Running ulimit -Hn
, I get a result of 4096 file descriptors per process.
This is not the first time this issue has caused problems for NixOS. See https://github.com/NixOS/nix/issues/875 and https://github.com/NixOS/nixpkgs/issues/22454. For modules, I see here that it is possible to increase the limit. Is this possible to do so on a per-package basis (for steam)? Or should this limit be increased globally for the entire distro?
Please run nix-shell -p nix-info --run "nix-info -m"
and paste the
results.
[owner@Taha-Desktop-Linux:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 4.14.63, NixOS, 18.09pre149415.8395f9aa85e (Jellyfish)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.0.4`
- channels(owner): `"nixos-18.09pre145524.2a8a5533d18, stable-18.03.132845.5e10df3982d"`
- channels(root): `"nixos-18.09pre149415.8395f9aa85e, stable-18.03.133017.0e55dde2eaa"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
In the mean time, I've fixed the issue by adding this to my config:
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
I realize now that the limit was increased in modules by modifying a systemd service. Steam doesn't use a systemd service so I guess that is not possible. I will leave the issue to be closed by a dev or steam package maintainer (to notify them of this issue with default NixOS settings).
I played Sonic Mania for a while (probs 40 minutes) and didn't hit this problem. Is it only certain games?
According to this document, "esync creates one eventfd descriptor for each synchronization object". Honestly, I don't fully understand what a "synchronization object" is but it appears that some games require more synchronization objects. The game I tested was Quake Live.
Steam uses buildFHSUserEnv
which internally creates a user namespace. This namespace will be limited to your user namespace's ulimit, so ultimately the fix is either to raise the ulimit globally in systemd or configure a separate user with a higher ulimit and run steam as that user.
Another option is to disable esync via PROTON_NO_ESYNC=1
. You can set this per-game in Steam's launch options (PROTON_NO_ESYNC=1 %command%
) or in Steam's environment.
@tgharib Did you package the new version of steam yourself? The version in the repo seems to be pretty far out of date.
@Wolfereign Steam installs itself to the user's home on first boot (~/.local/share/Steam
) so the package version doesn't really matter.
Incidentally, I've found that Steam Play doesn't work at all unless I override with steam.override { nativeOnly = true; }
.
@tadfisher Thank you for the info. I haven't tried to install Steam yet but that cleared up alot of confusion that I had. My apologies for derailing the thread a bit.
Incidentally, I've found that Steam Play doesn't work at all unless I override with steam.override { nativeOnly = true; }.
@tadfisher what nixos version are you on? I just found out native is marked broken both in master and 18.03. Still, I confirm it works for me and indeed I could play a game with steam play that was not working without the override
@abbradar is it still segfaulting for you?
As for the ulimit issue, this works for me:
# Set limits for esync.
systemd.extraConfig = "DefaultLimitNOFILE=1048576";
security.pam.loginLimits = [{
domain = "*";
type = "hard";
item = "nofile";
value = "1048576";
}];
I have played some (older) games using Steam play and never had such problems. So it's not a general issue but affect only some games.
I also did not experience issues with Steam Play on NixOS. It's probably a very specific game (issue suggests it may be Phantom Doctrine, but I don't feel like purchasing a game only to check that) that crashes without increasing the file handle limit.
I can't remember why I subscribed to this issue a couple years ago, but I've also been using Steam Play on NixOS for quite a while now without this issue.
I marked this as stale due to inactivity. → More info
By now there is an option programs.steam.enable = true;
but it does not change the file handle limit. Might be an option to add it
On NixOS 20.09 I get a much higher file handle limit. This may have been changed by systemd or something, as I don't see anything setting such a value in NixOS (fs.inotify.max_user_watches
is unrelated by the way, the value of ulimit -Hn
is 524288
even on systems without X server). Considering the limit was increased by something, I don't think programs.steam.enable
does need to do it explicitly.
$ ulimit -Hn
524288
Great, looks like this issue is resolved :tada:
Most helpful comment
I can't remember why I subscribed to this issue a couple years ago, but I've also been using Steam Play on NixOS for quite a while now without this issue.