kernel not issuing env variables on CD insertion
Tested & confirmed on Pi on Alpine armhf 3.10 and 3.11 which both have the issue, and compared with Sept 2019 Raspbian Buster Lite which does not have the issue. This can be easily checked following @skarnet suggestion (item #1).
Upon CD insertion event, kernel does NOT generate any environment variables. However, on CD eject event, kernel does properly generate environment variables as below:
DEVNAME=sr0
ACTION=change
SHLVL=1
HOME=/
SEQNUM=1118
MAJOR=11
DISK_MEDIA_CHANGE=1
DEVPATH=/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/host0/target0:0:0/0:0:0:0/block/sr0
SUBSYSTEM=block
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MINOR=0
PWD=/
DEVTYPE=disk
I checked kernel does properly generate environment variables for USB flash disks pluging/unpluging events.
On Raspbian, environment variables are created on both CD insert and CD eject as expected (same as for USB flash disks).
With that issue, mdev can not help properly detect CD insertion and do relevant actions...