Skip to content
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

steam: decimate #341219

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

steam: decimate #341219

wants to merge 6 commits into from

Conversation

K900
Copy link
Contributor

@K900 K900 commented Sep 11, 2024

Description of changes

This basically removes everything that's not actually necessary for Steam itself or the runtime, simplifying the package massively.

  • wait for next staging cycle
  • drop buildenv hacks

This has the side effect of potentially breaking people's uses of steam-run, which was used as a generic "escape hatch" for a lot of FHS-y things. Those need to be checked. Currently known users:

We might also want to build a generic fhs-run or whatever wrapper, long term?

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

pkgs/games/steam/fhsenv.nix Outdated Show resolved Hide resolved
@Atemu
Copy link
Member

Atemu commented Sep 11, 2024

I was under the impression that native Linux titles do not necessarily use the steam-supplied runtime by default. Only Steam itself and games that explicitly opt into it use the steam-managed runtime. AFAIK, even Proton has only started using the linux runtime since version 6.

If all of that is still true, this would break old native Linux games that rely on the runtime's old libraries and likely Proton <6.

If I'm wrong about Proton, we could think about putting the runtime only in the non-small steam.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@K900
Copy link
Contributor Author

K900 commented Sep 12, 2024

So I asked myself: how much worse can we do? And the answer is, yes. This removes, like, most of our Steam package, and replaces it with how Valve intended the runtime to work - no LD_LIBRARY_PATH hacks, no confusing linker shenanigans, and a pinch of IFD (that can be removed by improving buildEnv).

@K900 K900 changed the title steam-runtime: yeet steam: decimate Sep 12, 2024
@K900 K900 marked this pull request as draft September 12, 2024 09:11
@K900
Copy link
Contributor Author

K900 commented Sep 12, 2024

Drafting for now because of the IFD, I'll try to get the buildEnv changes going for the next staging cycle if people agree with this overall approach.

