Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Bind mount fails when path contains a symlink

    Posted on

    Hello

    On RHEL7.9, I have the following /etc/fstab that is working fine :
    /files/foo /opt/symlink/foo none bind 0 0

    while /opt/symlink is a symlink to /opt/bar

    When I try to do the same on RHEL8.5, during the boot, I have the "Press enter for maintenance (or type control-d to continue)" message.

    I type Ctrl+D to continue, then after boot, the FS is mounted, but I can see in journalctl -xe the following :

    Nov 24 13:28:59 server2.example.com systemd[1]: opt-symlink-foo.mount: Mount path /opt/symlink/foo is not canonical (contains a symlink).
    -- Subject: Mount point is not empty
    -- Defined-By: systemd
    -- Support: https://access.redhat.com/support
    --
    -- The directory /opt/symlink/foo is specified as the mount point (second field in
    -- /etc/fstab or Where= field in systemd unit file) and is not empty.
    -- This does not interfere with mounting, but the pre-exisiting files in
    -- this directory become inaccessible. To see those over-mounted files,
    -- please manually mount the underlying file system to a secondary
    -- location.
    Nov 24 13:28:59 server2.example.com systemd[1]: opt-symlink-foo.mount: Failed to run 'mount' task: Too many levels of symbolic links
    Nov 24 13:28:59 server2.example.com systemd[1]: opt-symlink-foo.mount: Failed with result 'resources'.
    -- Subject: Unit failed
    -- Defined-By: systemd
    -- Support: https://access.redhat.com/support
    

    So, apparently, having a symlink in the second field seems to be invalid, while it was OK on RHEL7.9.

    Digging further, I found the /run/systemd/generator/opt-symlink-foo.mount, showing that it did understand and expand my symlink :

    [Unit]
    SourcePath=/etc/fstab
    Documentation=man:fstab(5) man:systemd-fstab-generator(8)
    Before=local-fs.target
    
    [Mount]
    # Canonicalized from /opt/symlink/foo
    Where=/opt/bar/foo
    What=/files/foo
    Type=none
    Options=bind
    

    In /etc/fstab, if I use the real path (without symlink), the boot is OK, and the FS is mounted correctly.

    So, what's the right way to mount a bind volume when the path contains a symlink ?

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2025 Red Hat