LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-23-2019, 07:12 AM   #1
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Rep: Reputation: Disabled
on-demand mount network drive - fstab, x-systemd.automount - fail!


setup: Ras-Pi with an ext4 USB SSD wired to router
Manjaro-KDE laptop wired to router

goal: i want to mount, on-demand, the R-Pi SSD from the laptop without using SMB/CIFS - i want the mount to activate when i enter the directory using graphical file manager (Dolphin) and have read/write access - i want to mount this way because a) i don't want/like SAMBA/Windows and b) i want to be able to play video directly from Dolphin (using VLC, etc.) without the KIO problems

i can SSH into the R-Pi fine and
Code:
sshfs root@kodi.lan:/ /home/atom/kodi
works fine, however i cannot get this working using fstab

here are just a few of this things i've tried in /etc/fstab ...

Code:
# arch wiki - https://wiki.archlinux.org/index.php/SSHFS#On_demand
# result when cd to /kodi: bash: cd: kodi: Too many levels of symbolic links
#root@kodi.lan:/         /home/atom/kodi      fuse.sshfs     noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

# result when cd to /kodi: bash: cd: kodi: Too many levels of symbolic links
#sshfs#root@kodi.lan:/   /home/atom/kodi      fuse          noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

# drive is not mounted - /kodi is empty
#root@kodi.lan:/         /home/atom/kodi      fuse.sshfs    noauto,systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

# drive is not mounted - /kodi is empty
#root@kodi.lan:/         /home/atom/kodi      fuse.sshfs    noauto,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

# drive is not mounted - /kodi is empty
#sshfs#root@kodi.lan:/    /home/atom/kodi      fuse          noauto,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

# result when cd to /kodi: bash: cd: kodi: Too many levels of symbolic links
#root@kodi.lan:/         /home/atom/kodi      fuse.sshfs     noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0

# result when cd to /kodi: bash: cd: kodi: Too many levels of symbolic links
#root@kodi.lan:/         /home/atom/kodi      sshfs          noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
the "Too many levels of symbolic links" error is erroneous i believe since there are no symlinks in play - the folder /home/atom/kodi is not a symlink and is empty

note that in /etc/fuse.conf i have uncommented "user_allow_other" since "allow_other" is sometimes used in fstab - this is something no other tutorial or the Arch wiki page i read has mentioned
 
Old 02-23-2019, 11:22 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Code:
root@kodi.lan:/  /home/atom/kodi  fuse.sshfs  noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
users isn't required because it is the system that does the mounting/unmounting. I would also try removing idmap=user.

Quote:
result when cd to /kodi: bash: cd: kodi: Too many levels of symbolic links
Your mounting the remote directory to /home/atom/kodi not /kodi. Is this a typo? What happens when you try
cd /home/atom/kodi
 
Old 02-23-2019, 05:35 PM   #3
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
hi michaelk - thanks for the reply

Quote:
Your mounting the remote directory to /home/atom/kodi not /kodi. Is this a typo? What happens when you try
cd /home/atom/kodi
not a typo - i just didn't write out the entire path - i was cd'ing into /home/atom/kodi

so after droping both "users" and "idmap=user", this is the result with mounting with sshfs, fuse.sshfs and fuse...

Code:
root@kodi.lan:/         /home/atom/kodi      sshfs          noauto,x-systemd.automount,_netdev,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
the above results in "bash: cd: /home/atom/kodi: Too many levels of symbolic links", as does...

Code:
root@kodi.lan:/         /home/atom/kodi      fuse.sshfs          noauto,x-systemd.automount,_netdev,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
the next one results in... nothing - there is no content in the /kodi directory, but no error either

Code:
root@kodi.lan:/         /home/atom/kodi      fuse          noauto,x-systemd.automount,_netdev,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
 
Old 02-24-2019, 07:55 AM   #4
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
for what it's worth...

reference:
Code:
root@kodi.lan:/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
adding 'x-systemd.automount' results in "Too many levels of symbolic links" when cd'ing to /home/atom/kodi (or "Could not enter folder /home/atom/kodi." in Dolphin)

