"Too many levels of symbolic links" - trying to auto-mount USB SSD via sshfs, fstab

  • got an SSD plugged into a Pi 3 B+ board running LibreELEC 9.0.0 - the Pi is cabled to my router, as is my Manjaro/KDE PC

    i've been screwing around for weeks trying to mount on-demand the SSD from the PC and no one has so far been able to find the cause of the error "Too many levels of symbolic links"

    PC

    /etc/fstab:

    Code
    [email protected]:/var/media/sda1-ata-SanDisk_SDSSDH32/         /home/atom/kodi      fuse.sshfs          noauto,x-systemd.automount,device-timeout=10,_netdev,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

    ~/.ssh/config:

    Code
    Host kodi.lan
        HostName 192.168.50.111
        Port 22
        User root
        IdentityFile /home/atom/.ssh/LibreELEC_root_id_rsa

    from a terminal i can ssh into kodi just fine, but as soon as i add 'x-systemd.automount' to fstab (and run 'systemctl daemon-reload && systemctl restart home-atom-kodi.automount'), i get the "Too many levels of symbolic links" when i cd into ~/kodi

    if i add 'device-timeout=10' in addition to 'x-systemd.automount', this results in an empty ~/kodi directory

    there are no symbolic links in play - ~/kodi is an empty directory used for the mount point

    whether i use an IP or domain in fstab doesn't matter

    my goal is...

    * i want to be able to mount the Pi SSD on-demand from graphical file manager (Dolphin) with read/write permissions

    * i don't want to use SMB

  • Hi there, not sure if this will be of help but I encountered this exact same problem on Linux Mint 20.1. The error message is very unhelpful, and I found this thread (amongst many others, all without solutions) while searching for more information about the problem.

    The actual solution was hinted at here:

    SSHFS – Too Many Levels of Symbolic Links – Vassox

    The solution was to use the command line to open an ssh connection to the destination as the root user (or use sudo) which prompts to add the host fingerprint to the cache, to which you say yes. Having done this once, like magic, the automount will work as expected.

    Not sure if this is a "bug" in systemd or not, but it sure would be awfully nice if the error message was somewhat more useful!

    Hope this helps!

  • First of all I will tell you that I do not have the answer to your question, but I also use sshfs and I have no problems.

    I have an x86_64 device with LE 9.2.6 installed and I use the "/storage/shared" directory as common directory to all my multimedia devices (CoreELEC based), that is, when my Mecool KIII Pro device, which has an IP surveillance camera connected, is writing to /storage/shared is writing to the LE server many kilometers away. At the same time, all remote devices find here the common multimedia library in read-only mode left by the server.

    I do the /storage/shared mount on remote devices with the following commands:

    Code
    echo n | ssh-keygen -t rsa -f /storage/.ssh/id_rsa # only once
    ssh root@<ip-server-on-vpn-net> "mkdir -p /storage/.ssh" # only once
    cat /storage/.ssh/id_rsa.pub | ssh root@<ip-server-on-vpn-net> "cat >> /storage/.ssh/authorized_keys" # only once
    /opt/bin/sshfs root@<ip-server-on-vpn-net>:/storage/shared /storage/shared -o reconnect,delay_connect,_netdev # every time at boot in autostart.sh

    LE and CE do not allow the use of /etc/fstab.

    Edited 2 times, last by elonesna (May 17, 2021 at 1:15 PM).