# sshfs crashes on one of my machines



## tingo (Jan 26, 2013)

I use sshfs (sysutils/fusefs-sshfs) a lot, it is handy to just mount a storage space (on a NAS or fileserver) when I need it. And it usually works well.
However, on this one machine it just crashes whenever I try to mount a remote server. Like this:

```
tingo@kg-v2$ sshfs tingo@f3:/mnt/zstore/home-tingo ~/mpoint
tingo@kg-f3.kg4.no's password: 
tingo@kg-v2$
tingo@kg-v2$ ll
ls: mpoint: Bad file descriptor
```
df -h output

```
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s2a    495M    358M     97M    79%    /
devfs          1.0k    1.0k      0B   100%    /dev
/dev/ad4s2e    495M     91M    364M    20%    /tmp
/dev/ad4s2f    102G     90G    4.1G    96%    /usr
/dev/ad4s2d    8.6G    997M    6.9G    12%    /var
procfs         4.0k    4.0k      0B   100%    /proc
linprocfs      4.0k    4.0k      0B   100%    /usr/compat/linux/proc
fdescfs        1.0k    1.0k      0B   100%    /dev/fd
/dev/fuse0       0B      0B      0B   100%    /usr/home/tingo/.gvfs
/dev/fuse1       0B      0B      0B   100%    /usr/home/tingo/mpoint
```
try to umount it:

```
tingo@kg-v2$ umount ~/mpoint
umount: /home/tingo/mpoint: stat: Bad file descriptor
umount: /home/tingo/mpoint: unknown file system
tingo@kg-v2$ umount -f ~/mpoint
umount: /home/tingo/mpoint: stat: Bad file descriptor
umount: /home/tingo/mpoint: unknown file system
```
If I look in /var/log/messages I see this:

```
Jan 26 15:18:11 kg-v2 kernel: pid 10130 (sshfs), uid 1001: exited on signal 11
```
and no core dumps.
The machine is running 8.3-stable:

```
tingo@kg-v2$ uname -a
FreeBSD kg-v2.kg4.no 8.3-STABLE FreeBSD 8.3-STABLE #6: Fri Apr 27 23:50:55 CEST 2012
     root@kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
```
and the relevant ports are up to date:

```
root@kg-v2# portversion -v | grep fuse
fusefs-gphotofs-0.4.0_1     =  up-to-date with port 
fusefs-kmod-0.3.9.p1.20080208_11  =  up-to-date with port 
fusefs-libs-2.9.2           =  up-to-date with port 
fusefs-sshfs-2.4            =  up-to-date with port
```

I've tried a number of different servers, sshfs (on this machine) crashes when I try to mount them. The same servers works fine from other machines running FreeBSD.

Any idea what I should look for?


----------



## tingo (Feb 20, 2013)

I reinstalled (`portupgrade -f`) the ports sysutils/fusefs-libs, sysutils/fusefs-kmod and sysutils/fusefs-sshfs and rebooted the machine. Unfortunately  that didn't help. I'll have to dig deeper.


----------



## Carpetsmoker (Feb 25, 2013)

I know this doesn't solve anything, but I've had similar problems on a FreeBSD 9.0 machine. I gave up and used a different solution.
If you really want sshfs to work, you could try contacting the sshfs developers...


----------



## cuq (Mar 13, 2013)

Same problem here: 

```
FreeBSD 9.0-RELEASE
fusefs-kmod-0.3.9.p1.20080208_11
fusefs-libs-2.9.2
fusefs-ntfs-2012.1.15
fusefs-sshfs-2.4
```


----------



## allesan (Apr 1, 2013)

I have the same problem. FreeBSD 9.1
No solution yet?


----------



## tingo (Apr 3, 2013)

Nope, no solution yet. This problem is hard to figure out.


----------



## allesan (Apr 4, 2013)

SSHFS is so convenient for me in a lot of situations, and I can think of good alternative...


----------



## cuq (Apr 8, 2013)

I got a kind of by-pass... I noted that the connection keeps alive while I just use the terminal. If I open the files from Thunar or from the the Open... command the connection drops but if, for example, I do `geany /path/to/the_file` it remains open and I can edit the file without problems.

I hope this helps

Cheers.


----------



## tingo (Apr 11, 2013)

@cug: thanks.

It won't help in my situation; I use sshfs with Worker (or Thunar) for copying / file access purposes.


