Use s6-setuidgid for Hermes privilege drop#17
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix restart loop by using s6-setuidgid in entrypoint.sh
Use s6-setuidgid for Hermes privilege drop
Jun 3, 2026
|
Dappnode bot has built and pinned the built packages to an IPFS node, for commit: 88bc79e This is a development version and should only be installed for testing purposes.
Hash: (by dappnodebot/build-action) |
|
@Pol-Lanski working again! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The package can enter a restart loop because
entrypoint.shstill re-execs throughgosu, but current upstream Hermes images no longer ship that binary. This change aligns the DAppNode wrapper with upstream Hermes by switching privilege drop tos6-setuidgid.What changed
drop_to_hermes()helper inentrypoint.shgosu hermes ...re-exec with that helperPrivilege drop behavior
s6-setuidgidwhen available onPATH/command/s6-setuidgidfor s6-overlay layoutsenv: 'gosu': No such file or directoryWhy this matters
gosuOriginal prompt
Create a pull request from the existing fix branch
fix/install-gosuintomainfor repositorydappnode/DAppNodePackage-Hermes-agent.Context:
env: 'gosu': No such file or directorybecauseentrypoint.shcallsgosuwhen dropping root privileges.gosu; it uses s6-overlay'ss6-setuidgidfor privilege dropping.fix/install-gosu:3ac8d84efad9eb31455a9371e6898b505dc694db.entrypoint.shto use adrop_to_hermes()helper that triess6-setuidgidon PATH, falls back to/command/s6-setuidgid, and fails clearly if neither is available.Open a PR into
mainwith a concise description explaining that this aligns the DAppNode package with latest upstream Hermes and fixes the restart loop caused by the removedgosubinary.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: After running the package, I'm encountering this error (the package is in restart) :
Dropping root privileges
env: 'gosu': No such file or directory
Dropping root privileges
env: 'gosu': No such file or directory
Dropping root privileges
env: 'gosu': No such file or directory
Dropping root privileges
env: 'gosu': No such file or directory
Dropping root privileges
env: 'gosu': No such file or directory
Dropping root privileges
env: 'gosu': No such file or directory
How can I fix this?
Assistant: The package is restarting because
entrypoint.shcallsgosu, but the Docker image does not installgosu.The failing line is:
But the current
Dockerfileonly installsttydand WhatsApp dependencies; it never installsgosu.Fix
Add
gosuinstallation to theDockerfileafterUSER root:Then rebuild and reinstall/restart the package.
If the base image is Alpine-based
If the build fails with
apt-get: not found, use this instead:RUN apk add --no-cache gosuWhy this happens
The entrypoint starts as
root, prepares/opt/data, then tries to drop privileges to thehermesuser usinggosu. Sincegosuis missing from the image, the entrypoint exits immediately, and DAppNode restarts the package repeatedly.So the direct fix is: install
gosuin the image, then rebuild the package.User: why did it start asking for gosu when in the previous version it didn't?
Assistant: It started asking for
gosubecause the package’sentrypoint.shwas changed to match a newer upstream Hermes entrypoint pattern.Previously, the DAppNode package ran everything directly as root/non-dropped user and did not call
gosu. In the older entrypoint, there is no root privilege drop; it activates the venv immediately:In the newer entrypoint, a “root preflight and privilege drop” block was added. If the container starts as root, it fixes ownership of
/opt/data, then re-execs itself as thehermesuser usinggosu:The relevant repo history shows this happened in commit
25166b5c, titled “entrypoint improvements”, on May 8, 2026. The older version before that, commitd8cfd9c, had nogosuusage.So the cause is:
Dockerfilesets the container to run as root: