Fix SignalK hang on boot: replace usermod/groupmod with sed

Replace `usermod -o -u 0 node` and `groupmod -o -g 0 node` with direct
sed modifications to /etc/passwd and /etc/group. The usermod/groupmod
commands can hang indefinitely in container environments due to lock
file contention, NSS cache daemon (nscd) interactions, or PAM module
issues. The sed approach achieves the same result without these risks.

Fixes #XXXX

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-26 07:35:50 +00:00
parent 9b41653fa0
commit d328a0ea41

View File

@@ -15,9 +15,11 @@ ln -sf /config "/home/node/.signalk"
chown -R "$USER:$USER" /config
# Set permissions
# Use sed instead of usermod/groupmod to avoid hangs in container environments
# (usermod can block indefinitely due to lock contention, NSS, or PAM issues)
echo "... setting permissions for node user"
usermod -o -u 0 node
groupmod -o -g 0 node
sed -i 's/^\(node:[^:]*:\)[0-9]*:[0-9]*/\10:0/' /etc/passwd
sed -i 's/^\(node:[^:]*:\)[0-9]*/\10/' /etc/group
# Ensure 600 for SSL files
echo "... specifying security files permissions"