Invalid file magic number. The appinfo.vdf version might not be supported by the current version of Protontricks
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:
- Run command
protontricks 1250410 /home/richard/Downloads/MSFS_Plugin_x64_Software_8.0.313.0.exe - 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
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?
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.vdfis 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.appidfields 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, theappinfo.vdffrom 2023 is 15.6 MiB in size, while the currentappinfo.vdfin 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.
Workaround: set PROTON_VERSION to whatever's appropriate.
Having the same problem. how can I use PROTON_VERSION, do I just set PROTON_VERSION=EXPERIMENTAL in the environment variables?
@PickMeNow Use this in a terminal for the flatpak version:
export PROTON_VERSION="Proton Experimental"
flatpak run com.github.Matoking.protontricks --gui
I've submitted a PR to fix the appinfo.vdf support in the VDF parser library at ValvePython/vdf#61.
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
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.
@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
wait no i apperntly did something wrong i got it working
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.
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 Are you sure there's no change? Is the error message the same? In my case the error message changed.
@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
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)
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:
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.
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
You copied the $ from the start of each line above, take those out & try the commands again, they'll work for sure.
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.
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.
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
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?
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
Changing it to
if key[-1] == 0: key_table.append(key[0:-1].decode(encoding="utf-8", errors="replace")) breakseems 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!
Still not fixed
@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
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?
@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 There are pipx instructions above. Also the AUR maintainer could backport the patch
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