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

umu package for Nix is not packaged correctly #106

Closed
LovingMelody opened this issue May 20, 2024 · 33 comments · Fixed by #107
Closed

umu package for Nix is not packaged correctly #106

LovingMelody opened this issue May 20, 2024 · 33 comments · Fixed by #107
Labels
bug Something isn't working

Comments

@LovingMelody
Copy link
Contributor

The nix flake does not seem to have umu packaged correctly

Problem 1: Python3 is not included in the path

When attempting to run umu with the following command:

GAMEID=umu-starcitizen umu RSI-Setup-1.6.10.exe

I get the error /usr/bin/env: ‘python3’: No such file or directory

Problem 2: Read-only umu_version.json

After creatiing a new nix shell with python3 in the path with nix-shell -p python3 I noticed that on the second execution I receive an error from the copied umu_version.json

ERROR:  BaseException
Traceback (most recent call last):
  File "/nix/store/jw8hv4cdgw4sp1g26m95jzlygz4fmzxq-umu-launcher-0.1/share/umu/umu_run.py", line 451, in <module>
    sys.exit(main())
  File "/nix/store/jw8hv4cdgw4sp1g26m95jzlygz4fmzxq-umu-launcher-0.1/share/umu/umu_run.py", line 439, in main
    future.result()
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/nix/store/jw8hv4cdgw4sp1g26m95jzlygz4fmzxq-umu-launcher-0.1/share/umu/umu_util.py", line 163, in setup_umu
    return _update_umu(local, json, _get_json(local, CONFIG))
  File "/nix/store/jw8hv4cdgw4sp1g26m95jzlygz4fmzxq-umu-launcher-0.1/share/umu/umu_util.py", line 258, in _update_umu
    with local.joinpath(CONFIG).open(mode="w", encoding="utf-8") as file:
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/pathlib.py", line 1044, in open
    return io.open(self, mode, buffering, encoding, errors, newline)
PermissionError: [Errno 13] Permission denied: '/home/melody/.local/share/umu/umu_version.json'

I'm assuming this issue is from the file being copied from the nix store which is readonly, running stat ~/.local/share/umu/umu_version.json confirms this as the files perms are 0444


Tagging @beh-10257 based on PR #73

@beh-10257
Copy link
Contributor

beh-10257 commented May 20, 2024

@LovingMelody
OK I can reproduce the issue gonna be fixed a temporary fix is to install python globally
(I never noticed the issue in the first place since it was installed globally)
I can't promise I can fix the problem by tomorrow since I have kinda my finals tomorrow so yeah

other than that about problem 2 probably the other maintainers are more fit to the job than me

EDIT: yeah I'll do this tomorrow and sorry if I couldn't as well
I will do this as soon as I can

R1kaB3rN added a commit that referenced this issue May 21, 2024
@R1kaB3rN
Copy link
Member

@LovingMelody Thanks for reporting this. The permission error should be addressed in be38d0f

@beh-10257
Copy link
Contributor

beh-10257 commented May 21, 2024

@R1kaB3rN quick question can I just send a patch file no need to a new pr its literally a one line fix

edit github donesn't support .patch extention soooooo

0001-added-python3-into-dependencies-in-nix.txt
0002-updated-nixpkgs-to-latest.txt

just rename .txt to .patch I guess sorry again

the first patch is adding python as a dependency and second is to update the repository to latest patch

@R1kaB3rN
Copy link
Member

Sure, no problem and they were merged in deee504

@LovingMelody If you can, please confirm if both problems were solved.

@LovingMelody
Copy link
Contributor Author

LovingMelody commented May 21, 2024

Looks like the package is still broken, but does not seem to be from the mentioned issues. Adding glibc to global fixes it.

Side Note: umu-proton also fails to run, using proton-ge-bin from the nixpkgs

