You are not logged in.

#1 2012-10-10 14:43:25

Acce
Member
Registered: 2010-04-23
Posts: 11

[solved]USB-harddisk unmounted when network disconnected

For some reason, when I disconnect my network connection from Networkmanager applet, my usb-harddisk gets unmounted.
Has anyone else experienced this or have solutions or suggestions how to fix this?

I tailed /var/log/messages.log and this is what came up:

Oct 10 23:29:16 localhost udisksd[1582]: Mounted /dev/sdb1 at /run/media/testi/MYDISK on behalf of uid 1000
Oct 10 23:29:34 localhost NetworkManager[771]: <info> (usb0): device state change: activated -> disconnected (reason 'user-requested') [100 30 39]
Oct 10 23:29:34 localhost NetworkManager[771]: <info> (usb0): deactivating device (reason 'user-requested') [39]
Oct 10 23:29:34 localhost dhcpcd[7894]: received SIGTERM, stopping
Oct 10 23:29:34 localhost dhcpcd[7894]: usb0: removing interface
Oct 10 23:29:34 localhost NetworkManager[771]: <info> (usb0): canceled DHCP transaction, DHCP client pid 7894
Oct 10 23:29:34 localhost NetworkManager[771]: <warn> (pid 7894) unhandled DHCP event for interface usb0
Oct 10 23:29:34 localhost dbus[556]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Oct 10 23:29:34 localhost dbus[556]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Oct 10 23:29:34 localhost ntfs-3g[26706]: Unmounting /dev/sdb1 (MYDISK)
Oct 10 23:29:34 localhost udisksd[1582]: Cleaning up mount point /run/media/testi/MYDISK (device 8:17 is not mounted)
Oct 10 23:29:34 localhost ntpd[7926]: Terminating

It simply states that /dev/sdb1 is unmounted.. and I don't see any reasons. Does it have something to do with the 'org.freedesktop.nm_dispatcher'? Someone who understand this log better, please help.

If you need some other logs or something, please ask.

Last edited by Acce (2012-10-24 13:12:11)

Offline

#2 2012-10-10 18:08:49

p0x8
Member
Registered: 2012-09-20
Posts: 67

Re: [solved]USB-harddisk unmounted when network disconnected

NetworkManager is apparently disconnecting a device named usb0. Is it some sort of USB network adapter? What does the kernel log (dmesg) say?

Offline

#3 2012-10-10 18:32:47

Acce
Member
Registered: 2010-04-23
Posts: 11

Re: [solved]USB-harddisk unmounted when network disconnected

Hello, thanks for your reply.

At the time log was tailed, it was an usb device, but it also happens with wlan, which is an integrated card.

like this:

Oct 11 03:24:09 localhost NetworkManager[771]: <info> (wlan0): deactivating device (reason 'user-requested') [39]
Oct 11 03:24:09 localhost dhcpcd[10490]: received SIGTERM, stopping
Oct 11 03:24:09 localhost dhcpcd[10490]: wlan0: removing interface
Oct 11 03:24:09 localhost NetworkManager[771]: <info> (wlan0): canceled DHCP transaction, DHCP client pid 10490
Oct 11 03:24:09 localhost dbus[556]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Oct 11 03:24:09 localhost NetworkManager[771]: <warn> (pid 10490) unhandled DHCP event for interface wlan0
Oct 11 03:24:09 localhost NetworkManager[771]: <info> (wlan0): supplicant interface state: completed -> disconnected
Oct 11 03:24:09 localhost dbus[556]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Oct 11 03:24:09 localhost ntfs-3g[10952]: Unmounting /dev/sda3 (Acer)
Oct 11 03:24:09 localhost udisksd[1582]: Cleaning up mount point /run/media/testi/Acer (device 8:3 is not mounted)
Oct 11 03:24:09 localhost ntfs-3g[10946]: Unmounting /dev/sdb1 (MYDISK)
Oct 11 03:24:09 localhost udisksd[1582]: Cleaning up mount point /run/media/testi/MYDISK (device 8:17 is not mounted)
Oct 11 03:24:09 localhost ntpd[10525]: Terminating

