./start_server_bepinex.sh overwrites World/Password values #1

Closed
opened 2026-09-14 17:49:39 -03:00 by the_minisip · 5 comments
Owner

When the server starts up, the image will ignore the World details that are defined in Environment Variables, instead overwriting them when ./start_server_bepinex.sh is executed, which overwrites those defined values, with its own string.

The desired behaviour is that the environment variables would be passed into the ./start_server_bepinex.sh row where it launches the server instance.

When the server starts up, the image will ignore the World details that are defined in Environment Variables, instead overwriting them when ./start_server_bepinex.sh is executed, which overwrites those defined values, with its own string. The desired behaviour is that the environment variables would be passed into the ./start_server_bepinex.sh row where it launches the server instance.
the_minisip added the
Priority
Medium
3
label 2026-09-14 17:49:39 -03:00
the_minisip self-assigned this 2026-09-14 17:49:39 -03:00
the_minisip added this to the Valheim Dedicated Server project 2026-09-14 17:49:39 -03:00
Author
Owner

Current workaround is to initially launch a new container instance, then, once the instance is loaded and everything installed, we can go into the file system via https://rwmfiles.theminisip.ca/ and edit/update the start_server_bepinex.sh file to use whatever credentials/details we want/need

Current workaround is to initially launch a new container instance, then, once the instance is loaded and everything installed, we can go into the file system via https://rwmfiles.theminisip.ca/ and edit/update the start_server_bepinex.sh file to use whatever credentials/details we want/need
the_minisip moved this to To Do in Valheim Dedicated Server on 2026-09-14 17:57:38 -03:00
Author
Owner

Proposed solution is to shim the start_server_bepinex.sh file with a wrapper script, and calling the wrapper script instead of the start_server_bepinex.sh script directly. Shim script would be "/opt/valheim/start_server_managed.sh" and the proposed script would contain the following:
'cat > "${VALHEIMDIR}/start_server_managed.sh" << 'EOF'
#!/usr/bin/env bash
set -euo pipefail

Forward environment variables into the BepInEx launcher

exec ./start_server_bepinex.sh
-name "${SERVER_NAME}"
-port 2456
-world "${WORLD_NAME}"
-password "${SERVER_PASSWORD}"
-public "${PUBLIC}"
EOF

chmod +x "${VALHEIMDIR}/start_server_managed.sh"
'

Then, in the entrypoint.sh file, we would replace:
exec ./start_server_bepinex.sh \

with
exec ./start_server_managed.sh

Proposed solution is to shim the start_server_bepinex.sh file with a wrapper script, and calling the wrapper script instead of the start_server_bepinex.sh script directly. Shim script would be "/opt/valheim/start_server_managed.sh" and the proposed script would contain the following: 'cat > "${VALHEIMDIR}/start_server_managed.sh" << 'EOF' #!/usr/bin/env bash set -euo pipefail # Forward environment variables into the BepInEx launcher exec ./start_server_bepinex.sh \ -name "${SERVER_NAME}" \ -port 2456 \ -world "${WORLD_NAME}" \ -password "${SERVER_PASSWORD}" \ -public "${PUBLIC}" EOF chmod +x "${VALHEIMDIR}/start_server_managed.sh" ' Then, in the entrypoint.sh file, we would replace: `exec ./start_server_bepinex.sh \ ` with `exec ./start_server_managed.sh `
the_minisip moved this to In Progress in Valheim Dedicated Server on 2026-09-14 19:03:07 -03:00
the_minisip added this to the 1.0.0.1 - Enhancement Round 1 Fixes milestone 2026-09-15 10:50:57 -03:00
Author
Owner

Created script file, updated dockerfile and entrypoint.sh so that wrapper can be leveraged. Ready for testing

Created script file, updated dockerfile and entrypoint.sh so that wrapper can be leveraged. Ready for testing
the_minisip added the Kind/BugKind/Testing labels 2026-09-15 10:52:11 -03:00
Author
Owner

BepInEx is still overwriting, we are going to have to patch the BepInEx server start script directly. The previous work will pass the values as intended, but not resolve the specific issue at hand

BepInEx is still overwriting, we are going to have to patch the BepInEx server start script directly. The previous work will pass the values as intended, but not resolve the specific issue at hand
Author
Owner

Entrypoint now handles making sure the values are coming from environment variables now

Entrypoint now handles making sure the values are coming from environment variables now
the_minisip moved this to Done in Valheim Dedicated Server on 2026-09-15 12:24:21 -03:00
Sign in to join this conversation.