rbrito / usbmount

Simple set of scripts to automount removable devices for a Linux system
275 stars 86 forks source link

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

Closed Roaders closed 2 years ago

Roaders commented 2 years ago

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
derekatkins commented 2 years ago

I'm getting the same issue (Ubuntu 20.04 using the distributed version). But if I manually run "sudo mount..." (and copy the mount command from the log) it DOES mount. So the command is right.

I also see "FAT-fs (sda): Volume was not properly unmounted. Some data may be corrupt. Please run fsck." in the log, which I don't get when I run the mount manually.

I'm wondering if it's mounting and then unmounting? Or if there is some other mount error that isn't being logged?

jaccc commented 2 years ago

it is caused by systemd which is using private mount

derekatkins commented 2 years ago

it is caused by systemd which is using private mount

thanks, @jaccc -- is there a fix/workaround?

derekatkins commented 2 years ago

Strangely, even though the "mount" is being private, the /var/run/usbmount symlink gets created no problem...

derekatkins commented 2 years ago

Aha, looks like Issue #25 explains the issue and the fact that the "native" usbmount is STILL too old!

Roaders commented 2 years ago

Yes, I should have updated this. I did manage to get it working by cloning, building and installing the latest version from Github. I think that the issue I had initially was just that I had the wrong file system on the SD card.