----------



## tingo (Apr 28, 2013)

I haven't found out more, but the problem still bothers me.


----------



## grembo (Jun 8, 2013)

sshfs was never exceptionally stable, but since I upgraded to 9.1 it got really bad.

My system and ports are compiled using system clang 3.1 and since sshfs seems to crash in libgthread, I tried rebuilding devel/glib20 using system gcc 4.2.1:

`CC=gcc CXX=g++ portmaster devel/glib20`

This definitely improved the situation for me, it's stable enough for day to day tasks now.


----------



## tingo (Jun 8, 2013)

Doesn't help for my situation: main workstation is running FreeBSD 8.3-STABLE, and there is no Clang here.


----------



## grembo (Jun 9, 2013)

And you're not using a different version of gcc (!= 4.2.1)?


----------



## tingo (Jun 9, 2013)

Nope. Details:

```
tingo@kg-v2$ uname -a
FreeBSD kg-v2.kg4.no 8.3-STABLE FreeBSD 8.3-STABLE #6: Fri Apr 27 23:50:55 CEST 2012
     root@kg-v2.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
tingo@kg-v2$ which gcc
/usr/bin/gcc
tingo@kg-v2$ gcc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
```


----------



## grembo (Jun 11, 2013)

*make config*

Did you enable COLLATION_FIX in devel/glib20?


----------



## tingo (Jun 11, 2013)

No. I can do that - if you present an interesting enough reason why I should do so. Otherwise, you are just suggesting random things in the hope that one of them will work.


----------



## fonz (Jun 11, 2013)

tingo said:
			
		

> if you present an interesting enough reason why I should do so. Otherwise, you are just suggesting random things in the hope that one of them will work.


As they would say on Wikipedia: _Please don't bite the newbies_. (subtle hint)


----------



## grembo (Jun 12, 2013)

*You get what you ask for*



> Any idea what I should look for?



There are different ways to crash sshfs. For me it got a lot more stable since I used gcc instead of clang, but it still crashes occasionally.

Setting COLLATION_FIX helped the author of PR PR 176874, with who I've been in contact lately, but it's probably only relevant if you're using the iconv module like in `sshfs -o iconv,to_code=utf-8,from_code=iso8859-1`.


----------



## tingo (Jun 21, 2013)

As I don't use -o iconv, it isn't relevant.


----------



## tingo (Aug 3, 2013)

Set up a brand new workstation, using FreeBSD 8.4-stable and newest ports. sshfs still crashes :-(
Details:

```
tingo@kg-core1$ uname -a
FreeBSD kg-core1.kg4.no 8.4-STABLE FreeBSD 8.4-STABLE #0 r253646: Thu Jul 25 10:12:31 UTC 2013
     root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
tingo@kg-core1$ portversion -v *ssh* *fuse*
fusefs-gphotofs-0.4.0_1     =  up-to-date with port 
fusefs-kmod-0.3.9.p1.20080208_11  =  up-to-date with port 
fusefs-libs-2.9.3           =  up-to-date with port 
fusefs-sshfs-2.4            =  up-to-date with port 
linux-f10-libssh2-0.18      =  up-to-date with port
```
I really wish I could figure out what the problem is. sshfs is stable on other platforms.


----------



## Savagedlight (Aug 3, 2013)

Is this a problem on 10-current? IIRC, fusefs is part of base and more stable there.


----------



## tingo (Mar 1, 2014)

I don't know (yet). But the problem is still annoying as hell on my FreeBSD 8.4-STABLE workstation.


----------



## tingo (Mar 9, 2014)

And another frustrating session this evening. The most frustrating thing is that I can't seem to figure out a pattern, it seems random how many files or how much data I can copy before sshfs crashes.


----------



## tingo (Apr 6, 2014)

FWIW, I tested on a machine running FreeBSD 10.0-release today:

```
$ uname -a
FreeBSD kg-v7.kg4.no 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014
     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```
First I connected from the 10.0 machine (via sshfs) to my main workstation and copied the files from there.
Next, I connected from the 10.0 machine to a different machine (still via sshfs) to a different machine and copied the files there.
Finally, I copied the files from the 10.0 machine to a third machine.
All without problems.
So yes, it appears that sshfs is stable (or more stable) under FreeBSD 10.0-release.


----------