Comment on lines -270 to -283
if [ -f /etc/NIXOS ]; then # Check only useful on NixOS
${mesa-demos-i686}/bin/glxinfo 2>&1 | grep -q Error
# If there was an error running glxinfo, we know something is wrong with the configuration
if [ $? -eq 0 ]; then
cat <<EOF > /dev/stderr
**
WARNING: Steam is not set up. Add the following options to /etc/nixos/configuration.nix
and then run \`sudo nixos-rebuild switch\`:
{
hardware.graphics.enable32Bit = true;
hardware.pulseaudio.support32Bit = true;
}
**
EOF
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should at least move it into the description

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this check has actually ever worked properly tbh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it worked after I fixed it in 7f97252

@K900 K900 force-pushed the steamus-yeetus branch 5 times, most recently from 26ea751 to 353db8b Compare September 12, 2024 12:27
@K900
Copy link
Contributor Author

K900 commented Sep 12, 2024

buildEnv bits going to staging: #341371

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

Can you try running the whole thing with LD_DEBUG=libs?

@fabianhjr
Copy link
Member

debug_steam.log

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

That looks cut off...

@fabianhjr
Copy link
Member

was LD_DEBUG=libs steam &> debug_steam.log, was also finding it odd that that didn't include the core dump message :s

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

It's also missing any attempts to load gdk-pixbuf. Can you try steam-run bash and then LD_DEBUG=libs steam maybe?

@fabianhjr
Copy link
Member

fabian@nixos ~/D/O/n/main (main)> LD_DEBUG=libs steam &> debug_steam.log
fabian@nixos ~/D/O/n/main (main)> wc -l debug_steam.log
4307 debug_steam.log
fabian@nixos ~/D/O/n/main (main)> steam-run bash

[fabian@nixos:~/Development/Open/nixpkgs/main]$ LD_DEBUG=libs steam &> debug_steam.bash.log

[fabian@nixos:~/Development/Open/nixpkgs/main]$ wc -l debug_steam.bash.log
3881 debug_steam.bash.log

[fabian@nixos:~/Development/Open/nixpkgs/main]$

debug_steam.bash.log
debug_steam.log

@fabianhjr
Copy link
Member

Does have some glib entries though

rg --pcre2 "glib(?!c)" debug_steam.bash.log -C 2 > glib-entries.txt

glib-entries.txt

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

This is still very strange. Can you try nix-shell -p pkgsi686Linux.mesa-demos --command steam-run glxinfo?

@fabianhjr
Copy link
Member

nix shell .#pkgsi686Linux.mesa-demos
steam-run glxinfo | head -n 50
name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context,
    GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
    GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
    GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample,
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
    GLX_EXT_get_drawable_type, GLX_EXT_libglvnd, GLX_EXT_no_config_context,
    GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
    GLX_MESA_copy_sub_buffer, GLX_OML_swap_method, GLX_SGIS_multisample,
    GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,
    GLX_SGI_make_current_read
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context,
    GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
    GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
    GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address, GLX_ARB_multisample,
    GLX_ATI_pixel_format_float, GLX_EXT_buffer_age,
    GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile,
    GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
    GLX_EXT_import_context, GLX_EXT_no_config_context, GLX_EXT_swap_control,
    GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_INTEL_swap_event,
    GLX_MESA_copy_sub_buffer, GLX_MESA_gl_interop, GLX_MESA_query_renderer,
    GLX_MESA_swap_control, GLX_NV_float_buffer, GLX_OML_sync_control,
    GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
    GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
    GLX_SGI_swap_control, GLX_SGI_video_sync
GLX version: 1.4
GLX extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context,
    GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
    GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
    GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address, GLX_ARB_multisample,
    GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile,
    GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float,
    GLX_EXT_framebuffer_sRGB, GLX_EXT_no_config_context, GLX_EXT_swap_control,
    GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap,
    GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_MESA_copy_sub_buffer,
    GLX_MESA_gl_interop, GLX_MESA_query_renderer, GLX_MESA_swap_control,
    GLX_OML_sync_control, GLX_SGIS_multisample, GLX_SGIX_fbconfig,
    GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
    GLX_SGI_video_sync

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

This is very weird. Do you have any LD_* variables set in your environment maybe?

@fabianhjr
Copy link
Member

Nothing

fabian@nixos ~/D/O/n/main (main)> set | rg "^LD"
fabian@nixos ~/D/O/n/main (main) [0|1]>

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

@fabianhjr
Copy link
Member

fabian@nixos ~/D/O/n/main (main)> set | rg "^STEAM"
fabian@nixos ~/D/O/n/main (main) [0|1]>

Neither

@fabianhjr
Copy link
Member

Just as sanity check this does work with XDG

fabian@nixos ~/D/O/n/main (main) [0|1]> set | rg "^XDG"
XDG_CONFIG_DIRS /etc/xdg:/home/fabian/.nix-profile/etc/xdg:/nix/profile/etc/…
XDG_CURRENT_DESKTOP GNOME
XDG_DATA_DIRS /nix/store/8appd5xkba82ci144pynb4f722khaqav-shared-mime-info…
XDG_MENU_PREFIX gnome-
XDG_RUNTIME_DIR /run/user/1000
XDG_SESSION_CLASS user
XDG_SESSION_DESKTOP gnome
XDG_SESSION_TYPE wayland
fabian@nixos ~/D/O/n/main (main)>

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

And if you run it with STEAM_RUNTIME_DEBUG=1?

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

Actually, here's another crazy idea. What if you remove ~/.local/share/Steam and try to rebootstrap?

@fabianhjr
Copy link
Member

fabianhjr commented Sep 20, 2024

will attempt, currently learning some gdb in hopes of getting a better clue of what is happening.


fabian@nixos ~/D/O/n/main (main)> gdb -q --args /nix/store/qn958zb91mvdhxinpwg2j90kc85xvrj6-bash-5.2p32/bin/bash /run/current-system/sw/bin/steam
Reading symbols from /nix/store/qn958zb91mvdhxinpwg2j90kc85xvrj6-bash-5.2p32/bin/bash...
(No debugging symbols found in /nix/store/qn958zb91mvdhxinpwg2j90kc85xvrj6-bash-5.2p32/bin/bash)
(gdb) catch exec
Catchpoint 1 (exec)
(gdb) run
Starting program: /nix/store/qn958zb91mvdhxinpwg2j90kc85xvrj6-bash-5.2p32/bin/bash /run/current-system/sw/bin/steam
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/vsghkzdz0yrmpz7m4dg2xw73vkl2l6m2-glibc-2.39-52/lib/libthread_db.so.1".
[Detaching after fork from child process 337343]
[Detaching after fork from child process 337344]
[Detaching after fork from child process 337345]
[Detaching after fork from child process 337346]
[Detaching after fork from child process 337347]
[Detaching after fork from child process 337348]
process 337330 is executing new program: /nix/store/xnw7asxni3093d1m061amzxjikyskrc8-bubblewrap-0.10.0/bin/bwrap

Catchpoint 1 (exec'd /nix/store/xnw7asxni3093d1m061amzxjikyskrc8-bubblewrap-0.10.0/bin/bwrap), 0x00007ffff7fe4580 in _start ()
   from /nix/store/vsghkzdz0yrmpz7m4dg2xw73vkl2l6m2-glibc-2.39-52/lib/ld-linux-x86-64.so.2

well didn't help much :|

(gdb) core-file /tmp/dumps/assert_20240919231739_8.dmp
"/tmp/dumps/assert_20240919231739_8.dmp" is not a core dump: file format not recognized

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

Yeah, those are breakpad dumps, not something you can immediately shove into gdb. Actually, here's another crazy idea: what if you env -i steam?

@fabianhjr
Copy link
Member

27 directories, 17 files
fabian@nixos ~/D/O/n/main (main)> rm -rf ~/.local/share/Steam/ubuntu12_32/
fabian@nixos ~/D/O/n/main (main)> rm -rf ~/.local/share/Steam/ubuntu12_64
fabian@nixos ~/D/O/n/main (main)> rm -rf ~/.local/share/Steam/linux32
fabian@nixos ~/D/O/n/main (main)> rm -rf ~/.local/share/Steam/linux64
fabian@nixos ~/D/O/n/main (main)> steam
steam.sh[338129]: Running Steam on nixos 24.11 64-bit
steam.sh[338129]: STEAM_RUNTIME is enabled automatically
steam.sh[338129]: Unpack runtime failed, error code 1
steam.sh[338129]: Error: Couldn't set up the Steam Runtime. Are you running low on disk space?
Continuing...
/home/fabian/.local/share/Steam/steam.sh: line 95: LD_LIBRARY_PATH: unbound variable
fabian@nixos ~/D/O/n/main (main) [1]> rm -rf ~/.local/share/Steam/steam/
fabian@nixos ~/D/O/n/main (main)> steam
steam.sh[338307]: Running Steam on nixos 24.11 64-bit
steam.sh[338307]: STEAM_RUNTIME is enabled automatically
steam.sh[338307]: Unpack runtime failed, error code 1
steam.sh[338307]: Error: Couldn't set up the Steam Runtime. Are you running low on disk space?
Continuing...
/home/fabian/.local/share/Steam/steam.sh: line 95: LD_LIBRARY_PATH: unbound variable
fabian@nixos ~/D/O/n/main (main) [1]> rm -rf ~/.local/share/Steam/steam.sh
fabian@nixos ~/D/O/n/main (main)> steam

this caused steam to redownload something (not a lot) but still crashed

fabian@nixos ~/D/O/n/main (main)> rm -rf ~/.local/share/Steam/
fabian@nixos ~/D/O/n/main (main)> steam

this caused steam to redownload about 468 MB but also crashed

@fabianhjr
Copy link
Member

env -i steam
/home/fabian/.local/share/Steam/steam.sh: line 664: HOME: unbound variable

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

How about env -i HOME=$HOME steam?

@fabianhjr
Copy link
Member

Oh this is more interesting

env -i HOME=$HOME steam
steam.sh[351601]: Running Steam on nixos 24.11 64-bit
steam.sh[351601]: STEAM_RUNTIME is enabled automatically
setup.sh[351671]: Steam runtime environment up-to-date!
steam.sh[351601]: Steam client's requirements are satisfied
[2024-09-19 23:28:28] Startup - updater built Sep 17 2024 20:02:19
[2024-09-19 23:28:28] Startup - Steam Client launched with: '/home/fabian/.local/share/Steam/ubuntu12_32/steam' '-srt-logger-opened'
09/19 23:28:28 minidumps folder is set to /tmp/dumps
09/19 23:28:28 Init: Installing breakpad exception handler for appid(steam)/version(1726604483)/tid(351729)
src/steamexe/updateui_xwin.cpp (341) : Could not open connection to X
src/steamexe/updateui_xwin.cpp (341) : Could not open connection to X
09/19 23:28:28 Init: Installing breakpad exception handler for appid(steam)/version(1726604483)/tid(351729)
Error: Check your DISPLAY environment variable and make sure that you have enabled X.
If you are running remotely, make sure that you have a remote connection which will allow an X connection.

For more information visit https://support.steampowered.com/kb_article.php?ref=4050-WOJB-0608
Using host zenity for message
assert_20240919232828_4.dmp[351734]: Uploading dump (out-of-process)
/tmp/dumps/assert_20240919232828_4.dmp
src/steamexe/main.cpp (1300) : failed to initialize update status ui, or create initial window
src/steamexe/main.cpp (1300) : failed to initialize update status ui, or create initial window
09/19 23:28:28 Init: Installing breakpad exception handler for appid(steam)/version(1726604483)/tid(351729)
assert_20240919232828_7.dmp[351740]: Uploading dump (out-of-process)
/tmp/dumps/assert_20240919232828_7.dmp
Error:
Unable to open a connection to X

Check your DISPLAY environment variable and make sure that you have enabled X.
If you are running remotely, make sure that you have a remote connection which will allow an X connection.

For more information visit https://support.steampowered.com/kb_article.php?ref=4050-WOJB-0608

will attempt on xorg instead of wayland

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

env -i unsets all the environment variables, you can try giving it more of those until it can run and/or crash. I'm mostly hoping to confirm it's something in your environment that's throwing it off.

@fabianhjr
Copy link
Member

fabianhjr commented Sep 20, 2024

https://app.cachix.org/cache/steam-gcc14-gnome47 < uploaded result of nix build .#steam

https://github.com/fabianhjr/nixpkgs/tree/steam-issue < commit involved

@K900
Copy link
Contributor Author

K900 commented Sep 20, 2024

nixfmt'ed the hacked up buildenv so CI can stop being red and scary.

@ozkutuk ozkutuk mentioned this pull request Sep 20, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.