3

As the title suggests, I am having issues on the new raspberry pi 4 with buster and USBMOUNT. Well, it's not working. At 3b+ there was a similar issue, you had to edit a file and change MountFlags from slave to shared. Well there isn't a MountFlags setting in the systemd-udevd.service file, but no matter what, I added it but still not working. Any ideas or an alternative to usbmount for a headless setup, keeping in mind that not always the usb stick is mounted and ofcourse it's not always the same stick with the same label all the time.

My dmesg:

I plug the stick somewhere here
[   41.511528] usb 1-1.2: new high-speed USB device number 8 using xhci_hcd
[   41.647482] usb 1-1.2: New USB device found, idVendor=26bd, idProduct=9917, bcdDevice= 1.00
[   41.647497] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   41.647509] usb 1-1.2: Product: SecureLock
[   41.647521] usb 1-1.2: Manufacturer:
[   41.647532] usb 1-1.2: SerialNumber: 0700413066DDE445
[   41.649386] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[   41.661890] scsi host0: usb-storage 1-1.2:1.0
[   42.733384] scsi 0:0:0:0: Direct-Access              SecureLock       PMAP PQ: 0 ANSI: 4
[   42.734206] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   43.843400] sd 0:0:0:0: [sda] 15124992 512-byte logical blocks: (7.74 GB/7.21 GiB)
[   43.843621] sd 0:0:0:0: [sda] Write Protect is off
[   43.843636] sd 0:0:0:0: [sda] Mode Sense: 23 00 00 00
[   43.843866] sd 0:0:0:0: [sda] No Caching mode page found
[   43.843879] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   43.866878]  sda: sda1

and my df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.0G  1.4G  1.5G  48% /
devtmpfs        334M     0  334M   0% /dev
tmpfs           463M     0  463M   0% /dev/shm
tmpfs           463M  6.3M  457M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           463M     0  463M   0% /sys/fs/cgroup
tmpfs           100M  8.0K  100M   1% /var/log
tmpfs            30M     0   30M   0% /var/tmp
tmpfs           100M  4.0K  100M   1% /tmp
tmpfs            20M  956K   20M   5% /run/samba
tmpfs            20M  1.3M   19M   7% /var/cache/samba
tmpfs            30M     0   30M   0% /tmp/mqueue
/dev/mmcblk0p1  253M   40M  213M  16% /boot
/dev/mmcblk0p3  438M  4.6M  406M   2% /home
tmpfs            93M     0   93M   0% /run/user/0

Finally, my fdisk -l

Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk0p1         8192  532480  524289  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2       540672 6832127 6291456    3G 83 Linux
/dev/mmcblk0p3      6832128 7774207  942080  460M 83 Linux


Disk /dev/sda: 7.2 GiB, 7743995904 bytes, 15124992 sectors
Disk model: SecureLock
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7fb5e9d8

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8064 15124991 15116928  7.2G  c W95 FAT32 (LBA)

This setup is working on a raspberry pi 2, pi 3b (jessie), pi 3b+ (stretch)

4

I faced the same issue with Raspberry Pi 4 and Raspbian Buster, the solution for me was to modify the following file:

/lib/systemd/system/systemd-udevd.service

Before: PrivateMounts=yes

After: PrivateMounts=no

Then I rebooted and it was OK ;)

  • I do not understand this. What does Before and After mean? Before setting private file system (mount) namespace (PrivateMounts=yes: man systemd.exec)? As far as I understand this option is not an event you can trigger Before. Before and After are options for the [Unit] section. In what section do you set these options? In the [Service] section? – Ingo Jul 7 at 9:06
  • Thanks a lot mate. – papatrexas Jul 8 at 7:52
  • @Ingo Sorry if my wording was not so clear, I was just meaning before and after the modification, in other words you just have to change "yes" to "no" for this "PrivateMounts" parameter in the "[Service]" section. – Greg Jul 8 at 10:32
  • Ah.. Ok. Can you that please add to your answer to clarify? – Ingo Jul 8 at 11:00
2

Please use Greg's solution. I don't know if mods wish to remove this

SO.... I am currently using pmount. Removed USBMOUNT and installed it using the instructions here: https://raspberrypi.stackexchange.com/a/66324/68240 "thanks to the original author btw"

The only extra was that I had to

sudo chmod +x /usr/local/bin/cpmount

Since it was not working at the beginning and before the chmod, I created the mounting folders my self. So I am not sure if you actually need to do that. I also edited the script and changed the folder numbering and finally I removed the --sync setting.

Hope this helps someone, it looks like USBMOUNT is not being developed any more.

Oh oh forgot to mention. I did this before creating the script and right after I installed pmount, so I again I am not sure if it is actually required. Should be though.

sudo pico /etc/pmount.allow

and add there the devices you allow pmount to use /dev/sda1 /dev/sda2 and so on...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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