TimescaleDB mount permission denied — crash loop after redeploy
gpoet
PROOP

23 days ago

My TimescaleDB service (vol_jr384w0k76pc4qnu) is crash-looping and cannot start. After a redeploy, the container can no longer write to its

  volume mount:

  Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/.../vol_jr384w0k76pc4qnu

  mkdir: cannot create directory '/home/postgres/pgdata/data': Permission denied

  The image is timescale/timescaledb-ha:pg17, which runs as uid 26 (postgres). The mount point /home/postgres/pgdata appears to be root-owned, so

   the entrypoint cannot create or write to the data subdirectory.

  I attempted a custom start command to chown the mount before the entrypoint runs, but chown also fails because the container is not running as

  root:

  chown: changing ownership of '/home/postgres/pgdata': Operation not permitted

  chown: cannot read directory '/home/postgres/pgdata/lost+found': Permission denied

  The service ran stable on this same image for 3 days prior. Only a redeploy was triggered — no image change, no volume resize, no config

  changes to the service itself.

  Project: dexfolio

  Service: timescaledb

  Volume ID: vol_jr384w0k76pc4qnu

  Environment: production

  What I need:

  Chown the volume mount point to uid 26:gid 26 (postgres) on the platform side so the Timescale HA image's entrypoint can write to it

  OR remount the volume with the correct ownership applied at mount time

  I cannot shell into the container remotely, and no in-container workaround succeeds because the process is never root.

Solved$10 Bounty

Pinned Solution

domehane
FREE

23 days ago

Hello,

railway mounts volumes as root by default the fix is to add RAILWAY_RUN_UID=0 as an environment variable on your service and redeploy

Hope this help you :)

2 Replies

Status changed to Open Railway 23 days ago


domehane
FREE

23 days ago

Hello,

railway mounts volumes as root by default the fix is to add RAILWAY_RUN_UID=0 as an environment variable on your service and redeploy

Hope this help you :)


domehane

Hello,railway mounts volumes as root by default the fix is to add RAILWAY_RUN_UID=0 as an environment variable on your service and redeployHope this help you :)

gpoet
PROOP

23 days ago

Worked - RAILWAY_RUN_UID=0 got the service past the mount permission issue on the very first redeploy. Thank you.

  ▎                                                                                                                                              

  ▎ One heads-up for anyone else hitting this with timescale/timescaledb-ha specifically: when Spilo's entrypoint finally ran as root, it did not

  ▎  detect the pre-existing cluster on the volume and initialized a fresh one. Our ~41GB of existing data was overwritten on boot (thankfully it's mostly internal testing related data so no actual loss to us). If you have existing data you care about on the volume, take a snapshot/backup before applying this fix, or verify that your specific image preserves

  ▎ existing clusters on first root-run


Status changed to Solved brody 23 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...