if i add 'device-timeout=10' in addition to 'x-systemd.automount' there are no errors, but /home/atom/kodi is empty (which it should not be and, in fact, is not when i
Code:
sshfs root@kodi.lan:/ /home/atom/kodi
 
Old 02-24-2019, 09:52 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
I'm not sure why automount isn't working. Are you restarting the automount daemon per the arch wiki article or restart your system after modifying the fstab file?
 
Old 02-24-2019, 12:10 PM   #6
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
yes sir - i'm running this after every edit of fstab...
Code:
# systemctl daemon-reload && systemctl restart home-atom-kodi.automount
 
Old 02-24-2019, 07:21 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Try using the Pi's IP address and see if that works.
Code:
root@IP_address:/var/media/sda1-ata-SanDisk_SDSSDH32/   /home/atom/kodi  fuse.sshfs   placemount options here 0 0
 
Old 02-25-2019, 03:57 AM   #8
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
whether i use the IP or kodi.lan, the behavior is the same - i just use the latter because i have it configured that way in ~/.ssh/config

Code:
Host kodi.lan
    HostName 192.168.50.111
    Port 22
    User root
    IdentityFile /home/atom/.ssh/LibreELEC_root_id_rsa
 
Old 02-25-2019, 08:42 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
The OS does not read the config file and even though I have a local DNS automount does not work unless I use the IP address in my fstab file.
 
Old 02-25-2019, 09:44 AM   #10
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
i did that before (used the IP) and just tested again now - same thing: too many levels of symbolic links

Code:
root@192.168.50.111:/var/media/sda1-ata-SanDisk_SDSSDH32/   /home/atom/kodi  fuse.sshfs   noauto,x-systemd.automount,_netdev,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
this will do the same thing...
Code:
root@192.168.50.111:/   /home/atom/kodi  fuse.sshfs   noauto,x-systemd.automount,_netdev,IdentityFile=/home/user/.ssh/LibreELEC_root_id_rsa,allow_other,reconnect 0 0
Quote:
The OS does not read the config file and even though I have a local DNS automount does not work unless I use the IP address in my fstab file.
not sure if this is a relevant question, but i don't understand what you mean when you say the OS doesn't read the config file (i assume you're referring to /.ssh/config) - if i ssh from a terminal and use kodi.lan, it works fine because that hostname is converted to its IP in the config file, though i'm guessing that the OS doesn't read it directly - maybe that's what you meant?
 
Old 02-25-2019, 11:01 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Yes, the OS does not read the users config file directly.

Just out of curiosity does your private key have a passphrase?
 
Old 02-25-2019, 11:13 AM   #12
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
negitive, but will be happy to gen and push a new key you think that's an issue
 
Old 02-25-2019, 11:26 AM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
No, just going through threads with a similar problem but have different answers or went unresolved.
 
Old 02-25-2019, 02:18 PM   #14
zopte
LQ Newbie
 
Registered: Feb 2019
Posts: 10

Original Poster
Rep: Reputation: Disabled
i've been looking for solutions for weeks - i have a thread open on the manjaro forum - have not a solution
 
Old 05-17-2021, 09:29 PM   #15
LazyCodeMonkey
LQ Newbie
 
Registered: May 2021
Posts: 2

Rep: Reputation: Disabled
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 (link removed as I can't post it, but the page was on vassox dot com).

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!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Minecraft/Terraria servers to activate on-demand via systemd. MikeyCarter Linux - Software 1 11-11-2016 09:20 AM
Automount network shares - several questions including autoFS or systemd? anon247 Linux - Newbie 4 08-28-2016 09:13 PM
Running Systemd on-demand like xinitd/ftp? MikeyCarter Linux - Software 1 06-06-2016 05:35 AM
[SOLVED] if [[ -n "$1" ]]; then FAIL FAIL FAIL rbees Programming 7 03-25-2015 02:39 PM
CentOS 5.2 Automount isos in fstab \other methods that work?automount iso Frankly3D Linux - General 6 07-13-2008 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration