rbrito / usbmount

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

Noting that Raspbian Buster requires documentation update #25

Open OutsourcedGuru opened 5 years ago

OutsourcedGuru commented 5 years ago

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.

nicokaiser commented 4 years ago

Does this apply for the Raspbian version of usbmount (0.22) or the current one from GitHub (0.24)? When manually installing the current GitHub version it seems to work fine, I think this was fixed in 0.24.

OutsourcedGuru commented 4 years ago

I'm reasonably sure that this would have been from a combination of actions on Buster:

sudo apt-get install usbmount
sudo apt-get update
sudo apt-get upgrade

I'm not sure what you mean by "fixed"; the Debian interface with attributes has changed. (Or did you mean that the upgrade won't clobber the config file?)

nicokaiser commented 4 years ago

The version that is installed by apt-get install usbmount is quite old. I think with the current version (provided by this GitHub repository) it is not necessary to override the service settings. However the current version is a bit tricky to install, as there is no package in Debian yet.

OutsourcedGuru commented 4 years ago

I'll say that this is a very useful package when it's working especially for the Lite versions of the OS.

dezmob commented 4 years ago

Just facing the same problem, and then I discovered devmon witch works flawlessly. it's bundled with the udevil utility.

sudo apt install udevil

And then you can just type devmon to see it working.

It will mount usb drives under /media/USER/USB_LABEL automatically

pi@raspberrypi:~ $ devmon
device: [/dev/sda1]
    systeminternal: [0]
    usage:          [filesystem]
    type:           [vfat]
    label:          [UNTITLED]
    ismounted:      [0]
    nopolicy:       [0]
    hasmedia:       [1]
    opticaldisc:    []
    numaudiotracks: []
    blank:          []
    media:          []
    partition:      [1]
devmon: /usr/bin/udevil --mount /dev/sda1 --mount-options "noexec,nosuid,nodev,noatime"    # (UNTITLED)
Mounted /dev/sda1 at /media/pi/UNTITLED
thoschworks commented 4 years ago

Just facing the same problem, and then I discovered devmon witch works flawlessly. it's bundled with the udevil utility.

I think this is no solution for me because I use usbmount on a headless raspi (ssh-ing into it) and it seems that devmon has to be invoked on user-level via the gui-login (perhaps it could be integrated in the login-scripts of the shell, but nothing about this in the docs…).

But I think this thread will be off-topic...

dezmob commented 4 years ago

I just added this line in /etc/rc.local to start the daemon when the pi startup

( sleep 5 && sudo -u pi devmon ) &

nicokaiser commented 4 years ago

Could you try installing version 0.0.24? https://github.com/nicokaiser/usbmount/releases/download/0.0.24/usbmount_0.0.24_all.deb You can install it via dpkg -i usbmount_0.0.24_all.deb after downloading. This updates the Debian/Raspbian version (0.0.22) to the current GitHub master (0.0.24).

OutsourcedGuru commented 4 years ago

@nicokaiser Thanks, I'll apply this today.

Does this version revert back to the original configuration file syntax?

mkdir ~/tmpu && cd ~/tmpu
wget https://github.com/nicokaiser/usbmount/releases/download/0.0.24/usbmount_0.0.24_all.deb
sudo dpkg -i usbmount_0.0.24_all.deb
 (Reading database ... 67332 files and directories currently installed.)
 Preparing to unpack usbmount_0.0.24_all.deb ...
 Unpacking usbmount (0.0.24) over (0.0.22) ...
 Setting up usbmount (0.0.24) ...
cd ~ && rm -Rf ~/tmpu
nicokaiser commented 4 years ago

Does this version revert back to the original configuration file syntax?

I run this version without any modification in existing configuration files. So, yes, I think so.

torsoreaper commented 4 years ago

@dezmob Thank you so much for the udevil solution. This was very easy and worked first try for me.

cinderblock commented 4 years ago

Instead of editing the main .service file, why not use the "drop-in" config file option? https://www.freedesktop.org/software/systemd/man/systemd.unit.html

I suspect even that this "drop-in" file could be automatically installed by Usbmount.

Alternate ways of editting the "drop-in" file include sudo systemctl edit systemd-udevd.

File contents (on Buster) should be simply:

[Service]
PrivateMounts=no

These "drop-in" conf files don't get wiped on updates afaik.

nicokaiser commented 4 years ago

@cinderblock Did you try the version I linked above? It is the latest GitHub version (0.0.24), packaged for Debian (which only has 0.0.22), it should run without modifications or drop-ins.

cinderblock commented 4 years ago

@nicokaiser I did not install from GitHub and just used whatever version apt had, so likely 0.0.22. I'm curious about the systemd based solution! Looks like it will work better in many ways.

nicokaiser commented 4 years ago

I think (!) version 0.0.24 is way more systemd based than 0.0.22, so it may be worth a look.

cinderblock commented 4 years ago

Yes, looking forward to it. Unfortunately, I don't quite have the time to muck around with non-apt installation at this point.

hapklaar commented 4 years ago

I think (!) version 0.0.24 is way more systemd based than 0.0.22, so it may be worth a look.

Just came across this post because my SD card wouldn't automount anymore on my Octoprint/Raspbian Buster upgrade. Updated usbmount per your instructions to 0.0.24 and now it works again. Thanks!