Coder Social home page Coder Social logo

rbrito / usbmount Goto Github PK

View Code? Open in Web Editor NEW
269.0 20.0 86.0 99 KB

Simple set of scripts to automount removable devices for a Linux system

Shell 100.00%
daemon filesystem fuse-filesystem flash-drives mass-storage-device udev pendrive mount-options usbmount

usbmount's Introduction

USBmount

The USBmount package automatically mounts USB mass storage devices (e.g., USB pen drives or HDs in USB enclosures) when they are plugged in. The mountpoints (/media/usb[0-7] by default), filesystem types to consider, and mount options are configurable. When multiple devices are plugged in, the first available mountpoint is automatically selected.

If the device plugged provides a model name, a symbolic link at /var/run/usbmount/MODELNAME pointing to the mountpoint is automatically created. When the device is not present anymore in the system (e.g., after it has been unplugged), usbmount deletes the symbolic links that were created.

The script that does the (un)mounting is called by the udev daemon. Therefore, USBmount requires a 2.6 (or newer) kernel.

USBmount is intended as a lightweight solution which is independent of a desktop environment. Users which would like an icon to appear when an USB device is plugged in should use other alternatives.

The comments in the configuration file /etc/usbmount/usbmount.conf describe how to configure the package.

Generic Comments about Flash Drives

Users should be aware that, independently of the filesystem used by the mass storage device, ANY filesystem that resides in flash memory will become unreadable after some time. This unfortunate situation is intrinsic to the storage medium and better quality flash drives perform a "wear levelling" operation, distributing the load of operations across the whole device. [*]

Filesystems using flash memory and mounted with the sync option can degrade earlier due to the fact that the sync mount option forces the operating system to write data more frequently to the device than if it were mounted without the sync option.

So, why mount filesystems with the sync option then? The reason is to keep the written data on the drive reflecting what the user thinks is on the flash drive, and, more importantly, to avoid the problem of the user unplugging the device before it is finished receiving data that the kernel has on the memory of the computer and that is meant to be written to the device.

If you don't like the sync option with your filesystems, then you can remove it from the configuration file of usbmount and use your devices with better performance and longer life time. BUT you should always make sure that you use the sync command (on a shell) to ensure that there is no writes pending for the device in question, so that you don't loose any data when you unplug the device from the computer.

[*] You can see if your flash drives support wear levelling by seeing the technical specifications of your specific drives in the manufacturer's site (e.g., the manufacturer Kingston provides such information regarding its drives and others quite probably do that too).

Of course, usbmount doesn't only work with flash drives. Common hard drives put into enclosures are perfectly used with usbmount and usbmount, despite its name, can mount drives connected via Firewire ports, provided that the kernel has support for it (most distribution kernels, including the ones shipped with Debian and Ubuntu do).

Generic comments about package dependencies

This package depends on a few other packages for installation. These are properly declared in the built package and apt-get will install all required packages if the package is installed from a remote repository but dpkg doesn't install dependencies when the package is installed from a local file.

There are a few ways to deal with dependencies when installing files directly, ex:

Option 1: let apt-get fix missing dependencies.

# Try install, will not necessarily complete if you're missing a dependency
dpkg -i <package>.deb

# Will install missing dependencies and finish the install process
apt-get install -f

Option 2: use a package installer that fetches dependencies even for local packages (ex. gdebi).

# Only required the first time you do this with any package
apt-get install gdebi

# Actually install the package and it's dependencies
gdebi <package>.deb

Technical Considerations

Control of Filesystems Mounted by USBmount

You can choose which filesystems you want usbmount to automatically handle by listing the filesystem types provided by the operating system in the configuration variable FILESYSTEMS.

Recommendations for vfat Filesystems

The vfat filesystem is one of the most commonly used filesystems in pen drives. Unfortunately, due to its age, it is very poor regarding features and, in particular, it doesn't feature the most basic access control present in Unix systems, namely: permissions on files.

Linux works around this by creating "virtual" permissions and restrictions based on who mounted the filesystem. As usbmount is used, the user assigned to the vfat filesystem is, by default, root.

For a more flexible configuration, some useful options for vfat filesystems are to specify explicitly who the user and permissions are. Please, read the manpage of the mount command to get details.

