Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] [SOLVED] Undesired Automount Of Plug-In Device.  (Read 2679 times)


  • Guest
[EN] [SOLVED] Undesired Automount Of Plug-In Device.
« on: 2014/01/15, 21:45:57 »
Running Siduction 13.2.0 LXDE AMD64.

Entries were manually added to /etc/fstab to enable mounting drives from a user shell:
Code: [Select]
prompt$ cat /etc/fstab
UUID=de57w35f-2695-4f67-b727-2f69b94f763c    /   ext4     defaults,relatime,errors=remount-ro   0    1   
UUID=34bc82c8-64b4-43ed-8386-1a678b77e87a   none   swap   sw   0    0   
UUID=326f56c5-27b9-4ae2-bad8-d814846bee9e    /home   ext4   defaults,relatime,errors=remount-ro   0    2   

## Added the following mount points for users, 1/14/14
/dev/sr0  /cd  iso9660  noauto,ro,users  0  0

/dev/fd0  /floppy  auto  noauto,rw,users  0  0

/dev/sdb1  /2hd  auto  rw,user,noauto  0  0

/dev/sdc1  /3hd  auto  rw,user,noauto  0  0

/dev/sdd1  /4hd  auto  rw,user,noauto  0  0

/dev/sde1  /5hd  auto  rw,user,noauto  0  0

Now, every time a USB dirve is plugged-in, it instantly automounts -- not the desired result.  What is worse is that the automounted plug-in drives are mounted as root, so one is forced to sudo or login as root just to unmount those drives.  Additionally, one is forced to sudo or login as root to write to such automounted drives.

Of course, all of these conditions are undesired, and disabling the automounting is the desired solution.

systemd-fstab-generator is generating entries for the /etc/fstab lines:
Code: [Select]
prompt$ ls /run/systemd/generator/
2hd.mount  4hd.mount  cd.mount  dev-disk-by\x2duuid-34b292c8\[snip]\x2d1a678b77e87a.device.wants/  floppy.mount  local-fs.target.requires/  multi-user.target.wants/
3hd.mount  5hd.mount  dev-disk-by\x2duuid-326f56b5\[snip]\x2dd814846bee9e.device.wants/  dev-disk-by\x2duuid-34b292c8\[snip]\x2d1a678b77e87a.swap           home.mount    -.mount  /systemd/generator/

Here is the content of one of those generated entries:
Code: [Select]
prompt$ cat /run/systemd/generator/4hd.mount
# Automatically generated by systemd-fstab-generator



Here is a list of unit files relating to "mount":
Code: [Select]
prompt# systemctl list-unit-files | grep -i mount
proc-sys-fs-binfmt_misc.automount      static 
dev-hugepages.mount                    static 
dev-mqueue.mount                       static 
proc-sys-fs-binfmt_misc.mount          static 
run-lock.mount                         static 
run-user.mount                         static 
sys-fs-fuse-connections.mount          static 
sys-kernel-config.mount                static 
sys-kernel-debug.mount                 static 
tmp.mount                              disabled
mountall-bootclean.service             masked 
mountall.service                       masked 
mountdevsubfs.service                  masked 
mountkernfs.service                    masked 
mountnfs-bootclean.service             masked 
mountnfs.service                       masked 
systemd-remount-fs.service             static 
umount.target                          static

I stopped two or three of these units that seemed appropriate, but to no avail -- plug-in drives still automounted as root.

Before I try every item on this list, I am just wondering if anyone is familiar with the problem and knows an easy solution.  Not sure if udisks is involved.

By the way, here is an OpenSUSE bug report on what appears to be the same problem:  http://lists.opensuse.org/opensuse-bugs/2013-03/msg02606.html

« Last Edit: 2014/01/18, 11:46:14 by tupp »

Offline sunrat

  • User
  • Posts: 406
Re: Undesired Automount Of Plug-In Device.
« Reply #1 on: 2014/01/16, 11:20:31 »
This problem has occurred many times at Debian User forums. fstab entries are created for USB devices that are plugged in during install.
The solution is to comment them out or remove from fstab. Then udev will handle them automatically when plugged in.
I guess it is a bug, but easily fixed.

Offline der_bud

  • User
  • Posts: 1.072
  • member
Re: Undesired Automount Of Plug-In Device.
« Reply #2 on: 2014/01/16, 23:31:24 »
On IRC today someone reported that the package "usbmount" was installed on a machine where this automounts occur. On another machine, up-to-date but without usbmount-package, he had not this behaviour. So you could try 'apt-get remove usbmount' and see if it helps.
Du lachst? Wieso lachst du? Das ist doch oft so, Leute lachen erst und dann sind sie tot.


  • Guest
Re: Undesired Automount Of Plug-In Device.
« Reply #3 on: 2014/01/17, 06:23:03 »

Thanks for the suggestion but that's not the solution I was seeking.  As mentioned in the OP, entries were manually created in /etc/fstab to facilitate quick and easy manual mounting from the shell.  So, any type of automounting is undesired, and auto-created /etc/fstab entries are undesired, as well.

Furthermore, as I recall, before I manually created the /etc/fstab entries, I was having to sudo or login as root to mount USB drives from the shell, with the default settings.


That did the trick!  Thanks! 

Usbmount was the main culprit.  I should not have sought a solution on such a lower level as systemd.

However, instead of removing the usbmount package, I simply disabled it by tweaking the appropriate entry in /etc/usbmount/usbmount.conf.  I changed "ENABLED=1" to "ENABLED=0."

I'll wait a week or two before completely purging the usbmount package, just in case of any unforeseen consequences with the lack of usbmount  (I haven't tried to mount anything via firewire nor via usb3).

Thank you again!