2

I have tried to configure usbmount to automatically mount ntfs (and other file systems, like vfat and hfsplus which all work as expected) devices. Here is my /etc/usbmount/usbmount.conf file:

# Configuration file for the usbmount package, which mounts removable
# storage devices when they are plugged in and unmounts them when they
# are removed.

# Change to zero to disable usbmount
ENABLED=1

# Mountpoints: These directories are eligible as mointpoints for
# removable storage devices.  A newly plugged in device is mounted on
# the first directory in this list that exists and on which nothing is
# mounted yet.
MOUNTPOINTS="/media/usb0 /media/usb1 /media/usb2 /media/usb3
             /media/usb4 /media/usb5 /media/usb6 /media/usb7"

# Filesystem types: removable storage devices are only mounted if they
# contain a filesystem type which is in this list.
FILESYSTEMS="exfat vfat ext2 ext3 ext4 hfsplus ntfs fuseblk ntfs-3g"

#############################################################################
# WARNING!                                                                  #
#                                                                           #
# The "sync" option may not be a good choice to use with flash drives, as   #
# it forces a greater amount of writing operating on the drive. This makes  #
# the writing speed considerably lower and also leads to a faster wear out  #
# of the disk.                                                              #
#                                                                           #
# If you omit it, don't forget to use the command "sync" to synchronize the #
# data on your disk before removing the drive or you may experience data    #
# loss.                                                                     #
#                                                                           #
# It is highly recommended that you use the pumount command (as a regular   #
# user) before unplugging the device. It makes calling the "sync" command   #
# and mounting with the sync option unnecessary---this is similar to other  #
# operating system's "safely disconnect the device" option.                 #
#############################################################################
# Mount options: Options passed to the mount command with the -o flag.
# See the warning above regarding removing "sync" from the options.
MOUNTOPTIONS="sync,noexec,nodev,noatime,nodiratime"

# Filesystem type specific mount options: This variable contains a space
# separated list of strings, each which the form "-fstype=TYPE,OPTIONS".
#
# If a filesystem with a type listed here is mounted, the corresponding
# options are appended to those specificed in the MOUNTOPTIONS variable.
#
# For example, "-fstype=vfat,gid=floppy,dmask=0007,fmask=0117" would add
# the options "gid=floppy,dmask=0007,fmask=0117" when a vfat filesystem
# is mounted.
FS_MOUNTOPTIONS=""

# If set to "yes", more information will be logged via the syslog
# facility.
VERBOSE=yes

However when plugging in a ntfs formatted thumb drive, the command ls -l /media ⛔️ gives the following error message:

ls: cannot access '/media/usb0': Transport endpoint is not connected
total 28
d????????? ? ?    ?       ?            ? usb0
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb1
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb2
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb3
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb4
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb5
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb6
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb7

Syslog:

cat /var/log/syslog | grep usbmount

Apr 24 15:41:35 raspberrypi usbmount[5298]: loaded usbmount configurations
Apr 24 15:41:35 raspberrypi usbmount[5298]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi usbmount[5298]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi usbmount[5298]: /dev/sda does not contain a filesystem or disklabel
Apr 24 15:41:35 raspberrypi systemd-udevd[5297]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:41:35 raspberrypi usbmount[5320]: loaded usbmount configurations
Apr 24 15:41:35 raspberrypi usbmount[5320]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi usbmount[5320]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi usbmount[5320]: /dev/sda1 contains filesystem type ntfs
Apr 24 15:41:35 raspberrypi usbmount[5320]: mountpoint /media/usb0 is available for /dev/sda1

// Logs the mount command that was executed
Apr 24 15:41:40 raspberrypi usbmount[5320]: executing command: mount -tntfs -osync,noexec,nodev,noatime,nodiratime /dev/sda1 /media/usb0

Apr 24 15:41:41 raspberrypi usbmount[5320]: executing command: run-parts /etc/usbmount/mount.d
Apr 24 15:41:41 raspberrypi usbmount[5320]: usbmount execution finished

Here's the part I don't understand. When executing the mount command manually in a terminal, everything works as expected!

sudo mount -tntfs -osync,noexec,nodev,noatime,nodiratime /dev/sda1 /media/usb0

ls -l /media

total 32
drwxrwxrwx 1 root root 4096 Apr 24 15:29 usb0
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb1
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb2
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb3
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb4
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb5
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb6
drwxr-xr-x 2 root root 4096 Apr 23 10:18 usb7

The error message in ls disappears and all files can be accessed.

Any ideas on how to make it work automatically? I have tried reading the source code of usbmount on Github, but have not found anything useful.

 Additional Requested Information

