Skip to content

Symlink on /var/lib/postgresql/data points to itself for the pg18 image #325

@tiemma

Description

@tiemma

In executing the docker image in Kubernetes via volume mounts, the folder under the points to itself.

How to reproduce

docker run -it timescale/timescaledb:latest-pg18 bash
1b6828e06f2b:/# ls -l /var/lib/postgresql/data
lrwxrwxrwx    1 root     root             1 Oct 22 17:43 /var/lib/postgresql/data -> .

I also tested with file. The path linking to . causes a recursive symlink preventing any mountpoints from working.

1b6828e06f2b:/# apk add file
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
(1/2) Installing libmagic (5.46-r2)
(2/2) Installing file (5.46-r2)
Executing busybox-1.37.0-r13.trigger
OK: 216 MiB in 49 packages
1b6828e06f2b:/# file /var/lib/postgresql/data
/var/lib/postgresql/data: symbolic link to .


# From here, notice the recursive directory symlink

1b6828e06f2b:/# file /var/lib/postgresql/data/data/
/var/lib/postgresql/data/data/: sticky, directory
1b6828e06f2b:/# file /var/lib/postgresql/data/data
/var/lib/postgresql/data/data: symbolic link to .
1b6828e06f2b:/# file /var/lib/postgresql/data/data/data
/var/lib/postgresql/data/data/data: symbolic link to .

This issue breaks usage from the container runtime as a valid mountpoint

failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/var/lib/kubelet/pods/839353ec-7453-4aed-8846-719ed4456498/volumes/kubernetes.io~csi/pvc-d155d89c-6fd9-4446-a30f-4081ed2f64bb/mount" to rootfs at "/var/lib/postgresql/data": change mount propagation through procfd: open o_path procfd: open /run/containerd/io.containerd.runtime.v2.task/k8s.io/43d63a4d42ccf97fc981274375887dc23fb4fae236ee0e702ca5e263515a62d9/rootfs/var/lib/postgresql/data: no such file or directory: unknown

Fix

The solution should be un-linking the directory from the postgres image and creating it again, I did not see anything asides the builds added in the pg18 Dockerfile updates so there might be more to look at than the mitigating suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions