Samba mount point becomes inaccessible after hibernation/suspend

Bug #24864 reported by David (djst) Tenser
26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Invalid
Medium
Ubuntu Server

Bug Description

After resuming from hibernation or suspend-to-ram, the mount points for smbfs
shares become inaccessible. You can't even ls the directory. Instead you get
this error message:

ls: .: I/O error

The only way to restore the mount point is to reboot.

Steps to reproduce:

1. Mount a smb share, either manually (mount) or automatically (fstab)
2. Suspend or Hibernate the computer
3. Resume
4. Try to browse the share

Revision history for this message
gpothier (gpothier) wrote :

Same here. If I try to unmount the share I get
gpothier@tadzim:/usr/src$ sudo umount /media/stgo-big
umount: /media/stgo-big: device is busy
umount: /media/stgo-big: device is busy

I also have the error message with ls, but after quite a while. Any kind of access to the share takes a long while to fail.

Revision history for this message
gpothier (gpothier) wrote :

Ah, I forgot to mention that this is with kernel 2.6.16.19. Suspend did not work with 2.6.15 on my machine so I don't know if the problem occurs with the standard kernel. Maybe the original reporter can confirm?

Revision history for this message
gpothier (gpothier) wrote :

Here is a workaround:
- add the following script (name it samba-shares) to /etc/init.d

---8<------------------------------
#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

start () {
 echo -n "Mounting samba shares"
 mount -a -t smbfs
 echo "."
}

stop () {
 echo -n "Unmounting samba shares"
 umount -l -a -t smbfs
 echo "."
}

case "$1" in
    start)
 start
    ;;

    stop)
 stop
    ;;

    restart)
 stop
 sleep 2
 start
    ;;

    *)
 echo "Usage: /etc/init.d/samba-shares {start|stop|restart}" >&2
 exit 1
    ;;
esac

exit 0
---8<------------------------------

- add the script to the list of services to stop during suspend (in /etc/default/acpi-support, in the STOP_SERVICES variable)

Doing this, samba shares are lazily unmounted before suspend, and remounted after resume. If there are open files on the share we have problems again... but otherwise it works fine.

Revision history for this message
Jörg Höhle (joerg-cyril-hoehle) wrote :

An alternative approach to /etc/init.d is using ACPI. Add a file like
/etc/acpi/suspend.d/30-smbfs-umount.sh
<pre>
# Unmount SAMBA shares - open files on these don't survive suspending.
umount -a -l -t smbfs
</pre>
-- inspired from
http://forums.debian.net/viewtopic.php?t=6984&view=next

BTW, acpi calls 65-STOP_SERVICES (for init.d services) after 55-down-interfaces.sh -- maybe not so nice w.r.t. the server & TCP connection.

I can't comment whether there's anything better to do than umount.

I don't understand why umount is necessary at all -- why can't enough state be preserved for things like ls -al /mnt/samba/foo, df or pwd? I mean, I might not even have open files from Samba (but directories).

Bug affects at least Breezy and Dapper.

Changed in samba:
assignee: adconrad → ubuntu-server
Revision history for this message
Mathias Gug (mathiaz) wrote :

This is a problem with the suspend/resume process. Reassigning to acpi-support.

See bug 30594 for a similar request for nfs mounts.

Revision history for this message
otakuj462 (otakuj462) wrote :

Confirmed in Kubuntu 7.10.

Revision history for this message
otakuj462 (otakuj462) wrote :

Also, can confirm that the workaround listed by gpothier works flawlessly on Kubuntu 7.10.

Revision history for this message
Vladimir Hidalgo (vlad88sv) wrote : Affecting to reboot too.

Hi, I will like to re-confirm this bug in 7.10.

My problem it's not just with suspend or hibernate, but also with reboot. I can mount smbfs file system fine in FSTAB, but when I reboot, it just behaves the same way as the first post says.

I have in FSTAB:

"//192.168.1.6/Datos /media/D smbfs guest,iocharset=utf8,codepage=cp850,dmask=777,fmask=777"

It works fine if I don't reboot, but once rebooted it will not auto mount the share (even if the remote recourse is available)

After the problem appears, it will complain if I try to mount it manually:

"vlad@Auro1:~$ sudo mount /media/F
Could not resolve mount point /media/"

"vlad@Auro1:~$ stat /media/F
stat: no se puede efectuar `stat' sobre `/media/F': Error de entrada/salida (IO error)"

"vlad@Auro1:~$ ls /media/F
ls: /media/F: Error de entrada/salida (IO error)"

(And its takes very long time to complete)

Samba & connection still works fine if I do in Konqueror (by example): "smb://192.168.1.6/eMulePlus"

The only solution I has, is to comment the mount lines in FSTAB, then reboot, then uncomment the lines in FSTAB, do "mount -a". Or other option (what is what I'm currently using) is to use an script to mount them with smbmnt.

Revision history for this message
Travis Whitaker (pi-boy-travis) wrote :

I think that is a different bug. This bug needs some more information. Can anyone confirm this on 8.04/8.10/9.04?

Changed in acpi-support (Ubuntu):
status: New → Incomplete
Revision history for this message
Philip Muškovac (yofel) wrote :

 We are closing this bug report because gutsy reached EOL and nobody confirmed this bug on 8.04/8.10/9.04. Please reopen it if you can confirm it in a supported release, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in acpi-support (Ubuntu):
status: Incomplete → Invalid
Artur (artur.)
Changed in acpi-support (Ubuntu):
status: Invalid → New
Steve Langasek (vorlon)
Changed in acpi-support (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.