systemctl status systemd-udevd.service

● systemd-udevd.service - udev Kernel Device Manager
   Loaded: loaded (/lib/systemd/system/systemd-udevd.service; static; vendor preset: enabled)
   Active: active (running) since Wed 2019-04-24 15:24:01 BST; 1 day 18h ago
     Docs: man:systemd-udevd.service(8)
           man:udev(7)
 Main PID: 126 (systemd-udevd)
   Status: "Processing with 16 children at max"
   CGroup: /system.slice/systemd-udevd.service
           └─126 /lib/systemd/systemd-udevd

Apr 24 16:15:30 raspberrypi mtp-probe[6050]: checking bus 1, device 13: "/sys/devices/platform/soc/3
Apr 24 16:15:31 raspberrypi usbmount[6059]: loaded usbmount configurations
Apr 24 16:15:31 raspberrypi systemd-udevd[6056]: Process '/usr/share/usbmount/usbmount add' failed w
Apr 24 16:15:31 raspberrypi usbmount[6081]: loaded usbmount configurations
Apr 24 16:15:31 raspberrypi usbmount[6086]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 16:15:31 raspberrypi usbmount[6102]: /dev/sda1 contains filesystem type vfat
Apr 24 16:15:32 raspberrypi usbmount[6133]: usbmount execution finished
Apr 25 12:59:45 raspberrypi mtp-probe[7615]: checking bus 1, device 14: "/sys/devices/platform/soc/3
Apr 25 12:59:47 raspberrypi systemd-udevd[7620]: Process '/usr/share/usbmount/usbmount add' failed w
Apr 25 12:59:47 raspberrypi usbmount[7697]: usbmount execution finished

journalctl -u systemd-udevd.service

