[Bug]: Sentinel restart loop on servers managed by a non-root SSH user (CheckAndStartSentinelJob checks run without sudo)
Description and Error Message
Since upgrading to 4.3.23, Sentinel (1.0.1) on remote servers managed with a non-root SSH user (user = coolify, passwordless sudo, not in the docker group) is recreated every ~60 s. The server stays Out of sync and Coolify falls back to SSH checks, generating ~200k sudo/PAM log events per day on one server. localhost (user root) is unaffected. Network, token and Sentinel version are fine, and pushes to /api/v1/sentinel/push return 200.
Root cause
CheckAndStartSentinelJobrunsdocker inspect coolify-sentinelanddocker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/version"viainstant_remote_process_with_timeout. On non-root servers these commands are not sudo-wrapped: they never appear in the sudo journal, whereasStartSentinel'sdocker rm -f coolify-sentineldoes. As the SSH user has no Docker socket access,docker inspectfails,State.Statusdefaults to'exited', and the job callsStartSentinelalthough the container is running.StartSentinelcallssentinelHeartbeat(isReset: true), which setssentinel_updated_at = now()->subMinutes(6000).ServerManagerJobthen sees the server out of sync and dispatchesServerCheckJobevery minute, which runsCheckAndStartSentinelJobagain. With the defaultsentinel_push_interval_seconds = 60, the first push of the fresh container arrives at the same moment as the next check and loses the race, so the loop never ends.- Even once in sync, the hourly
CheckAndStartSentinelJob(0 * * * *) restarts Sentinel for the same reason and can re-enter the loop.
Evidence
As the SSH user on the managed server: $ id coolify uid=1002(coolify) gid=1002(coolify) groups=1002(coolify),27(sudo) $ sudo -u coolify docker inspect coolify-sentinel --format '{{.State.Status}}' permission denied while trying to connect to the docker API at unix:///var/run/docker.sock
Sudo journal on the managed server: docker rm -f coolify-sentinel every minute while out of sync, then at xx:00 once in sync. No sudo entries for the inspect or api/version commands.
servers.sentinel_updated_at for the remote servers is always ~100 h in the past (now() - 6000 min), updated on every restart. localhost shows the current time.
Container recreated at :06/:07 each minute, while tcpdump shows the first push leaving at :07.264.
Expected Behavior
CheckAndStartSentinelJobshould run its checks with the same sudo handling as other remote commands (asinstant_remote_processdoes), so a running, up-to-date Sentinel is not restarted on non-root servers.- A failed
docker inspect(command error) should not be treated as a stopped container. - A freshly started Sentinel should get a grace period before being considered dead, e.g. honor
sentinel_waiting_since+firstSentinelReportTimeoutSeconds(), and/or have Sentinel push immediately on startup, so the default 60 s push interval cannot race the 60 s check.
Steps to Reproduce
- Add a remote server using a non-root SSH user with passwordless sudo, not in the
dockergroup (per the non-root setup docs). - Enable Sentinel with default settings (push interval 60 s).
- Watch the sudo journal on the server:
journalctl -t sudo -f | grep 'rm -f coolify-sentinel'. The container is recreated every ~60 s. - In
php artisan tinker:\DB::table('servers')->pluck('sentinel_updated_at','name'). The remote server is ~100 h in the past. - Run
sudo -u <ssh_user> docker inspect coolify-sentinelon the server: permission denied. - Workaround check: set the push interval to 20 s, and the server becomes In sync. The hourly check still restarts Sentinel at
xx:00or add the SSH user to the docker group and reset the SSH mux sessions: the loop stops.
Example Repository URL
No response
Coolify Version
v4.3.23
Are you using Coolify Cloud?
No (self-hosted)
Operating System and Version (self-hosted)
Ubuntu 24.04.4 LTS
Screenshots / Visuals
No response
Additional Information
Workarounds confirmed:
- Adding the SSH user to the
dockergroup fixes it, even with the default 60 s push interval. Note: existing SSH multiplexed sessions keep the old groups; they must be closed (pkill -u <user> -f 'sshd: <user>') before the fix takes effect. - Alternatively, a 30 s push interval makes the first push land before the next check (Sentinel is still restarted hourly).
Started right after upgrading to 4.3.23 (2026-09-19); previous versions worked with the same settings.
Possibly related: #11803 (different trigger, but same effect of StartSentinel resetting the heartbeat and no grace period for the first report).
Source: coollabsio/coolify