An example is to specify -fstype=vfat,gid=floppy,dmask=0007,fmask=0117 in the FS_MOUNTOPTIONS variable of the configuration file. The particular options specified in the example mean that members of the floppy group can read from and write to the medium, but nobody else can access it.

Troubleshooting USBmount

No software is free of problems and the situation isn't different with USBmount. To ease the troubleshooting of problems, you may try to check the following:

  • Do you have HAL running? Any GNOME or KDE daemon automounting devices?

  • Let's suppose that the partition containing the filesystem that you want USBmount to automatically handle is /dev/sda1 (your case may, quite possibly, vary). Then, check the result of the following command:

      udevadm test --action=add /sys/class/block/sda1
    

    The command above just gives diagnostics of what USBmount would do with the device, but it doesn't actually mount or interfere with the device. It is intended for debugging purposes. Be careful that it generates a lot of output. Many screens, depending on the device.

  • Under the same assumptions as the above, another good diagnostic tool is the following:

      udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
    

Hook Scripts

After a device or partition has been mounted, the command run-parts /etc/usbmount/mount.d is executed. This runs all scripts in /etc/usbmount/mount.d which adhere to a certain naming convention; see the run-parts manual page for details.

The following environment variables are available to the scripts (in addition to those set in /etc/usbmount/usbmount.conf and by the hotplug and udev systems):

Variable Description
UM_DEVICE file name of the device node
UM_MOUNTPOINT mountpoint
UM_FILESYSTEM filesystem type
UM_MOUNTOPTIONS mount options that have been passed to the mount command
UM_VENDOR vendor of the device (empty if unknown)
UM_MODEL model name of the device (empty if unknown)

Likewise, the command run-parts /etc/usbmount/umount.d is executed after a device or partition has been unmounted. The scripts can make use of the environment variables UM_DEVICE, UM_MOUNTPOINT and UM_FILESYSTEM. Note that vendor and model name are no longer easily available when the device has been removed. If you need this information in an unmount hook script, write it to a file in a mount hook script and read it back in the unmount hook script.

Safely unmounting filesystems

As it is not possible for the system to detect when the device should be unmounted (such information is only present when the device has already been unplugged, which is too late for some clean ups, like flushing unwritten buffers to disk and marking the filesystem as clean), the user should manually unmount the device that were automatically mounted.

This situation is similar to those in graphical desktop environments where the user has to click on an icon and inform the system that it wants to remove the device from the computer.

A recommended solution for this problem is to use the pumount command (provided by the pmount package), which acts as a wrapper around the regular mount command and lets regular users (i.e., not root) to unmount the filesystems, conveniently.

Warning: carelessly removing the device/filesystem without unmounting it first can (and does) lead to massive filesystem corruption and should only be performed if you know exactly what you are doing.

The Special Case of FUSE Filesystems

Many users use removable drives with NTFS filesystems and the user-space filesystem NTFS-3g, since it provides more flexibility than the native module present in the Linux kernel.

Such users have difficulty when unmounting the filesystems, since they are present in the system /etc/mtab with a filesystem type of fuseblk, not with ntfs (or ntfs-3g) as one might expect.

For such filesystems, it may be convenient to:

  • add ntfs-3g to /etc/usbmount/usbmount.conf's variable FILESYSTEMS (for mounting purposes)
  • add fuseblk to /etc/usb/usbmount.conf's variable FILESYSTEMS (for unmounting purposes).

Similar comments may apply to other FUSE-managed filesystems. In general, if you need a FUSE filesystem, it may be a good idea to add the name of that filesystem to the FILESYSTEMS variable as well as making sure that the special fuseblk filesystem is contained in that list.

This subsection is an adaptation of descriptions made by Thomas Jancar and Jan Schulz.

Remounting filesystems without physical removal

usbmount operates (read: "mounts or unmounts filesystems") based on events issued by the Linux kernel/udev. As a consequence, if you happen to unmount a filesystem and want to mount it again, you have basically two choices:

  1. unplug and plug the device, which may not be desired, for a number of reasons.
  2. make the kernel/udev generate another event so that usbmount knows that it has some work to do.

