RaspberryPi won't automount USB memory stick

Greetings, all. I have an embedded system that uses a Raspberry Pi 3. I have it set up and running with the latest Raspbian and all is well, almost. For some reason the Raspbian system is not set up to automount memory sticks when they are inserted in to a USB port on the machine. On another embedded system I needed to install the usbmount package to get the system to automount a memory stick when it is inserted. I have installed usbmount on the RPi but it still won't automount a USB memory stick. The output from dmesg reports that it is seeing the insertion of the USB memory device. The device is also reported under lsusb. Why is Raspbian not set up to automount a memory stick like is done on a normal Linux based desktop? My desktop does it and I don't have an usbmount package installed. How do I configure Raspbian to automount a memory stick? -- Cheers! Kevin. http://www.ve3syb.ca/ | "Nerds make the shiny things that https://www.patreon.com/KevinCozens | distract the mouth-breathers, and | that's why we're powerful" Owner of Elecraft K2 #2172 | #include <disclaimer/favourite> | --Chris Hardwick

On 1/14/22 23:24, Kevin Cozens via talk wrote:
Greetings, all.
I have an embedded system that uses a Raspberry Pi 3. I have it set up and running with the latest Raspbian and all is well, almost. For some reason the Raspbian system is not set up to automount memory sticks when they are inserted in to a USB port on the machine.
On another embedded system I needed to install the usbmount package to get the system to automount a memory stick when it is inserted. I have installed usbmount on the RPi but it still won't automount a USB memory stick. The output from dmesg reports that it is seeing the insertion of the USB memory device. The device is also reported under lsusb.
Why is Raspbian not set up to automount a memory stick like is done on a normal Linux based desktop? My desktop does it and I don't have an usbmount package installed. How do I configure Raspbian to automount a memory stick?
Normally it's something with systemd or udev rule flags. I had to google it as I'm not aware of all the rules. See if this works: Make sure it works by changing MountFlags=slave to MountFlags=shared here: sudo nano /lib/systemd/system/systemd-udevd.service Not sure this helps, Nick

On 1/14/22 23:24, Kevin Cozens via talk wrote:
Greetings, all.
I have an embedded system that uses a Raspberry Pi 3. I have it set up and running with the latest Raspbian and all is well, almost. For some reason the Raspbian system is not set up to automount memory sticks when they are inserted in to a USB port on the machine.
On another embedded system I needed to install the usbmount package to get the system to automount a memory stick when it is inserted. I have installed usbmount on the RPi but it still won't automount a USB memory stick. The output from dmesg reports that it is seeing the insertion of the USB memory device. The device is also reported under lsusb.
Why is Raspbian not set up to automount a memory stick like is done on a normal Linux based desktop? My desktop does it and I don't have an usbmount package installed. How do I configure Raspbian to automount a memory stick?
Normally it's something with systemd or udev rule flags. I had to google it as I'm not aware of all the rules. See if this works:
Make sure it works by changing MountFlags=slave to MountFlags=shared here:
sudo nano /lib/systemd/system/systemd-udevd.service
Not sure this helps, Nick
On a headless web server here, up-to-date Raspbian, dmesg shows that plugging in a USB flash drive creates a device /dev/sda and /dev/sda1 . These devices disappear when the flash drive is unplugged. The SD chip serving as the 'hard-drive' is present as /dev/mmcblk0 . In Raspbian with the full GUI, something in the GUI catches a plugged-in flash drive and mounts it under /media/username . I don't know how. udev?

On 1/15/22 10:36, mwilson--- via talk wrote:
On 1/14/22 23:24, Kevin Cozens via talk wrote:
Greetings, all.
I have an embedded system that uses a Raspberry Pi 3. I have it set up and running with the latest Raspbian and all is well, almost. For some reason the Raspbian system is not set up to automount memory sticks when they are inserted in to a USB port on the machine.
On another embedded system I needed to install the usbmount package to get the system to automount a memory stick when it is inserted. I have installed usbmount on the RPi but it still won't automount a USB memory stick. The output from dmesg reports that it is seeing the insertion of the USB memory device. The device is also reported under lsusb.
Why is Raspbian not set up to automount a memory stick like is done on a normal Linux based desktop? My desktop does it and I don't have an usbmount package installed. How do I configure Raspbian to automount a memory stick?
Normally it's something with systemd or udev rule flags. I had to google it as I'm not aware of all the rules. See if this works:
Make sure it works by changing MountFlags=slave to MountFlags=shared here:
sudo nano /lib/systemd/system/systemd-udevd.service
Not sure this helps, Nick
On a headless web server here, up-to-date Raspbian, dmesg shows that plugging in a USB flash drive creates a device /dev/sda and /dev/sda1 . These devices disappear when the flash drive is unplugged.
The SD chip serving as the 'hard-drive' is present as /dev/mmcblk0 .
In Raspbian with the full GUI, something in the GUI catches a plugged-in flash drive and mounts it under /media/username . I don't know how. udev?
That is correct it's udev or the part of systemd that does it. I mentioned it my previous email but your package should work. The problem is the flag in /lib/systemd/system/systemd-udevd.service. Seems this needs to be MountFlags=shared instead of slave. I would check to see if MountFlags in that file is set correctly first. Nick
--- Post to this mailing list talk@gtalug.org Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk

On 2022-01-15 2:04 a.m., Nicholas Krause wrote:
On 1/14/22 23:24, Kevin Cozens via talk wrote:
Why is Raspbian not set up to automount a memory stick like is done on a normal Linux based desktop?
Normally it's something with systemd or udev rule flags. [snip] Make sure it works by changing MountFlags=slave to MountFlags=shared here:
sudo nano /lib/systemd/system/systemd-udevd.service
Thank you Nick. That seems to have fixed it. I tried some Internet searches but never saw any reference to that file or that setting. I tried reading the information about it once I knew what to look for but didn't understand some of the information about the MountFlags option. I have never run across any mention of drive mounts having a namespace. That is something I associate with code. The odd thing is my Linux based system with its graphical desktop has the setting set to slave but it does automount memory sticks. As someone else mention running headless seems to make a difference. I'm running a system that uses Raspbian Lite because the embedded system has limited memory and it is used in a situation where it is enclosed in a box so there is no need for a graphical desktop. -- Cheers! Kevin. http://www.ve3syb.ca/ | "Nerds make the shiny things that https://www.patreon.com/KevinCozens | distract the mouth-breathers, and | that's why we're powerful" Owner of Elecraft K2 #2172 | #include <disclaimer/favourite> | --Chris Hardwick

On Sun, 16 Jan 2022 at 23:55, Stewart C. Russell via talk <talk@gtalug.org> wrote:
On 2022-01-14 23:24, Kevin Cozens via talk wrote:
Why is Raspbian not set up to automount a memory stick
Raspberry Pi OS Lite (no desktop) doesn't automount USB devices. Raspberry Pi OS with Desktop does.
As a follow-up to Stewart's message - automounting is, I think, pretty much exclusively the realm of GUIs. It's handled by a GNOME package or a KDE package or the PCManFM package which handles the desktop for LXQt. Automounting isn't usually desirable in non-GUI environments - because of the assumption that they're server-like environments. I don't like automount even in a GUI environment - but usually manage to avoid it by going old-school on my Window Manager. I still run OpenBox or LXQt. The latter _does_ automount stuff, but if you dig into its config files there's a toggle to turn the behaviour off. All of which doesn't answer your question - although it does perhaps offer an indirect solution. Install a desktop environment (as opposed to a "window manager") if you don't have one (this may not be desirable). You haven't said if you have one - although I'm guessing that Stewart thought "embedded system" meant "Pi OS Lite" and thus no automount. I believe there is a non-GUI, background utility program somewhere out there that does automounting. You may have already found it in the form of the "usbmount" package but perhaps there's a setting you need to tweak. Although ... searching the Raspberry Pi OS package repos, I don't see a package called just "usbmount" so I'm not sure what that fix might be. This is very old: https://unix.stackexchange.com/questions/11472/automount-usb-drives-with-no-... but may be worth a look for the udev rules, which probably haven't changed, and because the second answer has a pointer to Archwiki about automounting USB. I consider Archwiki to be pretty much the single best source of documentation on Linux: that article would be worth a read. I hope this helps. -- Giles https://www.gilesorr.com/ gilesorr@gmail.com

On 2022-01-17 08:51, Giles Orr wrote:
Install a desktop environment (as opposed to a "window manager") if you don't have one
I may be misremembering, but installing one of the desktop packages doesn't necessarily bring in the automount facility. Only installing the Desktop image gives you that. There are a bunch of older Raspberry Pi tutorials (and by older, I mean from 2019 or before) that recommend starting with Lite and then installing the desktop on top. You don't end up with the same functionality. All bets are off with the new(ish) Raspberry Pi OS Bullseye. So much has changed (particularly if you're a camera user) that even good advice from a few months ago is strikingly wrong. A couple of details: * the desktop runs a completely different system depending on what board you're on. Raspberry Pi 4Bs and 400s with 4 or more GB RAM get Mutter and other Gnome-like things. Those with 2 GB or less get the familiar(ish) LXQt things. * The Raspberry Pi OS maintainers have created a legacy/LTS release to help buffer some of these changes. They're still a very small team and community needs are seldom taken into account. Stewart
participants (5)
-
Giles Orr
-
Kevin Cozens
-
mwilson@Vex.Net
-
Nicholas Krause
-
Stewart C. Russell