[BUG] - r2modman cannot launch modded Valheim following the latest Steam update on Linux
Describe the bug Steam pushed out an update which added screen recording for all platforms. This update also included an update to the runtime environment for native games. By default steam now uses something called scout 1.0. Here are the relevant patch notes: https://store.steampowered.com/news/app/593110/view/4472730495692571024
"Native titles will execute in 'Steam for Linux runtime 1.0 (scout)' by default, instead of the legacy runtime environment."
This seems to have broken r2modman's ability to launch valheim in modded mod. The game can still be launched in vanilla mode.
To Reproduce Steps to reproduce the behavior:
- Create a valheim modded profile on r2modman
- Try to launch valheim
- Steam will open and valheim will briefly show it is running and then immediately crash
- You should be able to launch valheim in vanilla mode via steam directly or via r2modman
Expected behavior Valheim should launch with mods
Screenshots NA
Additional context I have a work around for this issue. You can add the launch parameter "-compat-force-slr off" to the r2modman steam launch parameters. I documented this solution in the discord (https://discord.com/channels/727304496522461185/1303809239898259476/1303909649153527870) and here: https://www.reddit.com/r/valheim/comments/1glggwy/workaround_modded_valheim_on_linux_with_r2modman/
A handful of people have verified that this work around works.
Confirmed an issue on Arch, Kubuntu, and Pop!
This launch parameter forces steam to use the legacy runtime environment from before the update.
Other have stated that they manually installed the mods and launched valheim via Steam in the new runtime environment and it works without issue.
This was an issue in r2modman 51 and 52.
I have also tried creating a fresh profile and updating mods to the latest which did not fix the issue. I also tried making a barebones profile with just a couple simple mods and this also did not launch.
When you launch Valheim in vanilla mode valheim also talks about not being about to load PlayFab and requiring some MS runtime files. Unsure if this is related.
I can confirm. I manually load BepInEx. Since the latest Steam update, Valheim no longer loads. When i Start team using "-compat-force-slr off", Valheim, with BepInEx loads fine. I'm also able to just start Valheim, with BepInEx, outside of Steam just using the sh script.
I have this problem on Arch (EndeavourOS), but the workaround does not work for me. Valheim quits on the title screen.
workaround for now: in steam properties for Valheim, select "Legacy runtime 1.0"
i have ValheimPlus with BepInEx and works fne
(i use NixOS btw)
To add to this discussion, for what it's worth, I was able to get this functioning on my system (Debian Bookworm - 6.1.0-21-amd64 using r2modman) by solely modifying the start_game_bepinex.sh file.
I modified
# exec="$BASEDIR/valheim.x86_64"
exec="/media/m15071060/ext4 partition/SteamLibrary/steamapps/common/Valheim/valheim.x86_64"
and
# Run the main executable
# Don't quote here since $exec may contain args passed by Steam
# if [ -n "$launch" ]; then
# exec "$launch" $rest
# else
echo "Executing standard version"
exec "$exec"
# fi
Adjusted file: start_game_bepinex.txt
So it just executes the "correct" path. If I don't do this, the launch breaks because of a space in the filename /media/m15071060/ext4 partition/SteamLibrary/steamapps/common/Valheim/valheim.x86_64 with this error: scout-legacy: 5: exec: /media/m15071060/ext4: not found
I don't see where or why the path would break otherwise, but this allows me to launch modded without Steam open in any alternative modes, nor selecting a specific runtime. It does fail to launch from Steam because of the launch options, however, so that's a definite caveat.
I'm having the same problem on Steam Deck. The "-compat-force-slr off" workaround only sort of works for me. I can get the game to start modded, but the quality is terrible no matter what settings I use (and I only have a couple light mods that shouldn't affect frame rate).
Not to mention, having to completely shut down Steam every time I want to play Valheim on a Steam Deck is quite the hassle. I also don't have the ability to force the use of the legacy runtime in the game's properties like cethien has done.
A fix in the steam client might have fixed this issue: https://github.com/ValveSoftware/steam-for-linux/issues/11448 However, running the latest beta and not messing with compatibility still doesn't let the game start with calling the .sh file within the Steam client.
I also have "Legacy runtime 1.0" available in the drop down in the Compatibility settings. That seems to have fixed things. I believe the correct thing to do is to get the startup script fixed that @M15071060 mentions. Valheim runs fine without using bepinex.
This is caused by a change in the way steam launch game that broke start_game_bepinex.sh.
Adding this lines between line 25-27 of your start_game_bepinex.sh should solve the problem:
# Special case: program is launched via Steam through steam-launch-wrapper
# In that case rerun the script via their bootstrapper to ensure game start correctly
if [[ $1 == *"steam-launch-wrapper"* ]]; then
cmd="$1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $0"
shift 11
exec $cmd $@
exit
fi
On steam inside game properties, you have to set the launch option as follows (set r2modmanPlus-local path and PROFILE_NAME properly):
~/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh --r2profile "PROFILE_NAME" %command%
@ebkr could this fix be integrated into r2modman? or is this a problem with Bepinex? if the later, how can we pass this along to them?
Looks like this is a problem with bepinex. See https://github.com/BepInEx/BepInEx/issues/1032
With the fix provided by M15071060, I am able to get Valheim to open to the loading screen but I get a near immediate crash with the terminal reporting as follows:
ERROR: ld.so: object 'libdoorstop_x64.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
I am running CachyOS on Kernel Linux 6.13.5-arch1-1 with DE KDE Plasma 6.3.2 on Wayland
CPU: AMD Ryzen 5 3600X
GPU: AMD Radeon RX 6700 XT
Valheim is loaded onto a secondary drive from the main, located at /run/media/kova/Main HDD/
I attempted to also implement the fix this using the solution provided here by eliadevito and on the BepInEx/BepInEx#1032 issue, but both solutions have failed with the same error.
I'm having the same issue as @Kovakin - it will load intermittently. The solution by @eliadevito did not work - the game will load but not with bepinex loaded
@Kovakin @illspirit This is my start_game_bepinex.sh that I'm using without any problems, can you verify if you applied the changes in the same way and eventually send the complete file?
#!/bin/sh
# BepInEx running script
#
# HOW TO USE:
# 1. Make this script executable with `chmod u+x ./start_game_bepinex.sh`
# 2. In Steam, go to game's preferences and change game's launch args to:
# ./start_game_bepinex.sh %command%
# 3. Start the game via Steam
#
# Note that you won't get a console this way
#
# NOTE: Edit the script only if you know what you're doing!
# Resolve base directory relative to this script
# Hopefully this resolves relative paths and links
a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a"; pwd -P)
# Special case: program is launched via Steam
# In that case rerun the script via their bootstrapper to ensure Steam overlay works
if [ "$2" = "SteamLaunch" ]; then
cmd="$1 $2 $3 $4 $0"
shift 4
exec $cmd $@
exit
fi
# Special case: program is launched via Steam through steam-launch-wrapper
# In that case rerun the script via their bootstrapper to ensure game start correctly
if [[ $1 == *"steam-launch-wrapper"* ]]; then
cmd="$1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $0"
shift 11
exec $cmd $@
exit
fi
exec="$BASEDIR/valheim.x86_64"
export DOORSTOP_ENABLE=TRUE
export DOORSTOP_INVOKE_DLL_PATH="$BASEDIR/BepInEx/core/BepInEx.Preloader.dll"
export DOORSTOP_CORLIB_OVERRIDE_PATH="$BASEDIR/unstripped_corlib"
# Allow to specify --doorstop-enable true|false
# Everything else is passed as-is to `exec`
while :; do
case $1 in
--doorstop-enable)
if [ -n "$2" ]; then
export DOORSTOP_ENABLE=$(echo "$2" | tr a-z A-Z)
shift
else
echo "No --doorstop-enable value specified, using default!"
fi
;;
--doorstop-target)
if [ -n "$2" ]; then
export DOORSTOP_INVOKE_DLL_PATH="$2"
shift
else
echo "No --doorstop-target value specified, using default!"
fi
;;
--doorstop-dll-search-override)
if [ -n "$2" ]; then
export DOORSTOP_CORLIB_OVERRIDE_PATH="$2"
shift
else
echo "No --doorstop-dll-search-override value specified, using default!"
fi
;;
*)
if [ -z "$1" ]; then
break
fi
if [ -z "$launch" ]; then
launch="$1"
else
rest="$rest $1"
fi
;;
esac
shift
done
export LD_LIBRARY_PATH="$BASEDIR/doorstop_libs:$LD_LIBRARY_PATH"
export LD_PRELOAD="libdoorstop_x64.so:$LD_PRELOAD"
# Run the main executable
# Don't quote here since $exec may contain args passed by Steam
if [ -n "$launch" ]; then
exec "$launch" $rest
else
exec "$exec"
fi
@Kovakin @illspirit This is my start_game_bepinex.sh that I'm using without any problems, can you verify if you applied the changes in the same way and eventually send the complete file?
#!/bin/sh # BepInEx running script # # HOW TO USE: # 1. Make this script executable with `chmod u+x ./start_game_bepinex.sh` # 2. In Steam, go to game's preferences and change game's launch args to: # ./start_game_bepinex.sh %command% # 3. Start the game via Steam # # Note that you won't get a console this way # # NOTE: Edit the script only if you know what you're doing! # Resolve base directory relative to this script # Hopefully this resolves relative paths and links a="/$0"; a=${a%/*}; a=${a#/}; a=${a:-.}; BASEDIR=$(cd "$a"; pwd -P) # Special case: program is launched via Steam # In that case rerun the script via their bootstrapper to ensure Steam overlay works if [ "$2" = "SteamLaunch" ]; then cmd="$1 $2 $3 $4 $0" shift 4 exec $cmd $@ exit fi # Special case: program is launched via Steam through steam-launch-wrapper # In that case rerun the script via their bootstrapper to ensure game start correctly if [[ $1 == *"steam-launch-wrapper"* ]]; then cmd="$1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} $0" shift 11 exec $cmd $@ exit fi exec="$BASEDIR/valheim.x86_64" export DOORSTOP_ENABLE=TRUE export DOORSTOP_INVOKE_DLL_PATH="$BASEDIR/BepInEx/core/BepInEx.Preloader.dll" export DOORSTOP_CORLIB_OVERRIDE_PATH="$BASEDIR/unstripped_corlib" # Allow to specify --doorstop-enable true|false # Everything else is passed as-is to `exec` while :; do case $1 in --doorstop-enable) if [ -n "$2" ]; then export DOORSTOP_ENABLE=$(echo "$2" | tr a-z A-Z) shift else echo "No --doorstop-enable value specified, using default!" fi ;; --doorstop-target) if [ -n "$2" ]; then export DOORSTOP_INVOKE_DLL_PATH="$2" shift else echo "No --doorstop-target value specified, using default!" fi ;; --doorstop-dll-search-override) if [ -n "$2" ]; then export DOORSTOP_CORLIB_OVERRIDE_PATH="$2" shift else echo "No --doorstop-dll-search-override value specified, using default!" fi ;; *) if [ -z "$1" ]; then break fi if [ -z "$launch" ]; then launch="$1" else rest="$rest $1" fi ;; esac shift done export LD_LIBRARY_PATH="$BASEDIR/doorstop_libs:$LD_LIBRARY_PATH" export LD_PRELOAD="libdoorstop_x64.so:$LD_PRELOAD" # Run the main executable # Don't quote here since $exec may contain args passed by Steam if [ -n "$launch" ]; then exec "$launch" $rest else exec "$exec" fi
I used your start_game_bepinex.sh and when I hit Start Modded it loads up instantly but without Bepinex
@eliadevito What complete file can I send?
your .sh file definitely lets me load the game consistently it just doesn't load bepinex in
@eliadevito said:
This is caused by a change in the way steam launch game that broke start_game_bepinex.sh.
Adding this lines between line 25-27 of your start_game_bepinex.sh should solve the problem: [...]
This seems to be the most correct fix, imo. If this could get a maintainer's review and blessing, I'd be happy to make the PR
I posted a better fix in https://github.com/BepInEx/BepInEx/issues/1032#issuecomment-2927833286, but we need an updated release of BepInEx for Valheim to be released with fixes included. I haven't been able to locate a repo where the start_game_bepinex.sh comes from to make a PR.
I posted a better fix in BepInEx/BepInEx#1032 (comment), but we need an updated release of BepInEx for Valheim to be released with fixes included. I haven't been able to locate a repo where the start_game_bepinex.sh comes from to make a PR.
Not sure what i'm doing wrong here but this still doesn't work for me. Using r2modman manager with a fresh install of Valheim but starting the game just results in an immediate crash. (basically steam play button goes to stop then back to play again) doesn't matter if I pick vanilla or modded from r2modman.
OS: Fedora 42 DE: KDE Plasma Steam: RPM install
Not sure what i'm doing wrong here but this still doesn't work for me. Using r2modman manager with a fresh install of Valheim but starting the game just results in an immediate crash. (basically steam play button goes to stop then back to play again) doesn't matter if I pick vanilla or modded from r2modman.
If you have set set the launch command inside Steam to "/home/$HOME/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh" %command% then the start_game_bepinex.sh script is only executed when you use start modded from r2. I just tested this for confirmation and both launching from Steam and start vanilla in r2 skip start_game_bepinex.sh so something else is probably wrong.
Try setting the launch command to logsave "$HOME/valheim.log" "/home/$HOME/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh" %command% and you will get a log of all the console output saved to $HOME/valheim.log to help in debugging.
Not sure what i'm doing wrong here but this still doesn't work for me. Using r2modman manager with a fresh install of Valheim but starting the game just results in an immediate crash. (basically steam play button goes to stop then back to play again) doesn't matter if I pick vanilla or modded from r2modman.
If you have set set the launch command inside Steam to
"/home/$HOME/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh" %command%then the start_game_bepinex.sh script is only executed when you use start modded from r2. I just tested this for confirmation and both launching from Steam and start vanilla in r2 skip start_game_bepinex.sh so something else is probably wrong.Try setting the launch command to
logsave "$HOME/valheim.log" "/home/$HOME/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh" %command%and you will get a log of all the console output saved to $HOME/valheim.log to help in debugging.
Ah ok, that's very helpful. Seems like it's not related to the bepinex script at all but the Steam/ubuntu12_32/gameoverlayrenderer.so library instead. Both modded and vanilla throw the same error when trying to start them. I did try to see if disabling the steam overlay setting did anything but it throws the same error. Just to note, that if I run the game without anything in the launch options it does indeed work fine so it's not anything with the game directly.
Ah ok, that's very helpful. Seems like it's not related to the bepinex script at all but the Steam/ubuntu12_32/gameoverlayrenderer.so library instead.
That is unrelated and you those errors in the console log on every game run though Steam.
Does the game launch if the launch options in Steam are blank? There's also an option to use OpenGL instead of the default Vulkan renderer. If you still cannot get the game to launch unmodded then its likely some system incompatibility that needs to be reported to the developer.
Ah ok, that's very helpful. Seems like it's not related to the bepinex script at all but the Steam/ubuntu12_32/gameoverlayrenderer.so library instead.
That is unrelated and you those errors in the console log on every game run though Steam.
Does the game launch if the launch options in Steam are blank? There's also an option to use OpenGL instead of the default Vulkan renderer. If you still cannot get the game to launch unmodded then its likely some system incompatibility that needs to be reported to the developer.
Yeah that's the odd thing. Game runs perfectly fine with the launch options blank. It's only when using the r2modman launch options does it crash immediately. I even tried with a blank profile without mods and get the same results.
@Kengetsu Try the following version of start_game_bepinex.sh with the launch options set to DEBUG=1 logsave "$HOME/valheim.log" "/home/$HOME/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh" %command% and post the log file for starting modded in r2.
https://gist.github.com/arrowmaster/8193d48571dacdc602e395ba9520bbaf
@Kengetsu It doesn't seem like the updated start_game_bepinex.sh is being run from that output. The updated file should be placed at /home/kengetsu/.config/r2modmanPlus-local/Valheim/profiles/Default/start_game_bepinex.sh. And there should NOT be a run_bepinex.sh file in the same directory.
@Kengetsu It doesn't seem like the updated start_game_bepinex.sh is being run from that output. The updated file should be placed at
/home/kengetsu/.config/r2modmanPlus-local/Valheim/profiles/Default/start_game_bepinex.sh. And there should NOT be arun_bepinex.shfile in the same directory.
Ok, I cleaned the profile and tried again just to make sure there wasn't anything odd in there. It does seem like some debug statements are in there now but the result is the same.
This is the game running without any launch params just to confirm it does work when not using any of the mod related stuff.
@Kengetsu I see the problem now. I should have seen it earlier but it wasn't as obvious until the new log with the additional debug statements.
Your Steam library is located at /mnt/2TB 870 Evo/Steam which includes spaces. Neither start_game_bepinex.sh or r2modmans linux_wrapper.sh will currently work properly with spaces in a path. I'm going to look more into how this can be fixed but its complicated and going to probably take some time.
@Kengetsu I might have found a solution but its going to first need testing by you and then I'm going to need to find somebody that knows POSIX scripting better than me to confirm I'm not being a lunatic for doing it this way.
Try this special version but it also has special installation instructions. First you need to launch r2modman. After r2modman is running and you have Valheim selected and ready to launch, then you need to replace ~/.config/r2modmanPlus-local/Valheim/linux_wrapper.sh with the new version. Unfortunately r2modman will replace this file on startup so this is only a temporary fix for testing (maybe you can change it to readonly, idk if that will work). If this works then both BepInEx and r2modman will need to merge in the changes.
https://gist.github.com/arrowmaster/e19ae5790033d6c71ab586ee782eeb8d
@Kengetsu I might have found a solution but its going to first need testing by you and then I'm going to need to find somebody that knows POSIX scripting better than me to confirm I'm not being a lunatic for doing it this way.
Try this special version but it also has special installation instructions. First you need to launch r2modman. After r2modman is running and you have Valheim selected and ready to launch, then you need to replace
~/.config/r2modmanPlus-local/Valheim/linux_wrapper.shwith the new version. Unfortunately r2modman will replace this file on startup so this is only a temporary fix for testing (maybe you can change it to readonly, idk if that will work). If this works then both BepInEx and r2modman will need to merge in the changes.https://gist.github.com/arrowmaster/e19ae5790033d6c71ab586ee782eeb8d
AMAZING! That does allow the game to fully launch and it does seem like all the mods are working correctly. Thanks so much for all the help with this!
@Kengetsu I might have found a solution but its going to first need testing by you and then I'm going to need to find somebody that knows POSIX scripting better than me to confirm I'm not being a lunatic for doing it this way. Try this special version but it also has special installation instructions. First you need to launch r2modman. After r2modman is running and you have Valheim selected and ready to launch, then you need to replace
~/.config/r2modmanPlus-local/Valheim/linux_wrapper.shwith the new version. Unfortunately r2modman will replace this file on startup so this is only a temporary fix for testing (maybe you can change it to readonly, idk if that will work). If this works then both BepInEx and r2modman will need to merge in the changes. https://gist.github.com/arrowmaster/e19ae5790033d6c71ab586ee782eeb8dAMAZING! That does allow the game to fully launch and it does seem like all the mods are working correctly. Thanks so much for all the help with this!
Great! I've submitted a PR for r2modman's wrapper script. https://github.com/ebkr/r2modmanPlus/pull/1843
@arrowmaster just an fyi, the pull request is waiting on you to sign the contributor license