| Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-27-2010, 09:33 AM
|
#1
|
|
Member
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470
Rep:
|
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?
|
|
|
|
09-27-2010, 09:44 AM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,827
|
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.
|
|
|
|
09-27-2010, 12:51 PM
|
#3
|
|
Member
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470
Original Poster
Rep:
|
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.
|
|
|
|
09-28-2010, 07:52 AM
|
#4
|
|
Member
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470
Original Poster
Rep:
|
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
|
|
|
|
11-16-2010, 09:17 PM
|
#5
|
|
LQ Newbie
Registered: Nov 2010
Posts: 1
Rep:
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:31 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|