r/freebsd • • 4d ago

help needed Instability in sshfs

Post image

I'm having problems with sshfs, and I don't know if there's an inherent instability in the tool, or in my system, or if it's to do with my very slow internet connection — or if I'm just using it badly. Can anyone help?

fusefs-sshfs-3.7.6, FreeBSD 15.1-RELEASE-p7, on a 2013 MacBook Pro with a USB wifi dongle made out of snails.

I mount a remote file system, it works. I list the contents of the mount point, it's good. I list a sub-directory, that's good too. But as I drill down, eventually I get "No such file or directory" and at that point it's all gone! The same thing happens if I just leave it alone for more than a couple of seconds, and it's the same whether I use ls or an Xorg file manager. If I go back to the mount point then I can see the contents again, rinse and repeat. If I open a file then it will probably load, but it'll drop after a couple of seconds.

Using rclone to mount my Dropbox works perfectly, at least I haven't encountered any issues.

Here's an example of my mount command:

sshfs -oIdentityFile=[LOCAL_PATH_TO_PRIVATE_KEY] [REMOTE_USER]@[REMOTE_IPV4]:/ [LOCAL_PATH_TO_MOUNT_POINT] -oServerAliveInterval=15

I've tried a few different values of ServerAliveInterval — 15 as above, also 1, something else I think, but I don't remember any of that making any difference.

Er... so I guess I'm doing something stupid and obvious, and I'd be really grateful for any advice!

Thaks so much,

Ben

12 Upvotes

17 comments sorted by

3

u/Chester-Berkeley desktop (DE) user 4d ago

Cute octopus btw

2

u/spuntotheratboy 4d ago

Thank you! It's Osmereldo 🙂

3

u/Lord_Mhoram 4d ago

I can't help with this, as when I tried sshfs, it made magit in emacs unbearably slow due to the large number of filesystem calls it does. I had similar trouble with tramp on remote files.

But that led me to mutagen, which uses rsync to keep local and remote directories synced up. I've been using it for a few months now, and it's been excellent, so I'd suggest giving it a try if you can't work this out. You do need rsync on the remote system.

3

u/spuntotheratboy 4d ago

That's intriguing, thanks, I'll look into mutagen: rsync is on the server so that's not a problem.

3

u/grahamperrin Claude user 4d ago

Probably not stupid :-)

You could debug, if Osmereldo is agreeable. Something like:

sshfs user@host:/ /mnt/point -oIdentityFile=/path/to/key -f -d

  • run it in a second terminal
  • consider the first error line after vanishing occurs.

You might see a remote SFTP status, or a local FUSE error.

Also/alternatively: have you tried turning off the caches?

3

u/spuntotheratboy 4d ago

Osmereldo is debug-positive.

Thanks for your suggestions. It's great to have something to try, and I'll let you know what comes of that.

As for the caches you mention... what are they? And how do I interact with them / turn them off?

It also occured to me that there might be something I can do on the remote server. In this case it's a virtual web server running Debian, is there anything to be done there? I don't have root or sudo on it.

Thanks once again!

2

u/grahamperrin Claude user 4d ago

… caches …

Something like this (with /bin/sh as your shell):

sshfs user@host:/ /mnt/point \
  -oIdentityFile=/path/to/key \
  -oattr_timeout=0,entry_timeout=0,negative_timeout=0,dir_cache=no

3

u/spuntotheratboy 4d ago

Next chance I get, thanks.

3

u/spuntotheratboy 4d ago

I have no idea how to read this output. I'm doing `ls -Ahl` one directory down from the mountpoint, and I should see four 755 directories and one regular 644 file. The first time, it works, and the sshfs debugging out put looks like this:

[00084] OPENDIR
[00084] HANDLE 15bytes (15ms)
[00085] READDIR
[00086] READDIR
[00085] NAME 3340bytes (17ms)
[00086] STATUS 34bytes (17ms)
[00087] READDIR
[00088] READDIR
[00089] CLOSE
[00090] LSTAT
[00087] STATUS 34bytes (20ms)
[00088] STATUS 34bytes (20ms)
[00089] STATUS 30bytes (20ms)
[00090] ATTRS 41bytes (20ms)
[00091] OPENDIR
[00091] HANDLE 15bytes (15ms)
[00092] OPENDIR
[00092] HANDLE 15bytes (15ms)
[00093] READDIR
[00094] READDIR
[00093] NAME 797bytes (16ms)
[00094] STATUS 34bytes (16ms)
[00095] READDIR
[00096] READDIR
[00097] CLOSE
[00098] CLOSE
[00095] STATUS 34bytes (15ms)
[00096] STATUS 34bytes (15ms)
[00097] STATUS 30bytes (21ms)
[00098] STATUS 30bytes (21ms)

Then, when I do `ls -Ahl` again, I get "No such file or directory" and the debugging output looks like this, with a lot fewer lines:

[00099] LSTAT
[00099] ATTRS 41bytes (16ms)
[00100] LSTAT
[00100] ATTRS 41bytes (16ms)
[00101] READLINK
[00101] NAME 61bytes (15ms)
[00102] LSTAT
[00102] STATUS 35bytes (16ms)

I'm very grateful for your help so far, please don't feel obliged to waste any more of your Sunday on it. Having said that, it would be really cool to get this working reliably!

Thaks once again,
Ben

3

u/grahamperrin Claude user 4d ago

Try a remount with follow_symlinks, so sshfs resolves links on the server rather than letting your kernel resolve them locally …

3

u/spuntotheratboy 4d ago

I will try that, thanks!

1

u/Alarmed_Contest8439 4d ago

hm, what network card?

1

u/spuntotheratboy 4d ago

usbconfig gives me this:

TL-WN823N v2/v3 [Realtek RTL8192EU] TP-Link

It's... I mean, it works, and that's great, but it is slow. I don't actually think this is the source of the problem, though, because, as I said, rclone keeps my Dropbox connection open indefinitely, and I can be logged into another machine on my local network for days over ssh without any issues.

1

u/pfak 4d ago

That particular chipset was garbage when it was released over a decade ago and I don't feel like has gotten any better.

Try a different card. Sshfs is probably fine. 

1

u/spuntotheratboy 4d ago

Maybe. WiFi is stable otherwise, though, I don't get anything weird happening — if you don't count it being slow — so I'm going to exhaust my options with sshfs before I start spending money on another dongle.

If it does come to that, though, what usb WiFi dongle would you recommend?

1

u/pfak 4d ago

"Maybe".

sshfs is a proven entity.
RTL8192EU is a $3 chipset from 2013 that had issues like the one you're describing, even on Linux.

You can't use the 802.11ac WiFi in the MacBook? Not even via LinuxKPI?

2

u/spuntotheratboy 4d ago

I'm not saying you're wrong. But I don't have another card to hand at the moment.

The internal card is unsupported in FreeBSD and I haven't managed to get it working with any of the workarounds I've tried. I'm still considering just replacing it, if I can nail down the process, but then someone else on here says they've written a driver so that's a possibility too.

But I'm also open to buying a new dongle at some point, especially if I can't resolve the sshfs issue. What one would you recommend?