Skip to content

fix(mods): BepInEx_Valheim prevents startup on systems with newer glibc #4788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

fwillo
Copy link

@fwillo fwillo commented Jun 13, 2025

Description

Installing BepInEx mod for Valheim via the LinuxGSM scripts installs a script called fix_vh.sh. In there the required lines of commands are introduced in order to work, as described in https://thunderstore.io/c/valheim/p/denikson/BepInExPack_Valheim/ . However, systems which have programms installed based on newer versions of glibc crash the startup of the server with a lot of

  • ld.so: object 'libdoorstop_x64.so' from LD_PRELOAD cannot be preloaded
  • readlink: symbol lookup error: /home/XXX/serverfiles/BepInExPack_Valheim/doorstop_libs/libdoorstop_x64.so: undefined symbol: dlopen
  • Failed to hook dlsym, ignoring it. Error: no such function: dlsym

This causes sometimes to prevent starting the server or if the server starts to load the mod. Starting the Server in Debug mode gives

~$ LC_ALL=C ./vhserver debug

Valheim Debugging
=================================
[ INFO ] Debugging vhserver: BepInEx install detected, applying start exports
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
/home/XXX/lgsm/modules/info_distro.sh: line 172: to
16046520: syntax error in expression (error token is "16046520")
jq: parse error: Invalid numeric literal at line 1, column 7
jq: parse error: Invalid numeric literal at line 1, column 7
jq: parse error: Invalid numeric literal at line 1, column 7
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Distro:
Arch Linux
Architecture:       Failed to hook dlsym, ignoring it. Error: no such function: dlsym
x86_64
Kernel:             Failed to hook dlsym, ignoring it. Error: no such function: dlsym
6.14.4-arch1-1
Hostname:           XXX
tmux:               to
3.5a
Avg Load:
0.26, 0.58, 0.68
Free Memory:        12GB
Free Disk:          dlsym,
46G
glibc required: 2.14 (distro glibc Failed to hook dlsym, ignoring it. Error: no such function: dlsym
2.41 too old)
Game Server IP: 0.0.0.0:2456
Internet IP:    Failed to hook dlsym, ignoring it. Error: no such function: dlsym:2456
Server password:        XXX
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
./vhserver: line 526: to: command not found
./vhserver: line 527: -name 'XXX' -password XXX -port 2456 -world vhserver -public 0 -savedir '/home/XXX/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -instanceid 1: No such file or directory
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Failed to hook dlsym, ignoring it. Error: no such function: dlsym
Start parameters:
 ./valheim_server.x86_64 -name 'XXX' -password XXX -port 2456 -world vhserver -public 0 -savedir '/home/XXX/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -instanceid 1

Use debug for identifying server issues only!
Press CTRL+c to drop out of debug mode.
Warning! If vhserver is already running it will be stopped.
Failed to hook dlsym, ignoring it. Error: no such function: dlsym

This error is described in #4149 and #4491 and this pull request fixes them.

fix_vh.sh uses export LD_PRELOAD=libdoorstop_x64.so:${LD_PRELOAD}, as it is used in the original startup scripts of BepInEx_Valheim. However, by this the library is preloaded for every process involved in the startup. In the original startup script this is no issue, since only the server executable is run.

I suggest to use the existing ${preexecutable} varibale to put the LD_PRELOAD in front of the tmux-execution command, now solely addressing the preload of the library only for the server executable. This solution was tested and gives for the debug command

~$ LC_ALL=C ./vhserver debug

Valheim Debugging
=================================
[ INFO ] Debugging vhserver: BepInEx install detected, applying start exports
Distro:          Arch Linux
Architecture:    x86_64
Kernel:          6.14.4-arch1-1
Hostname:        XXX
tmux:            3.5a
Avg Load:        0,25, 0,40, 0,49
Free Memory:     12GB
Free Disk:       46G
glibc required: 2.15
Game Server IP: 0.0.0.0:2456
Internet IP:    XXX.XXX.XXX.XXX:2456
Server password:        XXX
Start parameters:
 LD_PRELOAD="libdoorstop_x64.so:${LD_PRELOAD}"  ./valheim_server.x86_64 -name 'XXX' -password XXX -port 2456 -world vhserver -public 0 -savedir '/home/XXX/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -instanceid 1

Use debug for identifying server issues only!
Press CTRL+c to drop out of debug mode.
Warning! If vhserver is already running it will be stopped.

Continue? [Y/n] Y

Type of change

  • Bug fix (a change which fixes an issue).
  • New feature (a change which adds functionality).
  • New Server (new server added).
  • Refactor (restructures existing code).
  • Comment update (typo, spelling, explanation, examples, etc).

Checklist

PR will not be merged until all steps are complete.

  • This pull request links to an issue.
  • This pull request uses the develop branch as its base.
  • This pull request subject follows the Conventional Commits standard.
  • This code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have checked that this code is commented where required.
  • I have provided a detailed enough description of this PR.
  • I have checked if documentation needs updating.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

Load the libdoorstop_x64.so solely for the dedicated server executable
and not for the whole startup routine, which causes errors in startup or
not loading the mods at all. (see GameServerManagers#4149 and GameServerManagers#4491)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant