fix: stop the Zomboid entrypoint withholding the admin password
The flag was gated on the admin database not existing yet, treating the file's presence as proof the admin user had been created. It is not: PZ creates the DB file in ServerWorldDatabase.create() before it creates the admin user, so a boot interrupted between the two leaves a database with no admin in it. After that the guard withheld -adminpassword on every subsequent start, the server fell back to an interactive "Enter new administrator password:" prompt, read EOF because a detached container has no stdin, and died with NoSuchElementException. systemd restarted it into exactly the same state, 50 times, which is how this was found. Passing it unconditionally costs nothing when the admin already exists and removes the deadlock entirely. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a90f4b7ed0
commit
4d86a57d75
@@ -73,17 +73,22 @@ configure_memory() {
|
|||||||
}
|
}
|
||||||
configure_memory
|
configure_memory
|
||||||
|
|
||||||
# Check if first run (no admin DB)
|
|
||||||
ADMIN_DB="${CONFIG_DIR}/db/${SERVER_NAME}.db"
|
|
||||||
|
|
||||||
# Build server arguments
|
# Build server arguments
|
||||||
# Note: -modfolders is NOT used - mods are configured via INI only
|
# Note: -modfolders is NOT used - mods are configured via INI only
|
||||||
# Reference: IndifferentBroccoli/projectzomboid-server-docker
|
# Reference: IndifferentBroccoli/projectzomboid-server-docker
|
||||||
SERVER_ARGS="-cachedir=${CONFIG_DIR} -servername ${SERVER_NAME}"
|
SERVER_ARGS="-cachedir=${CONFIG_DIR} -servername ${SERVER_NAME}"
|
||||||
|
|
||||||
# Add admin password for first run
|
# Always pass the admin password when we have one.
|
||||||
if [ ! -f "${ADMIN_DB}" ] && [ -n "${ADMIN_PASSWORD}" ]; then
|
#
|
||||||
echo "=== First run: setting admin password ==="
|
# This used to be gated on the admin DB not existing yet, on the assumption that
|
||||||
|
# the file's presence meant the admin user was already set up. It does not: PZ
|
||||||
|
# creates the DB file in ServerWorldDatabase.create() *before* it creates the
|
||||||
|
# admin user, so any boot interrupted between those two steps leaves a database
|
||||||
|
# that exists but has no admin. From then on the guard withheld the flag, the
|
||||||
|
# server fell back to an interactive "Enter new administrator password:" prompt,
|
||||||
|
# read EOF because a detached container has no stdin, and died with
|
||||||
|
# NoSuchElementException -- on every restart, forever.
|
||||||
|
if [ -n "${ADMIN_PASSWORD}" ]; then
|
||||||
SERVER_ARGS="${SERVER_ARGS} -adminpassword ${ADMIN_PASSWORD}"
|
SERVER_ARGS="${SERVER_ARGS} -adminpassword ${ADMIN_PASSWORD}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user