PROTONPATH=/nix/store/cik4w6p4fcxgh560fzj3p69v1iq55bag-proton-ge-bin-GE-Proton9-5-steamcompattool GAMEID=umu-starcitizen umu RSI-Setup-1.6.10.exe
ERROR:  BaseException
Traceback (most recent call last):
  File "/nix/store/29n2s925v2lcabh5asmy25ldqqzb9a6w-umu-launcher-0.1/share/umu/umu_run.py", line 461, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/29n2s925v2lcabh5asmy25ldqqzb9a6w-umu-launcher-0.1/share/umu/umu_run.py", line 440, in main
    set_env(env, args)
  File "/nix/store/29n2s925v2lcabh5asmy25ldqqzb9a6w-umu-launcher-0.1/share/umu/umu_run.py", line 238, in set_env
    enable_steam_game_drive(env)
  File "/nix/store/29n2s925v2lcabh5asmy25ldqqzb9a6w-umu-launcher-0.1/share/umu/umu_run.py", line 282, in enable_steam_game_drive
    if not Path(path).is_symlink() and Path(path, libc).is_file():
                                       ^^^^^^^^^^^^^^^^
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/pathlib.py", line 871, in __new__
    self = cls._from_parts(args)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/pathlib.py", line 509, in _from_parts
    drv, root, parts = self._parse_args(args)
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/k3701zl6gmx3la7y4dnflcvf3xfy88kh-python3-3.11.9/lib/python3.11/pathlib.py", line 493, in _parse_args
    a = os.fspath(a)
        ^^^^^^^^^^^^
TypeError: expected str, bytes or os.PathLike object, not NoneType

@LovingMelody
Copy link
Contributor Author

Made an attempt at fixing it thinking it was simply the LD path being specified not being correct, but seems to have not resolved the problem. You can find my attempt here:
https://github.com/LovingMelody/umu-launcher/tree/update-nix-package

@LovingMelody
Copy link
Contributor Author

After a discussion in the nix matrix commit 6c6ec71 seems to have caused this, the libc path will need to be hard coded (can be done in the nix package) or completely removed. Removing the line seems to fix the issue entirely on nix

@beh-10257
Copy link
Contributor

sorry for not showing up earlier, (I really should go study lol) so my question is

so there is no problem in that LD path right, I still understand it as where should steam think the linked libraries are
also will that pr you made will fix the problem of glibc

also to be honest if you understand what that variable does and my understanding is wrong it will be nice if you can fix that

@beh-10257
Copy link
Contributor

also this seems to be only an issue when proton from nixpkgs is being used since I never manually installed glibc globally
image
so so yeah though about mentioning that

@LovingMelody
Copy link
Contributor Author

LovingMelody commented May 21, 2024

LD_LIBRARY_PATH tells ld where to find dynamic libraries. Often, we have to patch binaries because of this. There's a simple Nix wiki entry on how to do this. This issue isn't related to the proton-ge binary itself; I am simply telling umu where to find proton-ge to use that instead. The PR I submitted just removes an incorrect heuristic and doesn't touch the flake itself.

As for how to set LD_LIBRARY_PATH, the correct way to do so is to let buildFHSEnv handle it. If you need to set the path manually, /lib64 or /lib32 is not correct. It should look more like this:

libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib gcc ];

Edit: Adding an example from nixpkgs: https://github.com/NixOS/nixpkgs/blob/3d30d46d885a38deda5353b9cba46fee6792ffa7/pkgs/games/adom/default.nix#L8

@R1kaB3rN
Copy link
Member

After a discussion in the nix matrix commit 6c6ec71 seems to have caused this, the libc path will need to be hard coded (can be done in the nix package) or completely removed. Removing the line seems to fix the issue entirely on nix

I attempted to address the TypeError in this branch https://github.com/Open-Wine-Components/umu-launcher/tree/nix.

I'm interested in knowing the value of LD_LIBRARY_PATH that is defined in the Flake. Do you mind setting UMU_LOG=debug and launching the game again?

@R1kaB3rN
Copy link
Member

As for how to set LD_LIBRARY_PATH, the correct way to do so is to let buildFHSEnv handle it. If you need to set the path manually, /lib64 or /lib32 is not correct. It should look more like this:

libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib gcc ];

