bottlesdevs / Bottles

Run Windows software and games on Linux
https://usebottles.com
GNU General Public License v3.0
6.46k stars 276 forks source link

[Bug]: Can't run unity-based games #2635

Open X9VoiD opened 1 year ago

X9VoiD commented 1 year ago

Describe the bug

When running unity-based games, it always fails with the following log:

012c:err:module:LdrInitializeThunk Importing dlls for L"Z:\\run\\user\\1000\\doc\\<random_numbers_and_letters>\\<program_file>.exe" failed, status c0000135

Do note that this only happens when using bottles, running the program purely using wine works fine. I have already given bottles the permission to access the folder where I am storing the games/apps via Flatseal.

To Reproduce

  1. Download and extract ULTRAKILL. It's a free game on itch.io that uses Unity engine.
  2. Run ULTRAKILL via bottles.

I've only used ULTRAKILL for easy reproduction, this issue occurs for all Unity-based games distributed with UnityPlayer.dll.

Package

Flatpak from Flathub

Distribution

NixOS 22.11

Debugging Information

Official Package: true
Version: '50.2'
DE/WM: null
Display:
    X.org: true
    X.org (port): :0
    Wayland: true
Graphics:
    vendors:
        intel:
            vendor: intel
            envs:
                DRI_PRIME: '1'
            icd: /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/intel_icd.x86_64.json:/usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/intel_hasvk_icd.x86_64.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/intel_icd.i686.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/intel_hasvk_icd.i686.json
    prime:
        integrated: null
        discrete: null
Kernel:
    Type: Linux
    Version: 6.1.7
Disk:
    Total: 4100513792
    Free: 4100366336
RAM:
    MemTotal: 7.6GiB
    MemAvailable: 4.1GiB
Bottles_envs: null

Troubleshooting Logs

0134:err:module:import_dll Library UnityPlayer.dll (which is needed by L"Z:\\run\\user\\1000\\doc\\597bb8c4\\ULTRAKILL.exe") not found
0134:err:module:LdrInitializeThunk Importing dlls for L"Z:\\run\\user\\1000\\doc\\597bb8c4\\ULTRAKILL.exe" failed, status c0000135

Additional context

No response

TheEvilSkeleton commented 1 year ago

Thanks for reporting. It seems like the XDG FileChooser portal is pointing the file to the sandboxed directory (/run/user/1000/doc/... in the troubleshooting logs) instead of using the original path. So, Bottles is unnecessarily running from the sandboxed directory despite having full access to the directory you allowed with Flatseal, which means that UnityPlayer.dll is not discovered in the sandboxed directory.

I tested locally; I stopped and masked xdg-desktop-portal.service xdg-desktop-portal-gnome.service xdg-desktop-portal-gtk.service services using systemctl, which forces to not use the FileChooser portal, and I can confirm that ULTRAKILL was running afterwards, as it wasn't pointing the file to the sandboxed directory.

This is a very unfortunate case for Bottles where we don't really have any control over, as it is inherently a Flatpak/XDG FileChooser portal limitation. We need to wait until https://github.com/flatpak/xdg-desktop-portal/issues/463 is resolved, to fully resolve this issue. Sorry.

Is it okay to share your DE or WM? I can reproduce it on GNOME, but I'd like to open an issue in the correct issue tracker and see if we can work around it.

orowith2os commented 1 year ago

Could you try to reproduce this with other apps too, like Lutris? If it is a bug in the portal it'll happen in other apps too, if not then this is a very interesting issue.

TheEvilSkeleton commented 1 year ago

I tried ASHPD, gave access to xdg-download, and opened ULTRAKILL.exe, yet strangely ASHPD showed the correct filesystem path.

I also tried 50.1, 2022-12-17 and 2022.11.14 to test regressions, but the results were consistent.

I'm not sure why this only happens with Bottles...

orowith2os commented 1 year ago

I think we can keep the blocked tag, its somewhat relevant.

Qronikarz commented 1 year ago

Joining in to say I have no issues running this game or any Unity games. I also tested this game and was able to finish the tutorial (up to the point of getting a gun and first fight). Here's the usual debug info from Bottles:

Official Package: true
Version: '50.2'
DE/WM: cinnamon
Display:
    X.org: true
    X.org (port): :99.0
    Wayland: false
Graphics:
    vendors:
        amd:
            vendor: amd
            envs:
                DRI_PRIME: '1'
            icd: /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/radeon_icd.x86_64.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/radeon_icd.i686.json
    prime:
        integrated: null
        discrete: null
Kernel:
    Type: Linux
    Version: 5.15.0-58-generic
Disk:
    Total: 8356999168
    Free: 8356851712
RAM:
    MemTotal: 15.6GiB
    MemAvailable: 13.0GiB
Bottles_envs: null

Running Bottles from terminal doesn't give any output when running the game.

orowith2os commented 1 year ago

Thank you for testing @MrQuerter, I guess that narrows it down to a portal impl issue. We'll have to wait on @X9VoiD to return their DE/WM, as their debug info doesn't show it. From there, it's submitting an issue to the appropriate portal. Hopefully.

X9VoiD commented 1 year ago

I use swaywm.

X9VoiD commented 1 year ago

For the meantime, allowing full access via filesystem=host makes the issue go away but I don't think it's the solution we wanted.

TheEvilSkeleton commented 1 year ago