-- Logs begin at Thu 2016-11-03 17:16:42 GMT, end at Fri 2019-04-26 10:01:50 BST. --
Apr 24 15:24:01 raspberrypi systemd[1]: Starting udev Kernel Device Manager...
Apr 24 15:24:01 raspberrypi systemd[1]: Started udev Kernel Device Manager.
Apr 24 15:24:01 raspberrypi usbmount[189]: loaded usbmount configurations
Apr 24 15:24:02 raspberrypi usbmount[201]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 15:24:02 raspberrypi usbmount[204]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 15:24:02 raspberrypi systemd-udevd[149]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:24:07 raspberrypi ntfs-3g[258]: Version 2016.2.22AR.1 integrated FUSE 28
Apr 24 15:24:07 raspberrypi ntfs-3g[258]: Mounted /dev/sda1 (Read-Write, label "ntfs test", NTFS 3.1)
Apr 24 15:24:07 raspberrypi ntfs-3g[258]: Cmdline options: rw,sync,noexec,nodev,noatime,nodiratime
Apr 24 15:24:07 raspberrypi ntfs-3g[258]: Mount options: rw,sync,noexec,nodev,nodiratime,allow_other,nonempty,noatime,fsname=/dev/sda1,blkdev,blksize=4096
Apr 24 15:24:07 raspberrypi ntfs-3g[258]: Ownership and permissions disabled, configuration type 7
Apr 24 15:24:08 raspberrypi mtp-probe[301]: checking bus 1, device 3: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1"
Apr 24 15:24:08 raspberrypi mtp-probe[302]: checking bus 1, device 4: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 15:24:08 raspberrypi mtp-probe[301]: bus: 1, device: 3 was not an MTP device
Apr 24 15:24:09 raspberrypi systemd-udevd[148]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:24:14 raspberrypi systemd-udevd[148]: Process '/usr/share/usbmount/usbmount add' failed with exit code 16.
Apr 24 15:25:02 raspberrypi mtp-probe[816]: checking bus 1, device 5: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 15:25:03 raspberrypi usbmount[830]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 15:25:03 raspberrypi usbmount[833]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 15:25:03 raspberrypi systemd-udevd[825]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:25:06 raspberrypi systemd-udevd[824]: spawned process '/usr/share/usbmount/usbmount add' [848] is taking longer than 49 years 3 months ago to complete
Apr 24 15:25:09 raspberrypi usbmount[891]: executing command: mount -thfsplus -osync,noexec,nodev,noatime,nodiratime /dev/sda1 /media/usb0
Apr 24 15:25:12 raspberrypi usbmount[957]: loaded usbmount configurations
Apr 24 15:25:12 raspberrypi usbmount[959]: usbmount execution finished
Apr 24 15:25:19 raspberrypi mtp-probe[985]: checking bus 1, device 6: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 15:25:20 raspberrypi usbmount[1005]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 15:25:20 raspberrypi systemd-udevd[997]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:25:26 raspberrypi usbmount[1063]: executing command: mount -tntfs -osync,noexec,nodev,noatime,nodiratime /dev/sda1 /media/usb0
Apr 24 15:25:26 raspberrypi ntfs-3g[1066]: Version 2016.2.22AR.1 integrated FUSE 28
Apr 24 15:25:26 raspberrypi ntfs-3g[1066]: Mounted /dev/sda1 (Read-Write, label "ntfs test", NTFS 3.1)
Apr 24 15:25:26 raspberrypi ntfs-3g[1066]: Cmdline options: rw,sync,noexec,nodev,noatime,nodiratime
Apr 24 15:25:26 raspberrypi ntfs-3g[1066]: Mount options: rw,sync,noexec,nodev,nodiratime,allow_other,nonempty,noatime,fsname=/dev/sda1,blkdev,blksize=4096
Apr 24 15:25:26 raspberrypi ntfs-3g[1066]: Ownership and permissions disabled, configuration type 7
Apr 24 15:25:33 raspberrypi systemd-udevd[1119]: inotify_add_watch(9, /dev/sda, 10) failed: No such file or directory
Apr 24 15:26:03 raspberrypi systemd-udevd[2527]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:26:08 raspberrypi ntfs-3g[3071]: Version 2016.2.22AR.1 integrated FUSE 28
Apr 24 15:26:08 raspberrypi ntfs-3g[3071]: Mounted /dev/sda1 (Read-Write, label "ntfs test", NTFS 3.1)
Apr 24 15:26:08 raspberrypi ntfs-3g[3071]: Cmdline options: rw,sync,noexec,nodev,noatime,nodiratime
Apr 24 15:26:08 raspberrypi ntfs-3g[3071]: Mount options: rw,sync,noexec,nodev,nodiratime,allow_other,nonempty,noatime,fsname=/dev/sda1,blkdev,blksize=4096
Apr 24 15:26:08 raspberrypi ntfs-3g[3071]: Ownership and permissions disabled, configuration type 7
Apr 24 15:26:24 raspberrypi usbmount[3303]: loaded usbmount configurations
Apr 24 15:26:24 raspberrypi usbmount[3305]: usbmount execution finished
Apr 24 15:30:43 raspberrypi mtp-probe[3358]: checking bus 1, device 8: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 15:30:45 raspberrypi systemd-udevd[3362]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:30:50 raspberrypi ntfs-3g[3434]: Version 2016.2.22AR.1 integrated FUSE 28
Apr 24 15:30:50 raspberrypi ntfs-3g[3434]: Mounted /dev/sda1 (Read-Write, label "", NTFS 3.1)
Apr 24 15:30:50 raspberrypi ntfs-3g[3434]: Cmdline options: rw,sync,noexec,nodev,noatime,nodiratime
Apr 24 15:30:50 raspberrypi ntfs-3g[3434]: Mount options: rw,sync,noexec,nodev,nodiratime,allow_other,nonempty,noatime,fsname=/dev/sda1,blkdev,blksize=4096
Apr 24 15:30:50 raspberrypi ntfs-3g[3434]: Ownership and permissions disabled, configuration type 7
Apr 24 15:41:29 raspberrypi usbmount[5267]: loaded usbmount configurations
Apr 24 15:41:34 raspberrypi mtp-probe[5292]: checking bus 1, device 9: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 15:41:35 raspberrypi usbmount[5302]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi systemd-udevd[5297]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 15:41:35 raspberrypi usbmount[5324]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi usbmount[5327]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 15:41:35 raspberrypi usbmount[5346]: mountpoint /media/usb0 is available for /dev/sda1
Apr 24 15:41:41 raspberrypi ntfs-3g[5351]: Version 2016.2.22AR.1 integrated FUSE 28
Apr 24 15:41:41 raspberrypi ntfs-3g[5351]: Mounted /dev/sda1 (Read-Write, label "", NTFS 3.1)
Apr 24 15:41:41 raspberrypi ntfs-3g[5351]: Cmdline options: rw,sync,noexec,nodev,noatime,nodiratime
Apr 24 15:41:41 raspberrypi ntfs-3g[5351]: Mount options: rw,sync,noexec,nodev,nodiratime,allow_other,nonempty,noatime,fsname=/dev/sda1,blkdev,blksize=4096
Apr 24 15:41:41 raspberrypi ntfs-3g[5351]: Ownership and permissions disabled, configuration type 7
Apr 24 16:10:37 raspberrypi mtp-probe[5460]: checking bus 1, device 10: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Apr 24 16:10:39 raspberrypi usbmount[5469]: loaded usbmount configurations
Apr 24 16:10:39 raspberrypi systemd-udevd[5466]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 16:10:39 raspberrypi usbmount[5516]: mountpoint /media/usb1 is available for /dev/sdb1
Apr 24 16:10:44 raspberrypi usbmount[5528]: executing command: run-parts /etc/usbmount/mount.d
Apr 24 16:13:21 raspberrypi usbmount[5714]: loaded usbmount configurations
Apr 24 16:13:21 raspberrypi usbmount[5715]: executing command: umount -l /media/usb0
Apr 24 16:13:22 raspberrypi usbmount[5736]: usbmount execution finished
Apr 24 16:13:27 raspberrypi usbmount[5745]: executing command: umount -l /media/usb1
Apr 24 16:13:27 raspberrypi usbmount[5747]: executing command: run-parts /etc/usbmount/umount.d
Apr 24 16:13:33 raspberrypi mtp-probe[5769]: checking bus 1, device 11: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 16:13:35 raspberrypi usbmount[5784]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 16:13:35 raspberrypi systemd-udevd[5776]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 16:13:35 raspberrypi usbmount[5803]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 16:13:35 raspberrypi usbmount[5806]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 16:13:40 raspberrypi usbmount[5837]: executing command: run-parts /etc/usbmount/mount.d
Apr 24 16:13:45 raspberrypi mtp-probe[5860]: checking bus 1, device 12: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Apr 24 16:13:46 raspberrypi usbmount[5870]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 24 16:13:46 raspberrypi usbmount[5873]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 16:13:46 raspberrypi systemd-udevd[5865]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 16:14:52 raspberrypi usbmount[5971]: executing command: umount -l /media/usb0
Apr 24 16:15:26 raspberrypi usbmount[6031]: executing command: run-parts /etc/usbmount/umount.d
Apr 24 16:15:26 raspberrypi usbmount[6043]: loaded usbmount configurations
Apr 24 16:15:30 raspberrypi mtp-probe[6050]: checking bus 1, device 13: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4"
Apr 24 16:15:31 raspberrypi usbmount[6059]: loaded usbmount configurations
Apr 24 16:15:31 raspberrypi systemd-udevd[6056]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 24 16:15:31 raspberrypi usbmount[6081]: loaded usbmount configurations
Apr 24 16:15:31 raspberrypi usbmount[6086]: acquired lock /var/run/usbmount/.mount.lock
Apr 24 16:15:31 raspberrypi usbmount[6102]: /dev/sda1 contains filesystem type vfat
Apr 24 16:15:32 raspberrypi usbmount[6133]: usbmount execution finished
Apr 25 12:59:45 raspberrypi mtp-probe[7615]: checking bus 1, device 14: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Apr 25 12:59:47 raspberrypi systemd-udevd[7620]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1.
Apr 25 12:59:47 raspberrypi usbmount[7697]: usbmount execution finished
2
  • I'm not sure but maybe this command give some more information: systemctl status systemd-udevd.service. Can you please add the output to your question?
    – Ingo
    Commented Apr 25, 2019 at 8:18
  • @Ingo Sorry for the late response. I added the output to your command, thanks.
    – dislick
    Commented Apr 26, 2019 at 9:05

1 Answer 1

1

There are many messages:

systemd-udevd[149]: Process '/usr/share/usbmount/usbmount add' failed with exit code 1

complained by systemd-udevd that tries to start usbmount add but fails. But systemd-udevd itself does not change to fail state because of this. This seems to be the reason why you get the message "Transport endpoint is not connected" because the background process usbmount has failed.

if you can mount the storage manually in a terminal using the mount command then this is as expected because usbmount is not used.

So there seems to be something wrong with your usbmount setup. I don't have it installed but I assume it has a man page. Have a look at it if you can execute usbmount add from the command line with a debug option to get more detailed information what's going wrong.

You are using driver type ntfs to mount the storage. Afaik this can only be used read only. The normal driver type for read/write access is ntfs-3g? You may have a look on this issue.

A more sophisticated debug output about usbmount you can get with the command:

rpi ~$ udevadm test --action=add /sys/class/block/usb0   # or what your device is

For more details about this look at Readme USBmount.

2
  • The issue keeps remaining even after reboot. Commented Apr 10, 2020 at 14:53
  • @AlexanderPravdin What do you mean? It's a long time ago, I answered the question.
    – Ingo
    Commented Apr 10, 2020 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.