protontricks icon indicating copy to clipboard operation
protontricks copied to clipboard

Invalid file magic number. The appinfo.vdf version might not be supported by the current version of Protontricks

Open Richard-Payne opened this issue 1 year ago • 7 comments

Describe the bug When I run protontricks I get this error:

Invalid file magic number. The appinfo.vdf version might not be supported by the current version of Protontricks

To Reproduce Steps to reproduce the behavior:

  1. Run command protontricks 1250410 /home/richard/Downloads/MSFS_Plugin_x64_Software_8.0.313.0.exe
  2. Command fails and error is displayed: Traceback (most recent call last): File "/usr/bin/protontricks", line 8, in <module> sys.exit(cli()) ^^^^^ File "/usr/lib/python3.12/site-packages/protontricks/cli/main.py", line 32, in cli main(args) File "/usr/lib/python3.12/site-packages/protontricks/cli/util.py", line 159, in wrapper return cli_func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/protontricks/cli/main.py", line 339, in main proton_app = find_proton_app( ^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/protontricks/steam.py", line 848, in find_proton_app tool_app = find_steam_compat_tool_app( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/protontricks/steam.py", line 609, in find_steam_compat_tool_app appinfo_sections = [ ^ File "/usr/lib/python3.12/site-packages/protontricks/steam.py", line 531, in iter_appinfo_sections raise SyntaxError( SyntaxError: Invalid file magic number. The appinfo.vdf version might not be supported by the current version of Protontricks - please check for updates.

Expected behavior It runs the exe I'm passing in the game prefix

System (please complete the following information):

  • Distro: Manjaro
  • Protontricks: flatpak, Manjaro Extras repo and AUR git package
  • Protontricks version: AUR is protontricks (1.11.2.dev7+gf2d605d). Flatpak and Manjaro Extras are both 1.11.1
  • Steam version: Steam Beta Update Steam Version: 1719453458 Steam Client Build Date: Thu, Jun 27 2:35 AM UTC -08:00 Steam Web Build Date: Thu, Jun 27 12:36 AM UTC -08:00 Steam API Version: SteamClient021

Additional context

https://gist.github.com/Richard-Payne/070d5b08ede33cfa10440e932f48149c

Richard-Payne avatar Jun 27 '24 16:06 Richard-Payne

Yeah I'm running into this same issue on my Steam Deck after the Beta Update with game recording. I wonder if that has something to do with it?

MrBareBones avatar Jun 27 '24 18:06 MrBareBones

The current workaround is to downgrade from Steam beta.


There have been several changes to the ~/.steam/steam/appcache/appinfo.vdf file in the Steam beta:

  • The file header is 8 bytes longer.
  • The binary VDF segment for each app entry in appinfo.vdf is different and the vdf Python library that Protontricks uses doesn't seem to be able to parse it. Each segment is preceded by a SHA1 checksum; calculating the checksum for the VDF segment ourselves results in the same checksum. So it's not that we're trying to parse the wrong data, the data itself seems to now use a different format that the library can't parse (yet).
  • The contents of the binary segments also seem to have changed radically, with things like redundant appinfo.appid fields having been removed. This is a bit hard to determine since I can't parse the file to a more human readable format yet. But for comparison's sake, the appinfo.vdf from 2023 is 15.6 MiB in size, while the current appinfo.vdf in Steam beta is 12.9 MiB.

Protontricks needs to read this file since it contains app compatibility mappings (or at least used to, I'll have to double check), such as what Proton versions to use by default. Cyberpunk 2077 was previously set to use Proton Experimental by default due to DualSense support. These app compatibility mappings aren't very commonplace, though, so if push comes to shove we can skip parsing the newer appinfo.vdf file. I'll try working on a proper solution first, though.

Matoking avatar Jun 27 '24 20:06 Matoking

Workaround: set PROTON_VERSION to whatever's appropriate.

dsalt avatar Jun 28 '24 23:06 dsalt

Having the same problem. how can I use PROTON_VERSION, do I just set PROTON_VERSION=EXPERIMENTAL in the environment variables?

PickMeNow avatar Jun 30 '24 11:06 PickMeNow

@PickMeNow Use this in a terminal for the flatpak version:

export PROTON_VERSION="Proton Experimental"
flatpak run com.github.Matoking.protontricks --gui

syrvolga avatar Jun 30 '24 21:06 syrvolga

I've submitted a PR to fix the appinfo.vdf support in the VDF parser library at ValvePython/vdf#61.

Matoking avatar Jun 30 '24 22:06 Matoking

Pretty much the same one whenever I try to install MO2 via https://github.com/rockerbacon/modorganizer2-linux-installer. Annoying since I need it to load the game with all its mods and Steam keeps breaking it, saying it is corrupt, does a file check and then undoes the changes made to launch it that way.

INFO: steam not found in '/home/*****/.var/app/com.valvesoftware.Steam/.local/share/Steam'
Traceback (most recent call last):
  File "/app/bin/protontricks", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/app/lib/python3.11/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/app/lib/python3.11/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/protontricks/cli/main.py", line 339, in main
    proton_app = find_proton_app(
                 ^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/protontricks/steam.py", line 848, in find_proton_app
    tool_app = find_steam_compat_tool_app(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/protontricks/steam.py", line 609, in find_steam_compat_tool_app
    appinfo_sections = [
                       ^
  File "/app/lib/python3.11/site-packages/protontricks/steam.py", line 609, in <listcomp>
    appinfo_sections = [
                       ^
  File "/app/lib/python3.11/site-packages/protontricks/steam.py", line 531, in iter_appinfo_sections
    raise SyntaxError(
SyntaxError: Invalid file magic number. The appinfo.vdf version might not be supported by the current version of Protontricks - please check for updates.
ERROR: Protontricks did not find a valid prefix directory.  Stdout was:\n

I've got this before the recording beta and it persists when I opt out of it too.

Edit: This was with both the Fedora repo version and the Flatpak one. Using the pipx install one works, in case someone else faces the same issue. https://github.com/Matoking/protontricks#pipx

Dark-Thoughts avatar Jul 02 '24 18:07 Dark-Thoughts

If you're using pipx, you can use the following commands to install development versions of vdf and protontricks with the required fixes:

# Uninstall Protontricks first
$ pipx uninstall protontricks

# Install Protontricks and vdf with the fixes
$ pipx install --preinstall git+https://github.com/Matoking/vdf.git@support_new_bvdf git+https://github.com/Matoking/protontricks.git@appinfo_v29

Releasing a new version of Protontricks with the fix in place requires that a new version of vdf is also published with support for the new format. I do not maintain that library and the final fix might be different, so I cannot release a new version of Protontricks until then, unfortunately.

Matoking avatar Jul 05 '24 11:07 Matoking

@PickMeNow Use this in a terminal for the flatpak version:

export PROTON_VERSION="Proton Experimental"
flatpak run com.github.Matoking.protontricks --gui

i tried that on my steam deck and i am still getting the error, i feel like i have been stupid. i i'm going to try and compile the python file next

testc2n14 avatar Jul 06 '24 01:07 testc2n14

wait no i apperntly did something wrong i got it working

testc2n14 avatar Jul 06 '24 01:07 testc2n14

Set PROTON_VERSION via flatseal to "Proton Experimental" and selected Proton experimental for the game as well (I use GE proton by default). Flatpak install, both steam and protontricks. Getting a different error now.

Protontricks was closed due to the following error:

Proton installation could not be found!

=============

Please include this entire error message when making a bug report.
Log messages:

Running inside Flatpak sandbox, version 1.14.6.
Found Steam directory at /home/jtcf/.var/app/com.valvesoftware.Steam/.local/share/Steam
Using default Steam Runtime at /home/jtcf/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_32/steam-runtime
WINETRICKS environment variable is not available. Searching from $PATH.
Found 2 Steam library folders
Multiple compatdata directories found for app 387990
Currently logged-in Steam user: coolercircutin
Found 0 Steam shortcuts running using Steam compatibility tools
Using 'yad' as GUI provider
$PROTON_VERSION was set but matching Proton installation could not be found.

JohnTheCoolingFan avatar Jul 08 '24 17:07 JohnTheCoolingFan

How does one set the environment variable in flatseal? I added PROTON_VERSION=“proton experimental” to the environment variables list and it made no change

jurassicjordan avatar Jul 08 '24 21:07 jurassicjordan

@jurassicjordan Are you sure there's no change? Is the error message the same? In my case the error message changed.

JohnTheCoolingFan avatar Jul 09 '24 09:07 JohnTheCoolingFan

@jurassicjordan Are you sure there's no change? Is the error message the same? In my case the error message changed.

Same error, only resolved when running it in the command line. Not in flatseal, I ended up using a shell script for now

jurassicjordan avatar Jul 09 '24 10:07 jurassicjordan

I've been having this error as well, and I'm in the steam beta on a steam deck. the log seems to be mainly reading every game that either doesn't have a proton prefix or isn't a windows program or whatever, twice (twice meaning it goes through each non-steam game once before going through them again)

ERROR2401 avatar Jul 09 '24 21:07 ERROR2401

OUTDATED, V1.12.0 HAS BEEN RELEASED WITH THE FIXES

Instructions are below for posterity:


I've pushed a build of Protontricks to Flathub beta which contains a fix for this Steam beta issue. This fix is based on the appinfo_v29 branch which you can also install manually.

To summarize how to install this version depending on your current installation method:

Flatpak/Flathub

Discover

Enable "Flathub beta" repository under Settings. You can then look up Protontricks and select "Flathub beta" as the source:

flathub-beta

Command-line

Add the flathub-beta repository if it isn't already added and install Protontricks:

flatpak remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak install flathub-beta com.github.Matoking.protontricks

pipx

Uninstall Protontricks first and then install these specific branches using these two commands:

# Uninstall Protontricks first
pipx uninstall protontricks

# Install Protontricks and vdf with the fixes
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

Arch AUR

Install python-vdf-solstice from AUR if you haven't already using the AUR helper of your choice (eg. with Paru the command is paru -S python-vdf-solstice). If pacman prompts you to delete existing python-vdf package, allow it to do so.

Download the PKGBUILD file from protontricks-git either manually or using the AUR helper of your choice (eg. with Paru the command is paru -G protontricks-git).

Change the following line in PKGBUILD from:

source=('git+https://github.com/Matoking/protontricks.git')

to

source=('git+https://github.com/Matoking/protontricks.git#branch=appinfo_v29')

Build and install the package by running the following commands in the directory with the PKGBUILD file:

makepkg
sudo pacman -U protontricks-git-*.tar.zst

Note that it's unlikely that the beta branch on Flathub will be maintained once a new version of Protontricks can be released. Please uninstall the beta version of Protontricks once a new stable release is out!

Also, the development build contains other unreleased changes as documented here.

Matoking avatar Jul 10 '24 14:07 Matoking

entered in konsole:

(deck@steamdeck ~)$ $ flatpak remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo $ flatpak install flathub-beta com.github.Matoking.protontricks bash: $: command not found bash: $: command not found

and if i enter them in separate lines nothing happens at all

stiinkyratz avatar Jul 15 '24 16:07 stiinkyratz

You copied the $ from the start of each line above, take those out & try the commands again, they'll work for sure.

lucifertdark avatar Jul 16 '24 06:07 lucifertdark

Forgive the lack of knowledge but how are you enabling the flathub beta repo in the discover store? I'm using my steam deck and I can't figure out a way to get this added.

ifdsisd avatar Jul 18 '24 12:07 ifdsisd

Forgive the lack of knowledge but how are you enabling the flathub beta repo in the discover store? I'm using my steam deck and I can't figure out a way to get this added.

If it isn't listed under Settings, use the command in a terminal first: flatpak remote-add --if-not-exists flathub-beta https://flathub.org/beta-repo/flathub-beta.flatpakrepo

After that it should be listed under Settings and be available under Sources on the corresponding software page. I don't own a Deck but on my Desktop it worked.

Dark-Thoughts avatar Jul 18 '24 12:07 Dark-Thoughts

Using the command:

pipx install --preinstall git+https://github.com/Matoking/vdf.git@support_new_bvdf git+https://github.com/Matoking/protontricks.git@appinfo_v29

Gives me following message:

usage: pipx [-h] [--version] {install,inject,upgrade,upgrade-all,uninstall,uninstall-all,reinstall,reinstall-all,list,run,runpip,ensurepath,completions} ... pipx: error: unrecognized arguments: --preinstall git+https://github.com/Matoking/protontricks.git@appinfo_v29

EDIT: I was using version 1.0.0 of pipx, i'm sorry

Ggargur avatar Jul 18 '24 15:07 Ggargur

Using these patches I now have a different error:

Traceback (most recent call last):
  File "/home/thomas/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/cli/main.py", line 357, in main
    proton_app = find_proton_app(
                 ^^^^^^^^^^^^^^^^
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/steam.py", line 902, in find_proton_app
    tool_app = find_steam_compat_tool_app(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/steam.py", line 663, in find_steam_compat_tool_app
    appinfo_sections = [
                       ^
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/steam.py", line 663, in <listcomp>
    appinfo_sections = [
                       ^
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/steam.py", line 583, in iter_appinfo_sections
    yield from _iter_v29_appinfo(data, i)
  File "/home/thomas/.local/pipx/venvs/protontricks/lib/python3.11/site-packages/protontricks/steam.py", line 532, in _iter_v29_appinfo
    key_table.append(key[0:-1].decode("utf-8"))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 0: invalid start byte

Should I open a separate ticket for this?

Staudey avatar Aug 01 '24 10:08 Staudey

Changing it to

if key[-1] == 0:
    key_table.append(key[0:-1].decode(encoding="utf-8", errors="replace"))
break

seems to work (similar to https://github.com/Matoking/protontricks/commit/85e4c199434fa394aa41d4330100ed81c0e43c17)

Not sure if that's a proper solution though

Staudey avatar Aug 01 '24 10:08 Staudey

Changing it to

if key[-1] == 0:
    key_table.append(key[0:-1].decode(encoding="utf-8", errors="replace"))
break

seems to work (similar to 85e4c19)

Not sure if that's a proper solution though

Makes sense. The vdf library actually does the same thing since appinfo.vdf has contained invalid Unicode characters before; see ValvePython/vdf@aa210d8264d4b062f1d81606a285d29bc992e3cb.

I've updated the branch accordingly. Thanks!

Matoking avatar Aug 01 '24 16:08 Matoking

Still not fixed

sTiKyt avatar Aug 03 '24 14:08 sTiKyt

@sTiKyt With the patched branch? What error do you get? If it's a UTF-8 decode error in config.vdf you might want to look at https://github.com/Matoking/protontricks/issues/317

Staudey avatar Aug 03 '24 17:08 Staudey

FYI, the beta branch should now have a fix for invalid Unicode characters in appinfo.vdf. This is a separate issue from #317, which is what @Staudey linked. Could someone with the issue that affects config.vdf check the comment and confirm whether it fixes the issue?

Matoking avatar Aug 04 '24 08:08 Matoking

@sTiKyt With the patched branch? What error do you get? If it's a UTF-8 decode error in config.vdf you might want to look at #317

How exactly am i supposed to patch it if i'm not using flatpak? (installed through aur)

sTiKyt avatar Aug 05 '24 11:08 sTiKyt

@sTiKyt There are pipx instructions above. Also the AUR maintainer could backport the patch

Staudey avatar Aug 08 '24 17:08 Staudey

Is there a solution for this on NixOS? I've tried overriding the derivation with the most recent source but I'm guessing the issue isn't with protontricks and is with one of the dependencies

Jademalo avatar Aug 10 '24 10:08 Jademalo