Raspberry Pi Asked by papatrexas on December 12, 2021
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)
I'm using a Raspberry Pi 4 headless with Raspberry Pi OS lite (Debian 10.7). I didn't try too hard making usbmount work, but this alternative works well:
sudo apt install udevil
sudo nano /etc/systemd/system/devmon.service
and write the following:[Unit]
Description=Automounting usb drives.
After=network.target
[Service]
Type=simple
User=pi
Restart=on-abort
ExecStart=/usr/bin/devmon
[Install]
WantedBy=multi-user.target
sudo systemctl enable devmon.service
sudo systemctl start devmon.service
You can now plug in your USB thumb drive and check that it is mounted using lsblk
(it should be mounted in /media/pi/)
Answered by Benjamin on December 12, 2021
I have a Raspberry Pi 4, running Buster, and I successfully installed usbmount following the instructions at ...
https://www.linuxuprising.com/2019/04/automatically-mount-usb-drives-on.html
which in summary says:
sudo apt install git
git clone https://github.com/rbrito/usbmount
sudo apt install debhelper build-essential
cd usbmount
dpkg-buildpackage -us -uc -b
The only change I made was after all those commands and BEFORE installing the .deb file I did this:
sudo apt install lockfile-progs
and then installed like this
cd .. # back to where you were
sudo dpkg -i usbmount_0.0.24_all.deb
Answered by Andrew Kay on December 12, 2021
Because Raspbian is based on Debian, I suggest you to create a permanent system-specific configuration file according to the definitions as given in Debian's policies (see https://www.debian.org/doc/debian-policy/ch-files.html#configuration-files).
Buster has a solid configuration for systemd and udev placed in the package's library files at /lib/systemd/system/systemd-udevd.service
. But as opposed to Greg's anwser this is not the place to change the configuration. It's very likely, that the changes you did, will be silently overwritten by an upgrade of the system's packages done by the packet manager. Only files in /etc/systemd/system
are meant to be a system-specific configuration change done by an operator and not by a package (for further explanation see https://unix.stackexchange.com/a/458252/85199).
Therefor if you want to make usbmount work again, the already given configuration syntax is right. But you should place it like this.
Create a configuration container directory /etc/systemd/system/systemd-udevd.service.d
.
sudo mkdir /etc/systemd/system/systemd-udevd.service.d
Create an own confugration file (that will overwrite the package configuration). Change 00-my-custom-mountflags as you wish.
sudo nano -w /etc/systemd/system/systemd-udevd.service.d/00-my-custom-mountflags.conf
Enter the following configuration, which disables private mounts.
[Service]
PrivateMounts=no
Restart systemd and udev subprocesses (or simply reboot).
sudo systemctl daemon-reexec
sudo service systemd-udevd restart
This way usbmount will work again like expected, your configuration file is persisted and not silently replaced by an apt upgrade
.
I've done it this way for Pi 4 B with Raspbian Buster and can confirm that it works.
Answered by Pewpew on December 12, 2021
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 ;)
Answered by Greg on December 12, 2021
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...
Answered by papatrexas on December 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP