Matoking / protontricks

A wrapper that does winetricks things for Proton enabled games, requires Winetricks.
GNU General Public License v3.0
1.62k stars 34 forks source link

binary_loads() got an unexpected keyword argument 'key_table' #326

Open Krypt0nC0R3 opened 1 month ago

Krypt0nC0R3 commented 1 month ago

Describe the bug Installed protontricks via pipx command form https://github.com/Matoking/protontricks/issues/304#issuecomment-2220599470

To Reproduce Steps to reproduce the behavior:

  1. Run command protontricks --gui
  2. Select any game
  3. Command fails and error is displayed

    • Distro: Ubuntu 24.04
    • Protontricks installation method: pipx
    • Protontricks version: protontricks (1.11.2.dev8+gf7b1fa3)
    • Steam Families Beta

If I install the regular version via apt, I get the error SyntaxError: Invalid file magic number.

Log:


protontricks (INFO): Found Steam directory at /home/krypt0n/.steam/debian-installation
protontricks (INFO): Using default Steam Runtime at /home/krypt0n/.steam/debian-installation/ubuntu12_32/steam-runtime
protontricks (INFO): WINETRICKS environment variable is not available. Searching from $PATH.
protontricks (DEBUG): Found Steam library folder /home/krypt0n/.steam/debian-installation. Is Flatpak path: False, Is XDG Steam path: False.
protontricks (INFO): Found 1 Steam library folders
protontricks (DEBUG): Following inaccessible paths were found: set()
protontricks (DEBUG): Following paths have been ignored: set()
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_2805730.acf
protontricks (DEBUG): Found compatdata directories for app 2805730: [PosixPath('/home/krypt0n/.steam/debian-installation/steamapps/compatdata/2805730/pfx')]
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_1282730.acf
protontricks (DEBUG): Found compatdata directories for app 1282730: []
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_1628350.acf
protontricks (DEBUG): Found compatdata directories for app 1628350: []
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_1296610.acf
protontricks (DEBUG): Found compatdata directories for app 1296610: [PosixPath('/home/krypt0n/.steam/debian-installation/steamapps/compatdata/1296610/pfx')]
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_228980.acf
protontricks (DEBUG): Found compatdata directories for app 228980: []
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_1493710.acf
protontricks (DEBUG): Found compatdata directories for app 1493710: [PosixPath('/home/krypt0n/.steam/debian-installation/steamapps/compatdata/1493710/pfx')]
protontricks (DEBUG): Creating SteamApp from manifest file in /home/krypt0n/.steam/debian-installation/steamapps/appmanifest_427520.acf
protontricks (DEBUG): Found compatdata directories for app 427520: []
protontricks (DEBUG): Found Steam user entries: [{'steamid3': 219668654, 'account_name': 'cheburator_home', 'timestamp': '1723682000'}]
protontricks (INFO): Currently logged-in Steam user: cheburator_home
protontricks (INFO): Found 0 Steam shortcuts running using Steam compatibility tools
protontricks (INFO): Using 'zenity' as GUI provider
protontricks (DEBUG): Finding Steam compat tool name for appid 1296610
protontricks (DEBUG): Loading appinfo.vdf in /home/krypt0n/.steam/debian-installation/appcache/appinfo.vdf
protontricks (DEBUG): appinfo.vdf has magic number b')DV\x07'
Traceback (most recent call last):
  File "/home/krypt0n/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/main.py", line 293, in main
    proton_app = find_proton_app(
                 ^^^^^^^^^^^^^^^^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/steam.py", line 904, in find_proton_app
    tool_app = find_steam_compat_tool_app(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/steam.py", line 665, in find_steam_compat_tool_app
    appinfo_sections = [
                       ^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/steam.py", line 585, in iter_appinfo_sections
    yield from _iter_v29_appinfo(data, i)
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/steam.py", line 552, in _iter_v29_appinfo
    vdf_d = vdf.binary_loads(
            ^^^^^^^^^^^^^^^^^
TypeError: binary_loads() got an unexpected keyword argument 'key_table'```
Matoking commented 1 month ago

What version of pipx do you have installed (check with pipx --version)? The newest version 1.6.0 was released back in June 1st and includes this bug fix:

Install specified version of --preinstall dependency instead of latest version (#1377)

This would explain why the wrong version of vdf is being installed.


It should hopefully be possible to install the fixed version of vdf even with an older pipx, although it's a bit more involved. Start by uninstalling Protontricks, installing Protontricks and then replacing the version of vdf like so:

pipx uninstall protontricks
pipx install git+https://github.com/Matoking/protontricks.git@appinfo_v29
pipx runpip protontricks install --force-reinstall git+https://github.com/Matoking/vdf.git@support_new_bvdf
Krypt0nC0R3 commented 1 month ago

Version pipx 1.4.3, delivered via apt. Apparently this is the solution to my problem. I will update now and check.

I updated pipx to 1.6.0, ran the commands you gave above. Now this error:

pressure-vessel-wrap[24168]: E: Дочерний процесс завершился с кодом 1: bwrap: setting up uid map: Permission denied

Traceback (most recent call last):
  File "/home/krypt0n/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/main.py", line 307, in main
    run_command(
  File "/home/krypt0n/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/util.py", line 516, in run_command
    raise RuntimeError(
RuntimeError: bwrap launcher crashed, returncode: 1
L7vanmatre commented 4 weeks ago

What version of pipx do you have installed (check with pipx --version)? The newest version 1.6.0 was released back in June 1st and includes this bug fix:

Install specified version of --preinstall dependency instead of latest version (#1377)

This would explain why the wrong version of vdf is being installed.

It should hopefully be possible to install the fixed version of vdf even with an older pipx, although it's a bit more involved. Start by uninstalling Protontricks, installing Protontricks and then replacing the version of vdf like so:

pipx uninstall protontricks
pipx install git+https://github.com/Matoking/protontricks.git@appinfo_v29
pipx runpip protontricks install --force-reinstall git+https://github.com/Matoking/vdf.git@support_new_bvdf

I also have pipx version 1.4.3. (Though as mentioned in the other issue, it does have the --preinstall option)

I've ran the commands you've given. What version of VDF is it meant to install? I've noticed the --force-reinstall command uninstalls vdf-3.4 and installs vdf-3.4 again.

pipx runpip protontricks install --force-reinstall git+https://github.com/Matoking/vdf.git@support_new_bvdf
Collecting git+https://github.com/Matoking/vdf.git@support_new_bvdf
  Cloning https://github.com/Matoking/vdf.git (to revision support_new_bvdf) to /tmp/pip-req-build-wghi7lvt
  Running command git clone --filter=blob:none --quiet https://github.com/Matoking/vdf.git /tmp/pip-req-build-wghi7lvt
  Running command git checkout -b support_new_bvdf --track origin/support_new_bvdf
  Switched to a new branch 'support_new_bvdf'
  branch 'support_new_bvdf' set up to track 'origin/support_new_bvdf'.
  Resolved https://github.com/Matoking/vdf.git to commit 981cad270c2558aeb8eccaf42cfcf9fabbbed199
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: vdf
  Building wheel for vdf (pyproject.toml) ... done
  Created wheel for vdf: filename=vdf-3.4-py3-none-any.whl size=10622 sha256=bd22d1df934e7d9cef773ab89d5d3d21f0cad0c05a03b58070e3da4eea0ef039
  Stored in directory: /tmp/pip-ephem-wheel-cache-3yxw5sq_/wheels/20/dd/47/ff16b41edbb73c8e79a4496ec793d262e7df3b8e8b36735c79
Successfully built vdf
Installing collected packages: vdf
  Attempting uninstall: vdf
    Found existing installation: vdf 3.4
    Uninstalling vdf-3.4:
      Successfully uninstalled vdf-3.4
Successfully installed vdf-3.4

After running this, I also get the bwrap launcher crashed error.

Matoking commented 4 weeks ago

I'm guessing if you're running on Ubuntu this could be the AppArmor related issue reported in #314? See this comment for details.

L7vanmatre commented 4 weeks ago

I'm guessing if you're running on Ubuntu this could be the AppArmor related issue reported in #314? See this comment for details.

Here is the output logs for that. I gave an extra newline for what looks potentially relevant.

Aug 18 19:23:16 Lunux plasmashell[45049]: console.warn: LoginRecipes: "Falling back to a synchronous message for: https://github.com."
Aug 18 19:23:18 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:18 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:18 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:19 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:19 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:19 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:19 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:19 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:19 Lunux plasmashell[44747]: console.warn: "This Event is registered in System: [object KeyboardEvent]"
Aug 18 19:23:46 Lunux systemd[4063]: app-protontricks-e3f80bce3ada4869b8cd89773ee01ab0.scope: Consumed 1.576s CPU time.
Aug 18 19:23:48 Lunux plasmashell[5412]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/plasma/extras/PlaceholderMessage.qml:238:5: QML Heading: Binding loop detected for property "verticalAlignment"
Aug 18 19:23:49 Lunux plasmashell[5412]: file:///usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/plasma/extras/PlaceholderMessage.qml:238:5: QML Heading: Binding loop detected for property "verticalAlignment"
Aug 18 19:23:49 Lunux plasmashell[5412]: qt.svg: Cannot open file '/snap/blender/3135/meta/gui/icon.svg', because: No such file or directory
Aug 18 19:23:49 Lunux plasmashell[5412]: qt.svg: Cannot open file '/snap/blender/3135/meta/gui/icon.svg', because: No such file or directory
Aug 18 19:23:51 Lunux systemd[4063]: Started app-protontricks-1195f3e0669a4a46bc6138f129a0ec43.scope - Protontricks.
Aug 18 19:23:51 Lunux xdg-desktop-portal-kde[6262]: xdp-kde-settings: Group  "org.freedesktop.appearance"  doesn't exist
Aug 18 19:23:51 Lunux xdg-desktop-portal-kde[6262]: xdp-kde-settings: Namespace  "org.gnome.desktop.a11y.interface"  is not supported
Aug 18 19:23:51 Lunux xdg-desktop-portal-kde[6262]: xdp-kde-settings: Namespace  "org.gnome.desktop.interface"  is not supported
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.946:357): apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=45301 comm="srt-bwrap" requested="userns_create" target="unprivileged_userns"
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.946:358): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=45304 comm="srt-bwrap" capability=8  capname="setpcap"
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.946:359): apparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" error=-13 profile="unprivileged_userns" name="proc/45304/uid_map" pid=45304 comm="srt-bwrap" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.948:360): apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=45305 comm="bwrap" requested="userns_create" target="unprivileged_userns"
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.948:361): apparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" error=-13 profile="unprivileged_userns" name="proc/45306/uid_map" pid=45306 comm="bwrap" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.949:362): apparmor="AUDIT" operation="userns_create" class="namespace" info="Userns create - transitioning profile" profile="unconfined" pid=45307 comm="srt-bwrap" requested="userns_create" target="unprivileged_userns"
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.949:363): apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns" pid=45308 comm="srt-bwrap" capability=8  capname="setpcap"
Aug 18 19:23:53 Lunux kernel: audit: type=1400 audit(1724023433.949:364): apparmor="DENIED" operation="open" class="file" info="Failed name lookup - disconnected path" error=-13 profile="unprivileged_userns" name="proc/45308/uid_map" pid=45308 comm="srt-bwrap" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000

Aug 18 19:23:53 Lunux pressure-vessel-wrap[45298]: E: Child process exited with code 1: bwrap: setting up uid map: Permission denied

Aug 18 19:23:53 Lunux plasmashell[45312]: Warning: --window-icon is deprecated and will be removed in a future version of zenity; Treating as --icon.
Aug 18 19:23:54 Lunux xdg-desktop-portal-kde[6262]: xdp-kde-settings: Group  "org.freedesktop.appearance"  doesn't exist
Aug 18 19:23:54 Lunux xdg-desktop-portal-kde[6262]: xdp-kde-settings: Namespace  "org.gnome.desktop.a11y.interface"  is not supported
Aug 18 19:23:54 Lunux xdg-desktop-portal-kde[6262]: xdp-kde-settings: Namespace  "org.gnome.desktop.interface"  is not supported

Aug 18 19:23:54 Lunux zenity[45312]: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.

When attempting to run protontricks --no-bwrap --gui , it doesn't give this specific error anymore. Instead it gives warning: Unknown file arch of /home/gary/.cache/protontricks/proton/Proton 8.0/bin/wineserver. Does the same thing with games on experimental, as well.

This is the same thing as mentioned in that issue, so the problem seems to be located at least!

Matoking commented 3 weeks ago

Turns out creating an AppArmor profile should be relatively easy.

Try creating the following file in /etc/apparmor.d/protontricks:

abi <abi/4.0>,
include <tunables/global>

profile protontricks /home/YOURUSERHERE/.local/bin/protontricks flags=(unconfined) {
  userns,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/protontricks>
}

The profile is pretty much identical to Steam. You can adjust the path to protontricks if necessary, the default here applies to pipx and pip. For system-wide installations, including Ubuntu's own protontricks package (which appears to be broken at the moment due to lacking this profile), the path is usually /usr/bin/protontricks.

After that, run sudo systemctl restart apparmor to bring the profile into effect. Then, Protontricks should finally work.

Finally, I reported the lack of an AppArmor profile on the upstream bug tracker. Local installations (pip and pipx) will likely require manual tweaking, unfortunately.

L7vanmatre commented 3 weeks ago

Turns out creating an AppArmor profile should be relatively easy.

Try creating the following file in /etc/apparmor.d/protontricks:

abi <abi/4.0>,
include <tunables/global>

profile protontricks /home/YOURUSERHERE/.local/bin/protontricks flags=(unconfined) {
  userns,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/protontricks>
}

The profile is pretty much identical to Steam. You can adjust the path to protontricks if necessary, the default here applies to pipx and pip. For system-wide installations, including Ubuntu's own protontricks package (which appears to be broken at the moment due to lacking this profile), the path is usually /usr/bin/protontricks.

After that, run sudo systemctl restart apparmor to bring the profile into effect. Then, Protontricks should finally work.

Finally, I reported the lack of an AppArmor profile on the upstream bug tracker. Local installations (pip and pipx) will likely require manual tweaking, unfortunately.

Since I currently have Protontricks installed on pipx, I created the protontricks file and pasted what you have provided (editing the "YOURUSERHERE" to my username), restarted apparmor and even the entire PC. Unfortunately, I still get an error. Was I to edit any other part in the protontricks apparmor file?

pressure-vessel-wrap[7854]: E: Child process exited with code 1: bwrap: setting up uid map: Permission denied

Traceback (most recent call last):
  File "/home/gary/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/gary/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/gary/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gary/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/cli/main.py", line 307, in main
    run_command(
  File "/home/gary/.local/share/pipx/venvs/protontricks/lib/python3.12/site-packages/protontricks/util.py", line 516, in run_command
    raise RuntimeError(
RuntimeError: bwrap launcher crashed, returncode: 1

I've tested uninstalling from pipx version and installed Ubuntu's protontricks with the relevant apparmor profile and restarted apparmor, but it still gives the "Invalid file magic number" error, which, as I understand, was due to Ubuntu's version being outdated.