LinuxGSM icon indicating copy to clipboard operation
LinuxGSM copied to clipboard

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

Open fwillo opened this issue 7 months ago • 0 comments

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

  • [X] 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.

  • [X] This pull request links to an issue.
  • [X] This pull request uses the develop branch as its base.
  • [X] This pull request subject follows the Conventional Commits standard.
  • [X] This code follows the style guidelines of this project.
  • [X] I have performed a self-review of my code.
  • [X] I have checked that this code is commented where required.
  • [X] I have provided a detailed enough description of this PR.
  • [X] 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.

  • User docs: https://github.com/GameServerManagers/LinuxGSM-Docs
  • Dev docs: https://github.com/GameServerManagers/LinuxGSM-Dev-Docs

Thank you for your Pull Request!

fwillo avatar Jun 13 '25 16:06 fwillo