Edit: Adding an example from nixpkgs: https://github.com/NixOS/nixpkgs/blob/3d30d46d885a38deda5353b9cba46fee6792ffa7/pkgs/games/adom/default.nix#L8

Great! I'll go ahead and apply this in the Flake to the nix branch for testing.

R1kaB3rN added a commit that referenced this issue May 21, 2024
@LovingMelody
Copy link
Contributor Author

I have added the log and the resulting umu which is likely more interesting.
https://gist.github.com/LovingMelody/a6d2eb024e1ec8af5dfd0d8878de1a43

@R1kaB3rN
Copy link
Member

R1kaB3rN commented May 21, 2024

Hmm since we can't simply use the paths returned from the dynamic linker or hard code /lib64 and /lib32, to properly reference the library paths in Nix, perhaps we can take inspiration from the official NixOS Steam package to see how it sets up the FHS environment? And since umu doesn't require the Steam client or use the Scout environment, we probably simplify things a bit too...

After looking at @LovingMelody log, library paths look to be setup incorrectly as Pressure Vessel couldn't find libcrypt in LD_LIBRARY_PATH which is a hard requirement along with glibc and the graphics drivers.

For reference, see https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#filesystem-layout

@R1kaB3rN R1kaB3rN added the bug Something isn't working label May 21, 2024
@beh-10257
Copy link
Contributor

beh-10257 commented May 21, 2024

I'm more than sure that this is a problem with this

libPath = lib.makeLibraryPath [ stdenv.cc.cc.lib gcc ];

I will try out that branch if its that yeah I guess

@beh-10257
Copy link
Contributor

please revert this commit
https://github.com/Open-Wine-Components/umu-launcher/blob/ba9d74d59cc35fa9cb23bf5895674cae73de6470/packaging/nix/umu-run.nix
@LovingMelody I don't understand how you tested that branch its lieterally impossible
image
anyway this is probably the correct line that should be used
I tested it and it runs

ldPath = lib.optionals stdenv.is64bit [ "${stdenv.cc.cc.lib}/lib64" ] ++ [ "${stdenv.cc.cc.lib}/lib32" ];

@LovingMelody
Copy link
Contributor Author

I agree taking note from steam would probably be be best route

@beh-10257
Copy link
Contributor

beh-10257 commented May 21, 2024

sir thats what was done from the begenning I lieterally said in #73 that I pretty much stole everything from steam
image

I can't reproduce glibc bug
but @LovingMelody have you tried running umu without bwrap
lieterally install any exe of a foss application and test it

@R1kaB3rN
Copy link
Member

@beh-10257
Copy link
Contributor

beh-10257 commented May 21, 2024

@R1kaB3rN
in arch or something what does this return
Path(path, libc)
it should return
/lib64/libc.so ???

@R1kaB3rN
Copy link
Member

@R1kaB3rN in arch or something what does this return Path(path, libc) it should return /lib64/libc.so ???

Arch Linux currently sources its library paths in /usr/lib and /usr/lib32, so in the loop Path(path, libc) would evaluate to /usr/lib/libc.so.6 and /usr/lib32/libc.so.6.

@beh-10257
Copy link
Contributor

In nixos its /lib64/libc.so.6 and /lib32/libc.so.6 doesn't exist
Basically this fails in @LovingMelody machine and doesn't in mine and the problem is that we both have same stuff in /lib64/
So is it working in my machine by a miracle or something

@R1kaB3rN
Copy link
Member

R1kaB3rN commented May 22, 2024

In nixos its /lib64/libc.so.6 and /lib32/libc.so.6 doesn't exist

That's strange. If it's /lib64 and /lib32 on NixOS then I think the dynamic linker should be able to find it. But since it didn't work in Melody's case, that implies it isn't guaranteed to be there. So in the umu Flake, for a consistent experience, I think it would probably be best to include its own 64-bit and 32-bit glibc without relying on that system path. Or just refer to the one in /nix/store? I believe this is what the Nix Steam package does, right?

Also, in the nix branch and setting UMU_LOG=debug, what's the value of LD_LIBRARY_PATH when you launch a game?