The latter can be accomplished by the use of the command

udevadm trigger --action=add /dev/sdd2

where /dev/sdd2 should be substituted with the proper partition. This command is likely needed to be run with superuser privileges. Triggering kernel events is also a way to get a particular filesystem mounted after a cold boot.

Building the package

In order to build this package, debhelper and build-essential are required. The package can be built with the simple commands:

# Install dependencies
sudo apt-get update && sudo apt-get install -y debhelper build-essential

# Build
sudo dpkg-buildpackage -us -uc -b

usbmount's People

Contributors

martignoni avatar mathieulj avatar rbrito avatar rlaboiss avatar romainreignier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

usbmount's Issues

Struggling to run on Debian Buster

Compiled from source (0.24) and enabled verbose logging

Dec 8 14:39:38 octopi systemd[1]: Starting triggerhappy global hotkey daemon...
Dec 8 14:39:38 octopi systemd[1]: [email protected]: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 8 14:39:38 octopi systemd[1]: [email protected]: Failed with result 'exit-code'.
Dec 8 14:39:38 octopi systemd[1]: Failed to start [email protected].

Checked for dependencies (apt-get install -f)

installed as per notes in #25

Cannot chown target file on exFAT USB-drive

Hello.

I've installed usbmount 0.0.24 on Ubuntu Server v20.04.1 and added exfat to /etc/usbmount/usbmount.conf's variable FILESYSTEMS. USB Flash Drive with exFAT filesystem has been successfully mounted after plug-in, but when I copy files from server's HDD to USB Flash Drive in Midnight Commander I get the following error after each file Cannot chown target file "/media/usb/test.jpg" Operation not permitted (1). As I understand this is because exFAT doesn't support chown. Is it possible to turn off chown attempts for all drives that don't support it?

auto mount u disk file is locked

I use this project to auto mount my u-disk.It is successful but have problem in that my u-disk file is locked.And I unlock those file failure.and when i unmount the udisk, it need my Password to unmount u-disk. how i can solve it?

HDD/SSD not detected in Raspbian Lite OS in Raspberry pi 4

i am using Raspbian lite os with raspberry pi 4 ,i am using usbmount to munt usb but when i insert HDD/SSD it is detecting in lausb but it is not mounting it

is there way to mount HDD or SDD

this is config 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="vfat ext2 ext3 ext4 hfsplus ntfs"
  
  #############################################################################
  # 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=no

