LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 09-27-2010, 09:33 AM   #1
lefty.crupps
Member
 
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470

Rep: Reputation: 32
Unhappy How to keep alive (or reconnect) fuse SSHFS mount between sleep/hibernate?


Running Debian GNU/Linux (testing/Squeeze, 2.6.32) with KDE 4.4.5 and Wicd networking, trying to sleep (hibernate to RAM).

I have a laptop that connects to another computer in my house with SSHFS at laptop's login to KDE, to allow Amarok to play music and to allow non-KDE apps to easily open and save files across the network (most KDE apps can natively use sftp:// KIO slave).

When the laptop goes to sleep and then resumes, the three mount points:
/home/user/Music
/home/user/Photos
/home/user/bigcomputer
sometimes are able to reconnect and sometimes SSHFS (fuse) will hang, preventing any file open/save dialogs from functioning (the wife loves this). When SSHFS hangs, sometimes I am able to manually (CLI) unmount the drives as user, sometimes I must be root to do so.

My current attempts to make this function cleanly are failing. This is what I've tried:
1. Using Wicd's 'scripts' functionality to unmount the drives before disconnection, but I don't know if Wicd knows that Sleep is happening
2. KDE's PowerDevil allows for actions before sleep; I put a script there to unmount the drives before sleep
3. I have Wicd (via 'scripts') try to reconnect the drives after a 5sec delay upon reconnecting to the network, but if the mount points aren't cleanly unmounted this usually causes the hang
4. Sometimes things just seem to hang for no reason.
5. Sometimes everything works just fine.

My mount scripts call for SSHFS to use:
-s disable multi-threaded operation
-o reconnect
My unmount (fusermount) scripts use:
-u unmount
-z lazy unmount
and seem to generally work well when I am testing the scripts. It's the Sleep action that seems to be causing most of the issues, as I have a hard time recreating the issue when I am just testing by running the various commands.

Can anyone help me to figure out the best way to make this function? I am not against using /etc/fstab to make these mounts if the ssh mount point can survive the Sleep mode, but I thought that userspace may be better for this (perhaps not).

Earlier today I thought maybe the unmount script could be given UID perms to allow the user account to run root permissions to better unmount these network connections before sleep, but I am not sure yet if that is a good solution or not.

Suggestions anyone?
 
Old 09-27-2010, 09:44 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Well it's possible to run sshfs over autofs so that would disconnect the mount when it was idle. I'm not sure if that would be wholly suitable if she likes to slam the lid done immediately after using those files, but aside from the time taken to re-establish the sshfs connection on first use of the mount point, it's a really nice model that makes this sort of thing a non-issue.
 
Old 09-27-2010, 12:51 PM   #3
lefty.crupps
Member
 
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470

Original Poster
Rep: Reputation: 32
autofs to the rescue? I'll get back to you...

> Well it's possible to run sshfs over autofs so that would
> disconnect the mount when it was idle
> ...re-establish the sshfs connection on first use of the
> mount point

That sounds wonderful, I will look into autofs tonight. Thank you so much for the heads up on that, acid_kewpie, and I will post back with results within a few days of testing.
 
Old 09-28-2010, 07:52 AM   #4
lefty.crupps
Member
 
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470

Original Poster
Rep: Reputation: 32
Unhappy

I cannot seem to get autofs to function with sshfs and mDNS (avahi/zeroconf), although the mDNS may have nothing to do with this.

SSH keys (passwordless) are working fine for normal sshfs and ssh operations.

Here is my entry for /etc/auto.master:
Code:
#/etc/auto.master
/mnt/network_files/Music /etc/auto.sshfs.Music uid=1000,gid=1000,--timeout=30,--ghost
/mnt/network_files/Photos /etc/auto.sshfs.Photos uid=1000,gid=1000,--timeout=30,--ghost
/mnt/network_files/lefty_computer /etc/auto.sshfs.lefty_computer uid=1000,gid=1000,--timeout=30,--ghost
+auto.master
Here are my other /etc/autofs.sshfs.* files (all very similar so I'll post just one) which I've made executable (apparently needed); note that I've taken a lot of these options from what I've read on the web, but many of the articles seem rather old:
Code:
#/etc/auto.sshfs.music
Music -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#lefty@bigboi.local\:/home/lefty/Music

Apparently I also needed to add a line to nsswitch.conf:
Code:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files mdns4_minimal dns mdns4
networks:       files mdns4_minimal dns mdns4
automount:      nis files # mdns4_minimal dns mdns4 # these cause 'ignored' warnings

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

I restarted /etc/init.d/autofs and no matter what I try, nothing shows up in my directory listings; directories are created if I put the mount point elsewhere (in auto.master such as /mnt/Music ). Am I missing something or have I mis-configured the configs? Are my options outdated? Does mDNS not work to resolve my hostname? Are my sshfs syntaxes wrong (because that is a mess)?

Last edited by lefty.crupps; 09-28-2010 at 07:54 AM. Reason: edited for clarity
 
Old 11-16-2010, 09:17 PM   #5
humba
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
I'm no expert, but maybe try afuse, an automounter for fuse file systems?

This is my first post on linuxquestions.org, so I cannot post links but just google:

"afuse" howto
 
  


Reply

Tags
fuse, kde, network, sleep, sshfs



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
Wifi won't reconnect after standby or hibernate franksjacket Linux - Networking 13 03-26-2012 07:01 AM
How to reconnect to wifi on resume from hibernate/suspend? Slackware 12.1, madwifi thesk8ingtoad Slackware 1 08-22-2008 07:15 AM
sleep/hibernate causes hardware failure St.Jimmy Linux - Hardware 0 02-11-2007 03:34 PM
Getting my laptop to Hibernate or Sleep Scott7 Debian 2 10-15-2005 05:33 AM
shared filesystem crap: shfs, sshfs, lufs, fuse whansard Linux - Networking 1 06-26-2005 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 04:53 PM.

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