seems like it's not usb disks only, it unmounted the other partition from the sda too. And dmesg says nothing about disconnecting from network nor about unmounting or detaching harddisks.

Any ideas?

Offline

#4 2012-10-10 19:45:23

p0x8
Member
Registered: 2012-09-20
Posts: 67

Re: [solved]USB-harddisk unmounted when network disconnected

There seems to be some sort of dependency between network availability and your media/NTFS mounts. Are you using systemd?

Offline

#5 2012-10-11 17:51:01

Acce
Member
Registered: 2010-04-23
Posts: 11

Re: [solved]USB-harddisk unmounted when network disconnected

Yes, I changed to systemd sometime ago with an upgrade, since I thought the old system was going to be unsupported eventually.

Frankly, I don't know how systemd is different, I still launch daemons from /etc/rc.d/ although I have seen some systemd examples where it is done differently..

Can I adjust the depencies somehow? or just stop it from unmounting other mounts than network mounts (which seems reasonable, considering network will be disconnected)?

Offline

#6 2012-10-11 19:40:29

p0x8
Member
Registered: 2012-09-20
Posts: 67

Re: [solved]USB-harddisk unmounted when network disconnected

Dependencies are declared in the unit files, but the udisks service doesn't seem to depend on the network.

The only other thing I can think of is that 'org.freedesktop.nm_dispatcher' service that is activated on network shutdown. It could be running some custom script. You could try and check the files (if any) in '/etc/NetworkManager/dispatcher.d/'.

Offline

#7 2012-10-11 22:00:13

Acce
Member
Registered: 2010-04-23
Posts: 11

Re: [solved]USB-harddisk unmounted when network disconnected

Thanks for pointing me to the right direction!

I did some experimenting and digging, and here are my findings:

in dispatcher.d/ there was config file 10-netfs, and it will stop netfs daemon whenever network disconnects.
Next, I looked into /etc/rc.d/netfs and found out it runs

umount -a -f -t "$NETFS"

when stopped.

Then, I found NETFS in /etc/rc.d/functions:

# Filesystem functions
# These can be overridden/reused for customizations like shutdown/loop-fsck.
NETFS="nfs,nfs4,smbfs,cifs,codafs,ncpfs,shfs,fuse,fuseblk,glusterfs,davfs,fuse.glusterfs"

I checked ntfs-3g unmounting, and found out that ntfs filesystems are unmounted with type fuseblk.

Which now leads to few questions before declaring the problem solved:

Is it safe to remove fuseblk from the list to prevent ntfs filesystems from being unmounted?
Is there a reason I should unmount ntfs filesystems when network disconnects?
Or is disconnecting the network not supposed to unmount ntfs disks?

Offline

#8 2012-10-11 23:37:30

p0x8
Member
Registered: 2012-09-20
Posts: 67

Re: [solved]USB-harddisk unmounted when network disconnected

Your findings raise interesting questions. The problem is that a FUSE mount can be almost anything, including a network file system. The script errs on the side of caution and unmounts everything, although it is an obviously wrong choice in your scenario (your devices are local disks formatted as NTFS). The script would have to be more intelligent/thorough in order to make better choices.

Now, is there a reason NTFS file systems should be unmounted when the network disconnects? No[1].
So is it safe to remove 'fuseblk' from the list? Should be, unless you're also mounting some network file system which also happens to be using that type identifier.


[1] Although, technically, you could create a convoluted scenario using a remote file as a block device containing a NTFS file system.

Offline

#9 2012-10-13 18:09:01

Acce
Member
Registered: 2010-04-23
Posts: 11

Re: [solved]USB-harddisk unmounted when network disconnected

Thank you again.

I removed the fuseblk from NETFS variable and the drives don't get unmounted anymore when network is disconnected.

So hypothetically speaking, if I had network filesystem mounted with FUSE, I might run into problems? At the moment I don't have though, and I don't know why I ever would. But for general compability, I think this issue should be somehow addressed. I don't have enough understanding of filesystems to make any suggestions though.

I think I will mark this solved for now, anyways.

Offline

Board footer

Powered by FluxBB