[Bug]: install.sh recursively chowns /data/coolify on every upgrade, breaking service bind mounts (root install)
Description and Error Message
install.sh runs chown -R 9999:root /data/coolify and chmod -R 700 /data/coolify during every upgrade. Because managed services keep their bind mounts under /data/coolify/services/<uuid>/, this recursively rewrites ownership and mode of service payload data, not just Coolify's own directories.
On my host this silently killed Postfix inside a docker-mailserver service for 20 hours. The container kept reporting Up, RestartCount: 0, and Coolify showed the service as running the entire time. Inbound mail on port 25 was refused throughout.
Two aspects make this worse than the ownership issues already reported:
- This is a plain root installation. Every existing report I could find (#4255, #5156, #9758, #10401) is about the non-root SSH setup, which the team has described as experimental until v5. This path needs no special setup at all — it is the documented upgrade command on a root install.
- The write happens before anything else. The two lines sit immediately after the disk-space warning and its
sleep 5, before any image pull. I aborted my first upgrade attempt during the pull, ~25 seconds after the damage was already done. There is no point at which a user can react.
This was already pointed out by @djsisson in a comment on #4911 (30 Apr 2025), linking the same two lines. That issue was about Supabase templates and was closed in June 2025 without this part being addressed.
Expected Behavior
Upgrading Coolify should not modify ownership or permissions of data belonging to the services it manages. /data/coolify/services/<uuid>/ holds user payload — bind-mounted config, mail spools, database directories — whose uid/gid is dictated by the service image, not by Coolify.
Concretely I'd expect:
- An upgrade leaves an existing
/data/coolifytree alone, or touches only the directories the script itself creates. - A run aborted at the disk-space warning leaves the host in the state it was in before, since nothing has been installed yet.
- If a service does break after an upgrade, it should be visible — here Coolify reported the service as running for 19.5 hours while its main daemon was in a restart loop.
Steps to Reproduce
- Root install of Coolify. Deploy any service whose container expects specific uid/gid on its data directories — e.g. docker-mailserver, which mounts
/data/coolify/services/<uuid>/docker-data/dms/mail-datato/var/mailand.../mail-stateto/var/mail-state. - Confirm the service works and note the ownership of those host directories.
- Run the documented upgrade:
curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash -s <version> - Observe the bind-mount directories are now
9999:rootmode0700. - Redeploy or restart the service. Depending on what the image's entrypoint repairs, it may come up partially — in my case Dovecot recovered, Postfix did not.
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
Screenshots / Visuals
What I observed
Timeline on the affected host (all UTC, 22 Sep 2026):
10:14:00 restic pre-upgrade backup finished
~10:15 first install.sh 4.3.23 run starts
10:16:22 dovecot: chdir(/var/mail/<domain>/<user>/home/) failed: Permission denied
(euid=5000(docker) egid=5000(docker) missing +x perm: /var/mail,
dir owned by 9999:0 mode=0700)
10:16:46 dockerd: "Not continuing with pull after error" error="context canceled"
(this is me aborting because of the disk-space warning)
10:17:22 postfix/master: master_wakeup_timer_event: service pickup: Permission denied
10:17:51 postfix/qmgr: fatal: scan_dir_push: open directory deferred: Permission denied
10:21 second install.sh run, Coolify containers recreated
10:45:16 mailserver container recreated
10:45:26 postfix/postsuper: fatal: scan_dir_push: open directory defer: Permission denied
-> repeats every ~6s for the next 19.5 hoursThe 9999:0 mode=0700 in the Dovecot error matches the values set by the two lines in install.sh.
Host-side state after the fact:
drwx--x--x 10 9999 0 /var/mail-state
drwx------ 16 0 0 /var/mail-state/spool-postfix <- blocks postfix (uid 105)
drwx------ 14 105 0 /var/mail-state/spool-postfix/defer
drwx------ 14 105 0 /var/mail-state/spool-postfix/deferredThe subdirectories are intact and owned by postfix; only the parent lost its traverse bit. docker-mailserver's entrypoint repaired /var/mail on the next container start (9999 -> 5000), which is why IMAP kept working and the outage stayed invisible, but it does not touch the spool root.
Fix on my side was a single chmod 0755 /var/mail-state/spool-postfix.
Additional Information
Relevant code
https://github.com/coollabsio/coolify/blob/v4.3.23/scripts/install.sh#L236-L237
if [ "$WARNING_SPACE" = true ]; then
echo "Sleeping for 5 seconds."
sleep 5
fi
mkdir -p /data/coolify/{source,ssh,applications,databases,backups,services,proxy,sentinel}
mkdir -p /data/coolify/images
mkdir -p /data/coolify/ssh/{keys,mux}
mkdir -p /data/coolify/proxy/dynamic
chown -R 9999:root /data/coolify
chmod -R 700 /data/coolifyThe same block appears again near the end of the script (L912-L913 in 4.3.23). I checked three versions — v4.1.2, v4.3.23 and the current v4.x branch — and the lines and surrounding context are byte-identical in all three, so this is long-standing rather than a recent regression.
Suggested direction
The setup step appears to be written for a fresh install, where creating the directories and claiming them is correct. On an upgrade the tree already exists, with ownership that services legitimately diverged from.
Possible approaches, in rough order of how little they'd disturb:
- Drop
-Rand set ownership/mode on the directories the script itself creates, not on their contents. - Or exclude
services/,applications/anddatabases/from the recursion — those hold user payload. - Or skip the ownership step entirely when
/data/coolifyalready exists (upgrade path) and only run it on a fresh install.
Whatever the choice, it would also help to move the step after the preflight checks, so aborting at the disk-space warning actually leaves the host untouched.
Related but distinct: #4911 (comment by @djsisson naming these lines), #9758 (same class of damage via parseCommandsByLineForSudo in sudo.php), #4255, #5156, #10401 (all non-root setups).
Source: coollabsio/coolify