in raspberry OS Desktop the usb storage is automatically mounted when inserted. I would like to get the same behavior on Raspberry OS Lite as well.
I tried autofs. It doesn't match my needs, since I have an udev rule that doesn't get triggered. usbmount can't find it:
max@raspi02W:~ $ sudo apt install usbmount
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package usbmount
I have udisks2 installed on both Lite and Desktop:
max@raspi02W:~ $ sudo systemctl status udisks2.service
● udisks2.service - Disk Manager
Loaded: loaded (/lib/systemd/system/udisks2.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-02-18 09:45:45 GMT; 9h ago
Docs: man:udisks(8)
Main PID: 1857 (udisksd)
Tasks: 5 (limit: 191)
CPU: 621ms
CGroup: /system.slice/udisks2.service
└─1857 /usr/libexec/udisks2/udisksd
Feb 18 09:45:44 raspi02W systemd[1]: Starting Disk Manager...
Feb 18 09:45:45 raspi02W udisksd[1857]: udisks daemon version 2.9.2 starting
Feb 18 09:45:45 raspi02W udisksd[1857]: failed to load module mdraid: libbd_mdraid.so.2: cannot open shared object file: No such file or directory
Feb 18 09:45:45 raspi02W udisksd[1857]: Failed to load the 'mdraid' libblockdev plugin
Feb 18 09:45:45 raspi02W systemd[1]: Started Disk Manager.
Feb 18 09:45:45 raspi02W udisksd[1857]: Acquired the name org.freedesktop.UDisks2 on the system message bus
I compared the syslogs of a Lite and a Desktop:
when I plug the usb key into my Lite system I get this syslog:
Feb 18 10:39:31 raspi02W kernel: [ 5598.877307] Indeed it is in host mode hprt0 = 00021501
Feb 18 10:39:31 raspi02W kernel: [ 5599.065148] usb 1-1: new high-speed USB device number 9 using dwc_otg
Feb 18 10:39:31 raspi02W kernel: [ 5599.065314] Indeed it is in host mode hprt0 = 00001101
Feb 18 10:39:31 raspi02W kernel: [ 5599.274223] usb 1-1: New USB device found, idVendor=0781, idProduct=5591, bcdDevice= 1.00
Feb 18 10:39:31 raspi02W kernel: [ 5599.274255] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 18 10:39:31 raspi02W kernel: [ 5599.274269] usb 1-1: Product: SanDisk 3.2Gen1
Feb 18 10:39:31 raspi02W kernel: [ 5599.274282] usb 1-1: Manufacturer: USB
Feb 18 10:39:31 raspi02W kernel: [ 5599.274294] usb 1-1: SerialNumber: 0101355c7c5ef28a6204b299b2493f23214399e69a1ff706b25139a818284814c20600000000000000000000c23b70400004520091558107a32a3c44
Feb 18 10:39:31 raspi02W kernel: [ 5599.275214] usb-storage 1-1:1.0: USB Mass Storage device detected
Feb 18 10:39:31 raspi02W kernel: [ 5599.275999] scsi host0: usb-storage 1-1:1.0
Feb 18 10:39:31 raspi02W mtp-probe: checking bus 1, device 9: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1"
Feb 18 10:39:31 raspi02W mtp-probe: bus: 1, device: 9 was not an MTP device
Feb 18 10:39:31 raspi02W mtp-probe: checking bus 1, device 9: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1"
Feb 18 10:39:31 raspi02W mtp-probe: bus: 1, device: 9 was not an MTP device
Feb 18 10:39:32 raspi02W kernel: [ 5600.298101] scsi 0:0:0:0: Direct-Access USB SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
Feb 18 10:39:32 raspi02W kernel: [ 5600.298748] sd 0:0:0:0: Attached scsi generic sg0 type 0
Feb 18 10:39:32 raspi02W kernel: [ 5600.299248] sd 0:0:0:0: [sda] 120176640 512-byte logical blocks: (61.5 GB/57.3 GiB)
Feb 18 10:39:32 raspi02W kernel: [ 5600.299739] sd 0:0:0:0: [sda] Write Protect is off
Feb 18 10:39:32 raspi02W kernel: [ 5600.300307] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Feb 18 10:39:32 raspi02W kernel: [ 5600.310496] sda: sda1
Feb 18 10:39:32 raspi02W kernel: [ 5600.313409] sd 0:0:0:0: [sda] Attached SCSI removable disk
While in the Desktop system I have this other syslog:
Feb 18 11:13:52 raspberrypi0W kernel: [ 1461.968068] Indeed it is in host mode hprt0 = 00021501
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.177892] usb 1-1: new high-speed USB device number 4 using dwc_otg
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.178115] Indeed it is in host mode hprt0 = 00001101
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.539283] usb 1-1: New USB device found, idVendor=0781, idProduct=5591, bcdDevice= 1.00
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.539310] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.539324] usb 1-1: Product: SanDisk 3.2Gen1
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.539338] usb 1-1: Manufacturer: USB
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.539368] usb 1-1: SerialNumber: 0101355c7c5ef28a6204b299b2493f23214399e69a1ff706b25139a818284814c20600000000000000000000c23b70400004520091558107a32a3c44
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.545072] usb-storage 1-1:1.0: USB Mass Storage device detected
Feb 18 11:13:52 raspberrypi0W kernel: [ 1462.563830] scsi host0: usb-storage 1-1:1.0
Feb 18 11:13:52 raspberrypi0W mtp-probe: checking bus 1, device 4: "/sys/devices/platform/soc/20980000.usb/usb1/1-1"
Feb 18 11:13:52 raspberrypi0W mtp-probe: bus: 1, device: 4 was not an MTP device
Feb 18 11:13:53 raspberrypi0W mtp-probe: checking bus 1, device 4: "/sys/devices/platform/soc/20980000.usb/usb1/1-1"
Feb 18 11:13:53 raspberrypi0W mtp-probe: bus: 1, device: 4 was not an MTP device
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.611050] scsi 0:0:0:0: Direct-Access USB SanDisk 3.2Gen1 1.00 PQ: 0 ANSI: 6
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.614813] sd 0:0:0:0: [sda] 120176640 512-byte logical blocks: (61.5 GB/57.3 GiB)
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.615570] sd 0:0:0:0: [sda] Write Protect is off
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.615595] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.616753] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.628949] sd 0:0:0:0: Attached scsi generic sg0 type 0
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.655520] sda: sda1
Feb 18 11:13:53 raspberrypi0W kernel: [ 1463.661335] sd 0:0:0:0: [sda] Attached SCSI removable disk
Feb 18 11:13:58 raspberrypi0W systemd[1]: Started Clean the /media/pi/6D09-D3B7 mount point.
Feb 18 11:13:58 raspberrypi0W udisksd[269]: Mounted /dev/sda1 at /media/pi/6D09-D3B7 on behalf of uid 1000
The difference is in the last three lines of the log, that are a systemd log and an udisksd logs. Also, there are no (or I don't see) dbus messages that have anything to do with automatic mounting.
possible not to use some configuration of these two services to perform the automatic mount function?