Correct. Recently we fully allowed xdg-download to avoid that issue... but it hasn't.

TheEvilSkeleton commented 1 year ago

@MrQuerter and @X9VoiD, what version of xdg-desktop-portal are you using on your system?

Qronikarz commented 1 year ago

xdg (name - installed version - newest version) Could it be a Wayland issue? Wouldn't explain the issue I get on development version, but idk.

X9VoiD commented 1 year ago
xdg-desktop-portal 1.16.0
xdg-desktop-portal-gtk 1.14.1
TheEvilSkeleton commented 1 year ago

Could it be a Wayland issue? Wouldn't explain the issue I get on development version, but idk.

I doubt it is. X9VoiD and I are using xdg-desktop-portal 1.15.0 and 1.16.0 respectively, where we're both affected by this. You're using 1.14.4, but you are unaffected. This could be a regression introduced in a version later than 1.14.4.

orowith2os commented 1 year ago

Maybe it's a locale issue? It could be happening on non-English-only systems and be working fine on English-only ones. That seems pretty likely.

TheEvilSkeleton commented 1 year ago

I use an English-only system.

Qronikarz commented 1 year ago

I use Polish system with Bottles forced to English for bug reports (using Flatseal LANGUAGE:en variable since you can't choose program language in Bottles yet)

MilkyWayboi commented 1 year ago

I have the exact same issue, im using the same WM but im using cinnamon as my DE when i used garuda, it worked, i was using kde version it could be smt else tho, maybe garuda set smt up

MilkyWayboi commented 1 year ago

im pretty sure garuda uses the same WM

MooMew64 commented 1 year ago

Dunno if this works for all Unity games or not but I was able to get Isekai Mario (a Unity Game obtained through itch.io) working in Bottles by opening Flatseal and adding the game's UnityPlayer.dll's path under the 'files' category.

IE:

/home/USER/.config/itch/apps/isekai-mario/Isekai Mario/UnityPlayer.dll

Itch by default stores games in a directory that's located in .config, so my guess is permissions get funky. Giving the sandbox the exact file lets the game load without having to compromise security by letting the sandbox use filesystem=host.

catgirlcataclysm commented 8 months ago

I know its been a while, but it seems to still be happening. I'm running into this issue too.

Im on arch linux with KDE Plasma 6 on wayland.

Malix-Labs commented 4 months ago

Same problem currently, tested with Getting Over It on Fedora 40 Silverblue, Wayland, Flatpak

Qronikarz commented 4 months ago

Getting mixed results with Mint 22

I tried running ULTRAKILL with 5 methods:

  1. Normally by placing the game files inside bottles folder - works without problems and without Flatseal
  2. Placed in /home/username/Games - when using the "launch with terminal" button it gives this error: wine: failed to open "/home/username/Games/ultrakill/ULTRAKILL.exe": c0000135
  3. Placed in /home/username/Games with Flatseal filesystem other files /home/username/Games permission. It works without problems
  4. Placed in /home/username/Obrazy - without giving any permissions:
    002c:err:seh:install_bpf Native libs are being loaded in low addresses, sc_seccomp 0x6ffd9a7b78f0, syscall 0x6ffd9a986930, not installing seccomp.
    002c:err:seh:install_bpf The known reasons are /proc/sys/vm/legacy_va_layout set to 1 or 'ulimit -s' being 'unlimited'.
    0024:err:module:import_dll Library UnityPlayer.dll (which is needed by L"Z:\\run\\user\\1000\\doc\\1e463466\\ULTRAKILL.exe") not found
    0024:err:module:loader_init Importing dlls for L"Z:\\run\\user\\1000\\doc\\1e463466\\ULTRAKILL.exe" failed, status c0000135
  5. Placed in /home/username/Obrazy with Flatseal filesystem other files xdg-pictures or /home/username/Obrazy
    0024:err:module:import_dll Library UnityPlayer.dll (which is needed by L"Z:\\run\\user\\1000\\doc\\1e463466\\ULTRAKILL.exe") not found
    0024:err:module:loader_init Importing dlls for L"Z:\\run\\user\\1000\\doc\\1e463466\\ULTRAKILL.exe" failed, status c0000135

home/username/Games is a folder created by Heroic Games Launcher (issue 3336 in their GitHub repo)

In case 1 and 3 I played the game a little longer than before to the section after obtaining the gun. I also still forced Bottles to use LANGUAGE=en because it still doesn't have language selection.

Installed xdg packages: xdgmint22

Bottles health check:

Official Package: true
Version: '51.11'
DE/WM: cinnamon
Display:
    X.org: true
    X.org (port): :0
    Wayland: false
Graphics:
    vendors:
        amd:
            vendor: amd
            envs:
                DRI_PRIME: '1'
            icd: /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/radeon_icd.x86_64.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/radeon_icd.i686.json
    prime:
        integrated: null
        discrete: null
Kernel:
    Type: Linux
    Version: 6.8.0-36-generic
Disk:
    Total: 8352456704
    Free: 8352292864
RAM:
    MemTotal: 15.6GiB
    MemAvailable: 12.8GiB
Bottles_envs: null
ghost commented 4 months ago

Same issue with Unity games on Fedora Silverblue. UnityPlayer.dll not found, Flatseal permissions don't help with it. EDIT: Strangely it works now, just had to allow access to "~/Games"