`

i have added ntfs at end
in
FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus ntfs"

Provide a tag for 0.0.24

Some Git issues talk about usbmount version 0.0.24.
I would like to have a Git tag for that version, so that I know I am building the same version on all systems.

Installed USBMOUNT on raspbian stretch in rpi3b+. Now I can't copy files from my phone to the mounted USB drives on pi using ssh via a file explorer

Installed USBMOUNT on raspbian stretch in rpi3b+. Now I can't copy files from my phone to the mounted USB drives on pi using ssh via a file explorer

Steps to replicate

  1. I have Kodi, retropie, Raspbian running on my pi with Kodi boots first.
  2. I installed USBMOUNT so that any USB connected get auto mount and also installed aria2 along with it. Aria2 download path is set to a folder in USB drive mounted.
  3. I am able to create a folder in USB driver using SSH via a file browser app in my phone.
  4. But when I try to copy a file from my phone to the mounted USB driver. The app throws error file can't be copied.(I used to copy files from my phone to the USB driver before installing USBMOUNT via SSH)
  5. I uninstalled the USBMOUNT and its related dependencies. The above mentioned behavior still exist.

Can someone please help me out on this :(.

Problem with exFAT filesystem

Dears,
I use your script for an automated display with possibility to update content from usb key.
With normal usb key it work fine but if i use exFAT usb key it doesn't work.
I try may possibilities with installation of packages ntfs-3g, fuseblk, etc... add options on usbmount.conf but it doesn't work.
Without additional packages i have error on mountpoint. It doesn't know exfat filesystem.
After installation of additional packages, nodify usbmount.conf file, it know that it's exFAT filesystem and mount it but he doesn't start personal scripts in mount.d folder. It doesn't unmount correctly usb key and cratch my raspberry.

Could you help me about it?

Thanks a lot for your work

Spin Down/ Standby option in config file

Hi,

I cannot find any option to spin down or standby the hard drive.
Do you know if there is an option or alternative that usbmount implements within his configuration file?

Best regards

run-parts not executing script

I have created an executable in /etc/usbmount/mound.d that runs normally as well as when I manually call run-parts myself, however the script does not execute automatically when I plug in a drive.

Dec 14 05:03:09 otterslave systemd[1]: Created slice system-usbmount.slice.
Dec 14 05:03:09 otterslave systemd[1]: Starting [email protected]...
Dec 14 05:03:09 otterslave systemd[1]: Starting [email protected]...
Dec 14 05:03:09 otterslave usbmount[2390]: dev/sdd does not contain a filesystem or disklabel
Dec 14 05:03:09 otterslave systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Dec 14 05:03:09 otterslave systemd[1]: [email protected]: Failed with result 'exit-code'.
Dec 14 05:03:09 otterslave systemd[1]: Failed to start [email protected].
Dec 14 05:03:14 otterslave usbmount[2420]: executing command: mount -texfat -ouser,umask=000,sync,noexec,nodev,noatime,nodiratime,gid=xbian,uid=xbian,umask=0 dev/sdd1 /media/usb0
Dec 14 05:03:14 otterslave usbmount[2420]: executing command: run-parts /etc/usbmount/mount.d
Dec 14 05:03:15 otterslave systemd[1]: Started [email protected].

using usbmount while also booting using usb.

Does the script ignore usb drives that you may use to boot your device ?

I am booting a raspberry pi using usb, but also have another mass storage connected.

will this script work in ignoring the usb stick that is used for boot ?

/dev/sda does not contain a filesystem or disklabel

Automatic mounting doesn't seem to work on Raspbian

$ lsb_release -a
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.9 (stretch)
Release:	9.9
Codename:	stretch

usbmount version: 0.0.24

When I plug in a device (vfat or HFS+) I get the following messages in the log:

May  9 17:32:47 apollo mtp-probe: checking bus 1, device 8: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2"
May  9 17:32:47 apollo mtp-probe: bus: 1, device: 8 was not an MTP device
May  9 17:32:49 apollo usbmount[854]: loaded usbmount configurations
May  9 17:32:49 apollo usbmount[854]: trying to acquire lock /var/run/usbmount/.mount.lock
May  9 17:32:49 apollo usbmount[854]: acquired lock /var/run/usbmount/.mount.lock
May  9 17:32:49 apollo usbmount[854]: /dev/sda does not contain a filesystem or disklabel

One line that concerns me is this:

/dev/sda does not contain a filesystem or disklabel

The filesystem or disklabel is searched in the output of blkid -p /dev/sda
This command however outputs the following:

/dev/sda: PTUUID="77ac1b2a-96b3-4cc0-8970-dfc7137c4ce0" PTTYPE="gpt"

To find what usbmount is looking for I would have to run blkid -p /dev/sda2 instead:

$ blkid -p /dev/sda2
/dev/sda2: UUID="2c3e1777-7df2-340d-a562-ec4b54377559" LABEL="HGST 512GB" TYPE="hfsplus" USAGE="filesystem" PART_ENTRY_SCHEME="gpt" PART_ENTRY_UUID="0dfcb8be-aab4-4892-876b-d62fc5bc8447" PART_ENTRY_TYPE="48465300-0000-11aa-aa11-00306543ecac" PART_ENTRY_NUMBER="2" PART_ENTRY_OFFSET="409640" PART_ENTRY_SIZE="976101344" PART_ENTRY_DISK="8:0"

How can I make usbmount look for the correct device?

Licensing

Hello @rbrito,

Thanks so much for developing this!
I was not able to find the license information for this library - would you please direct me to it or if it does not exist, create one?
Thanks!

Failed to add dependency on .device, ignoring: Invalid argument

From journalctl -xe

[/lib/systemd/system/usbmount.service:2] Failed to add dependency on .device, ignoring: Invalid argument
May 24 07:53:43 JukeBox systemd[1]: [/lib/systemd/system/usbmount.service:3] Failed to add dependency on .device, ignoring: Invalid argument
May 24 07:53:43 JukeBox systemd[1]: Starting usbmount.service...
-- Subject: Unit usbmount.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit usbmount.service has begun starting up.
May 24 07:53:43 JukeBox systemd[1]: usbmount.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 24 07:53:43 JukeBox systemd[1]: Failed to start usbmount.service.
-- Subject: Unit usbmount.service has faile


Debain stretch

Also, I built the package without issues, but when I install it none of the config files were installed. I had to copy all of them myself. This is the first time I have used this method so maybe I am doing something wrong?

UUID matching in /etc/fstab doesn't work

elif grep -q "^[[:blank:]]*UUID=\"?$UUID\"?" /etc/fstab; then

This change breaks UUID matching in /etc/fstab on Ubuntu 18.04.1 (and probably most other OS).

The problem is that it tries to match using "? but ? is not a basic regular expression (BRE) metacharacter. ? is an extended regular expression (ERE) metacharacter so grep needs the "-E" parameter as follows:

elif egrep -q "^[[:blank:]]*UUID=\"?$UUID\"?" /etc/fstab; then

It will now work.

EDIT: Changed "grep -E" to "egrep" to be consistent with the rest of the code.

mount command does not actually mount the drive on raspberry pi OS lite

I have setup a new raspberry pi lite OS specifically to test usbmount (so it's a brand new image downloaded today and there is very little else on the system). I am having quite a few issues getting usbmount to work.

Currently I have the latest version from apt-get (0.0.22) isntalled and I am the closest that I have been to getting usbmount to work. I currently get this output:

Apr 20 13:34:26 pi3testbench mtp-probe[668]: checking bus 1, device 4: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3"
Apr 20 13:34:26 pi3testbench mtp-probe[668]: bus: 1, device: 4 was not an MTP device
Apr 20 13:34:26 pi3testbench mtp-probe[671]: checking bus 1, device 4: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3"
Apr 20 13:34:26 pi3testbench mtp-probe[671]: bus: 1, device: 4 was not an MTP device
Apr 20 13:34:28 pi3testbench usbmount[676]: loaded usbmount configurations
Apr 20 13:34:28 pi3testbench usbmount[679]: creating /var/run/usbmount directory
Apr 20 13:34:28 pi3testbench usbmount[681]: trying to acquire lock /var/run/usbmount/.mount.lock
Apr 20 13:34:28 pi3testbench usbmount[684]: acquired lock /var/run/usbmount/.mount.lock
Apr 20 13:34:28 pi3testbench usbmount[703]: mountpoint /media/usb0 is available for /dev/sda
Apr 20 13:34:28 pi3testbench usbmount[704]: executing command: mount -tvfat -osync,noexec,nodev,noatime,nodiratime /dev/sda /media/usb0
Apr 20 13:34:28 pi3testbench usbmount[714]: executing command: run-parts /etc/usbmount/mount.d
Apr 20 13:34:28 pi3testbench usbmount[728]: usbmount execution finished

as you can see it runs the mount command - BUT the drive is not mounted. If I run the command myself (with sudo) then the drive is mounted fine. I am using the normal pi user. I am not sure what user usbmount uses.

I have also cloned the repo and built 0.0.24 locally and tried that. That does not work as well and doesn't run the mount command. I get:

Apr 20 13:30:17 pi3testbench mtp-probe[672]: checking bus 1, device 4: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3"
Apr 20 13:30:17 pi3testbench mtp-probe[672]: bus: 1, device: 4 was not an MTP device
Apr 20 13:30:17 pi3testbench mtp-probe[675]: checking bus 1, device 4: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3"
Apr 20 13:30:17 pi3testbench mtp-probe[675]: bus: 1, device: 4 was not an MTP device

copying to USB stick fails on raspbian stretch, permission denied

Hi there,
on a new installation of Raspbian usbmount does not work.
Also installed the newest version of usbmount via

sudo apt-get install debhelper
git clone https://github.com/rbrito/usbmount.git
cd usbmount
sudo dpkg-buildpackage -us -uc -b
cd ..
sudo apt install ./usbmount_0.0.24_all.deb
sudo reboot

Got a "cp: cannot create regular file '/media/usb/test.txt': Permission denied".

I edited /lib/systemd/system/systemd-udevd.service and changed MountFlags=shared, no success after reboot.

Any help?

sync mount option as default

By default usb disks are mounted with sync option. This can lead to very slow write speed (in my case almost 1000x slower then in async mode with 2.5" external USB disk). Async is also default for mount.

dpkg-buildpackage fails

README: "sudo dpkg-buildpackage -us -uc -b"
it fails. You depend on "lockfile-progs", right? ;-)

debian 12 udev system call restrictions

i see usbmount failing with exit code 32 on debian 12

i can fix it by removing the syscall restrictions for udevd, cannot say which needs to be enabled as systemd just errors them silently.

just in case someone has the same problem

Mount failed, reason unclear

Running usbmount on Ubuntu 18.04 on a Raspberry Pi 4:
$ uname -a
Linux hfpsrv-simu 5.4.0-1025-raspi #28~18.04.1-Ubuntu SMP PREEMPT Thu Dec 10 03:37:31 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

Fails to auto mount, see syslog:

Dec 21 09:53:47 hfpsrv-simu usbmount[1820]: /dev/sda2 contains filesystem type ext4
Dec 21 09:53:47 hfpsrv-simu usbmount[1820]: mountpoint /media/sandisk is available for /dev/sda2
Dec 21 09:53:47 hfpsrv-simu usbmount[1820]: executing command: mount -text4 /dev/sda2 /media/sandisk
Dec 21 09:53:47 hfpsrv-simu systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Dec 21 09:53:47 hfpsrv-simu systemd[1]: [email protected]: Failed with result 'exit-code'.
Dec 21 09:53:47 hfpsrv-simu systemd[1]: Failed to start [email protected].

$ sudo systemctl status [email protected]
โ— [email protected]
Loaded: loaded (/lib/systemd/system/[email protected]; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-12-21 09:53:47 UTC; 1h 23min ago
Process: 1820 ExecStart=/usr/share/usbmount/usbmount add (code=exited, status=1/FAILURE)
Main PID: 1820 (code=exited, status=1/FAILURE)

Dec 21 09:53:47 hfpsrv-simu systemd[1]: Starting [email protected]...
Dec 21 09:53:47 hfpsrv-simu usbmount[1833]: trying to acquire lock /var/run/usbmount/.mount.lock
Dec 21 09:53:47 hfpsrv-simu usbmount[1840]: acquired lock /var/run/usbmount/.mount.lock
Dec 21 09:53:47 hfpsrv-simu systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Dec 21 09:53:47 hfpsrv-simu systemd[1]: [email protected]: Failed with result 'exit-code'.
Dec 21 09:53:47 hfpsrv-simu systemd[1]: Failed to start [email protected].

Manually mounting works fine:
$ sudo mount -text4 /dev/sda2 /media/sandisk
$ df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda2 14G 256M 13G 2% /media/sandisk

Any ideas?

Noting that Raspbian Buster requires documentation update

I've noticed that the format of the /lib/systemd/system/systemd-udevd.service configuration file in Buster has changed from Stretch. The following adjustment is often required, at least for my setup to allow the pi user to be able to see the drive:

Stretch

MountFlags=shared # defaults to "slave"

Buster

PrivateMounts=no # defaults to "yes"

Plot twist

Unfortunately, if you perform a routine sudo apt-get update && sudo apt-get upgrade it will revert this file back to the default, rendering your USB automount seemingly inoperative.

Usbmount only mounting two partitions

Hi,

If I plug my usb harddrive, which has 3 ntfs partitions (sdd1, sdd2 and sdd4) on it in a usb port usbmount starts mounting. It mounts /dev/sdd1 and /dev/sdd2 or sometimes /dev/sdd1 and /dev/sdd4 and than stops.So it seems to only mount two partitions... Weird!
Have checked usbmount.conf and udev rules, but not found the problem.
I'm running debian squeeze (old 32 bit armel) on a device, which I cannot update the kernel on.
usbmount v.0.0.22, fuse and ntfs-3g are installed!
Any ideas ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.