usbmount — fails to automount

10,042

I was actually also interested in automatic USB mount on Ubuntu 18.04 for my "as good as newly installed" server.

I'm uncertain in which way you've installed USBmount or what version of it you're running, but I do know that a bug specific to USBmount has been fixed in the git (and there doesn't seem to be a 18.04 compatible version in apt.


If it's not a recent installation (maybe upgraded server from 16.04, where it did work or not from the github project page, I advise to backup your configuration and reinstall usbmount from the Github page.

The instructions for this can be found on the Github page, but my process was as following:

  • Backup and remove usbmount (in my case, I had a clean 18.04 install, so there was nothing to backup/remove)
  • git clone http://github.com/rbrito/usbmount.git
  • cd usbmount
  • sudo apt-get update && sudo apt-get install -y debhelper build-essential
  • sudo dpkg-buildpackage -us -uc -b
  • sudo dpkg -i usbmount_0.0.24_all.deb
  • ^ Fails because of unmet dependencies use:
  • sudo apt --fix-broken install

After that, I formatted a usbdrive using:

  • sudo mkfs.vfat -n 'name_for_your_pendrive' /dev/sdy1

And when re-inserting the USBdrive, it automatically mounted.


Note: I must also add that any issues are better reported under the Github project.

Note2: If you think this answer was helpful, please comment on how to reload the settings, since I'm strugling with that at the moment. EDIT: changes seem to go into effect directly...

Note3: Make sure your BIOS is not set to boot from USB over boot from harddrive, since if you leave the drive in, it may attempt to boot from it.

Note4: Please first test it with a well supported format, before going on to NTFS, exfat or hfsplus.

Share:
10,042

Related videos on Youtube

philipp
Author by

philipp

Updated on September 18, 2022

Comments

  • philipp
    philipp almost 2 years

    On ubuntu 18.04 LTS server installation I have installed usbmount, with this /etc/usbmount/usbmound.conf:

    ENABLED=1
    
    MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
                 /media/usb4 /media/usb5 /media/usb6 /media/usb7"
    
    
    FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus"
    
    MOUNTOPTIONS="noexec,nodev,noatime,nodiratime"
    
    FS_MOUNTOPTIONS="user,umask=000"
    
    VERBOSE=yes
    

    tail -f /var/logo/syslog to monitor logs when inserting:

    Sep 13 12:39:25 t1000 kernel: [   91.397874] usb 3-3: new high-speed USB device number 5 using xhci_hcd
    Sep 13 12:39:25 t1000 kernel: [   91.552295] usb 3-3: New USB device found, idVendor=0930, idProduct=6545
    Sep 13 12:39:25 t1000 kernel: [   91.552301] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Sep 13 12:39:25 t1000 kernel: [   91.552306] usb 3-3: Product: DataTraveler 2.0
    Sep 13 12:39:25 t1000 kernel: [   91.552310] usb 3-3: Manufacturer: Kingston
    Sep 13 12:39:25 t1000 kernel: [   91.552314] usb 3-3: SerialNumber: 00241D8CE554EEC0493870A3
    Sep 13 12:39:25 t1000 kernel: [   91.553108] usb-storage 3-3:1.0: USB Mass Storage device detected
    Sep 13 12:39:25 t1000 kernel: [   91.553881] scsi host6: usb-storage 3-3:1.0
    Sep 13 12:39:26 t1000 kernel: [   92.580791] scsi 6:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 4
    Sep 13 12:39:26 t1000 kernel: [   92.581301] sd 6:0:0:0: Attached scsi generic sg2 type 0
    Sep 13 12:39:28 t1000 kernel: [   94.125210] sd 6:0:0:0: [sdb] 15248832 512-byte logical blocks: (7.81 GB/7.27 GiB)
    Sep 13 12:39:28 t1000 kernel: [   94.125430] sd 6:0:0:0: [sdb] Write Protect is off
    Sep 13 12:39:28 t1000 kernel: [   94.125435] sd 6:0:0:0: [sdb] Mode Sense: 23 00 00 00
    Sep 13 12:39:28 t1000 kernel: [   94.125747] sd 6:0:0:0: [sdb] No Caching mode page found
    Sep 13 12:39:28 t1000 kernel: [   94.125758] sd 6:0:0:0: [sdb] Assuming drive cache: write through
    Sep 13 12:39:28 t1000 kernel: [   94.162446]  sdb: sdb1
    Sep 13 12:39:28 t1000 kernel: [   94.163703] sd 6:0:0:0: [sdb] Attached SCSI removable disk
    Sep 13 12:39:28 t1000 usbmount[1505]: loaded usbmount configurations
    Sep 13 12:39:28 t1000 usbmount[1505]: trying to acquire lock /var/run/usbmount/.mount.lock
    Sep 13 12:39:28 t1000 usbmount[1505]: acquired lock /var/run/usbmount/.mount.lock
    Sep 13 12:39:28 t1000 usbmount[1505]: /dev/sdb does not contain a filesystem or disklabel
    Sep 13 12:39:28 t1000 systemd-udevd[1498]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
    Sep 13 12:39:28 t1000 usbmount[1527]: loaded usbmount configurations
    Sep 13 12:39:28 t1000 usbmount[1527]: trying to acquire lock /var/run/usbmount/.mount.lock
    Sep 13 12:39:28 t1000 usbmount[1527]: acquired lock /var/run/usbmount/.mount.lock
    Sep 13 12:39:28 t1000 usbmount[1527]: /dev/sdb1 contains filesystem type ext4
    Sep 13 12:39:28 t1000 usbmount[1527]: mountpoint /media/usb0 is available for /dev/sdb1
    Sep 13 12:39:28 t1000 usbmount[1527]: executing command: mount -text4 -onoexec,nodev,noatime,nodiratime /dev/sdb1 /media/usb0
    Sep 13 12:39:29 t1000 kernel: [   94.933285] EXT4-fs (sdb1): recovery complete
    Sep 13 12:39:29 t1000 kernel: [   94.933293] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null)
    Sep 13 12:39:29 t1000 usbmount[1527]: executing command: run-parts /etc/usbmount/mount.d
    Sep 13 12:39:29 t1000 usbmount[1527]: usbmount execution finished
    

    So success, drive not mounted on usb0. If I than copy and past this command:

     mount -text4 -onoexec,nodev,noatime,nodiratime /dev/sdb1 /media/usb0
    

    from the log above, drive mounted and working.

    What's the catch here ??

  • philipp
    philipp over 5 years
    Thanks! The install was a usual apt install. Unfortunately the project/system in question is already shipped, so I cannot test your advice, but I will try to as soon as possible
  • Artur Czyżewski
    Artur Czyżewski over 5 years
    I can confirm that building package from source works for me on 18.04. The one installed via apt-get repository doesn't work.
  • Mikel
    Mikel about 4 years
    systemd-udev runs in a private filesystem namespace (sandbox), so, while it successfully mounts the drive, users can't see it. This answer has more details: unix.stackexchange.com/a/441588/3169