The constraint of the container framework is the inability to bundle glibc and the graphics drivers, so we need to ensure this value is correct for it. Basically, the paths will need to contain glibc, libcrypt.so.1 and the graphics drivers. The documentation also recommends a few others that may be required for some games. See https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#shared-libraries for details

@LovingMelody
Copy link
Contributor Author

I fell asleep & woke up, the glibc error is now gone but libcrypto.so.1.1 isn't

x86_64-linux-gnu-capsule-capture-libs: warning: Dependencies of libnvidia-pkcs11.so.550.78 not found, ignoring: Missing dependencies: Could not find "libcrypto.so.1.1" in LD_LIBRARY_PATH "/lib64:/lib32:/run/opengl-driver/lib:/run/opengl-driver-32/lib:/nix/store/6clklfp5dypal0rf19gfq84ym17lklia-pipewire-1.0.5-jack/lib", ld.so.cache, DT_RUNPATH or fallback /lib:/usr/lib
/nix/store/xjkzfvbzdy9cfrzfilmq1d4jdm92ni95-dconf-0.40.0-lib/lib/gio/modules/libdconfsettings.so: undefined symbol: g_assertion_message_cmpint
Failed to load module: /nix/store/xjkzfvbzdy9cfrzfilmq1d4jdm92ni95-dconf-0.40.0-lib/lib/gio/modules/libdconfsettings.so

@R1kaB3rN R1kaB3rN reopened this May 22, 2024
R1kaB3rN added a commit to R1kaB3rN/ULWGL-launcher that referenced this issue May 22, 2024
- Related to Open-Wine-Components#106

- This is a temporary solution until we figure out how to properly setup an environment for distributions like NixOS so the steam runtime container framework can search for key libraries in shared library paths
@beh-10257
Copy link
Contributor

@R1kaB3rN can you create a patch so I can apply it to the repo just so I can make umu print where libraries are loaded in my system if we can figure out that I guess that might help

@beh-10257
Copy link
Contributor

beh-10257 commented May 22, 2024

@LovingMelody the problem is pretty much is not in libcrypto.so.1.1 since i have the same error and it runs either way
also in nixos that package aka openssl_1_1 is end of life so I can't really force users to install it
also NixOS/nixpkgs#273064
so that error is intended
so the real issue is why did this fail

Failed to load module: /nix/store/xjkzfvbzdy9cfrzfilmq1d4jdm92ni95-dconf-0.40.0-lib/lib/gio/modules/libdconfsettings.so

there are no other error messages ??

@beh-10257
Copy link
Contributor

do any of you know what this means

getopt: symbol lookup error: /lib64/libc.so.6: undefined symbol: __tunable_is_initialized, version GLIBC_PRIVATE

@beh-10257
Copy link
Contributor

@LovingMelody try using the unstable version of nixpkgs
I know its a hassle but yeah do it
(my system is 250gb of space and I don't have space to try out stable nixpkgs)

@LovingMelody
Copy link
Contributor Author

I am on the nixos-unstable-small channel

@beh-10257
Copy link
Contributor

I was talking to a person who has same issue as you do and he fixed the issue by going to nixpkgs-unstable he was in stable version

@beh-10257
Copy link
Contributor

@LovingMelody any updates

@LovingMelody
Copy link
Contributor Author

Closing issue for now, per my previous comment, it seems to have gone away. Unable to check for another week, will re-open if the issue is still present.

@R1kaB3rN
Copy link
Member

@R1kaB3rN can you create a patch so I can apply it to the repo just so I can make umu print where libraries are loaded in my system if we can figure out that I guess that might help

If you want insight of where and which libraries are loaded within the container, please set STEAM_LINUX_RUNTIME_LOG=1 and STEAM_LINUX_RUNTIME_VERBOSE=1 to generate a Steam Linux Runtime log file. See https://github.com/Open-Wine-Components/umu-launcher?tab=readme-ov-file#development-and-debugging for details.

Also, for reference, here's a sample of a SLR log generated on the Steam Deck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants