usbmount does not work on Bionic
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
usbmount (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
The package "usbmount" under previous versions of Ubuntu (definitely under Xenial 16.04), mounted USB filesystems such as memory sticks, to mountpoints /media/usb0 /media/usb1 /media/usb2 etc. This was ideal for server or headless systems (i.e. without a desktop) to gain access to, for example, USB memory card readers.
On Bionic, usbmount no longer appears to work.
Package: usbmount
Version: 0.0.22
What works in both 16.04 and 18.04 :
* When you install the usbmount package, the mount points /media/usb0 /media/usb1 /media/usb2 .. /media/usb7 are created
* The symbolic link /media/usb correctly links to /media/usb0
* /etc/usbmount is populated with the default configuration files
* /dev/sdb1 , /dev/sdb2 etc. do correctly come into existence when a memory card is inserted into the reader. This is nothing to do with usbmount but it does indicate that my system is otherwise performing correctly.
What doesn't work in 18.04 that used to work in 16.04 :
* When you place a memory card (e.g. SD card) into an attached USB memory card reader, usbmount on Bionic does not automatically mount it to one of the /media/usb? points. For example, when I insert a Raspberry Pi micro SD card (one card, two partitions; first VFAT and second EXT4) into my USB card reader, under Xenial it mounted /dev/sdb1 to /media/usb0 , and /dev/sdb2 to /media/usb1 . Under Bionic it does not mount anything. However /dev/sdb1 and /dev/sdb2 do exist and can be mounted manually.
My guess:
* I suspect that Bionic is doing something different in the way it detects new USB device connections or new memory card insertions (maybe all newly attached filesystems?). If my suspicion is correct then the usbmount scripts never get called.
Other observations:
* When I remove the card fromt the reader, the Bionic console says "usb 1-2: device descriptor read/64, error -32". It didn't do that under Xenial.
Workaround:
* I can mount the filesystems manually using sudo mount /dev/sdb1 /media/usb0 && sudo mount /dev/sdb2 /media/usb1 , however this assumes I already know the partitions on the card. If I don't, then I have to use sudo fdisk -l to examine the card first. This is a faff and prone to user error.
I REALLY, REALLY don't want to be writing files to the wrong device!!! (Been there, done that, killed the boot & root partitions). usbmount provided a relatively safe way to quickly automatically mount SD cards & USB keys (for example it didn't require sudo). Using the workaround is considerably more risky.
My use case is that I run a Raspberry Pi educational club for children, and I use usbmount to edit and read Micro SD card files to/from backups on my Ubuntu headless server.
This issue is caused by MountFlags=slave in the systemd- udevd.service file. Historically 16.04 removed this flag to allow laptop-mode-tools to work:
https:/ /askubuntu. com/questions/ 1019865/ why-does- ubuntu- 16-04-remove- mountflags- slave-from- systemd- udevd-service
In 18.04 this flag is preserved and as such when usbmount mounts filesystems they are mounted into systemd's private namespace and not visible to the user.
A workaround is to override the MountFlag as described in:
https:/ /unix.stackexch ange.com/ a/441588/ 191141