Can't get Automount and Hotplug to work with an ISO9660 DVD Drive

Hello there all,

I have had some success in setting up 19.07 on a Blueendless / Kimax BS-U35WF single NAS enclosure. I am using a 3 TB Seagate drive. When I started this project I had intended also hooking up a USB based DVD drive so those on our network could also access optical media.

I can get the 3 TB to mount with two partitions. One a 1 gb swap and a the remaining balance as an EXT4 partition. My SMB share works to share with Mac and Windows devices. I am also able to mount the DVD drive and can see the contents also through our network on Windows and Mac clients also with a SMB share.

My issue is that I can not hotswap or automount the DVD drive after inserting a new disc. I have to reboot the Kimax device and it will mount using my mount line in the local.rc script. I have installed the following packages:

avahi-nodbus-daemon - 0.8-1
base-files - 204.2-r11063-85e04e9f46
blkid - 2.34-1
block-mount - 2020-05-12-84269037-1
blockd - 2020-05-12-84269037-1
busybox - 1.30.1-5
ca-bundle - 20200601-1
cgi-io - 19
cifsmount - 6.9-1
collectd - 5.11.0-7
collectd-mod-cpu - 5.11.0-7
collectd-mod-email - 5.11.0-7
collectd-mod-interface - 5.11.0-7
collectd-mod-iwinfo - 5.11.0-7
collectd-mod-load - 5.11.0-7
collectd-mod-memory - 5.11.0-7
collectd-mod-network - 5.11.0-7
collectd-mod-rrdtool - 5.11.0-7
dnsmasq - 2.80-16.1
dropbear - 2019.78-2
e2fsprogs - 1.44.5-2
eject - 2.34-1
f2fs-tools - 1.12.0-3
f2fsck - 1.12.0-3
fdisk - 2.34-1
firewall - 2019-11-22-8174814a-1
fstools - 2020-05-12-84269037-1
fwtool - 2
gdisk - 1.0.4-2
getrandom - 2019-06-16-4df34a4d-3
glib2 - 2.58.3-5
hd-idle - 1.05-2
hdparm - 9.58-1
hostapd-common - 2019-08-08-ca8c2bd2-3
ip6tables - 1.8.3-1
iptables - 1.8.3-1
iw - 5.0.1-1
iwinfo - 2019-10-16-07315b6f-1
jshn - 2020-02-27-7da66430-1
jsonfilter - 2018-02-04-c7e938d6-1
kernel - 4.14.180-1-18384755d38fc43c447d83d4a3e07054
kmod-cfg80211 - 4.14.180+4.19.120-1-1
kmod-crypto-aead - 4.14.180-1
kmod-crypto-ccm - 4.14.180-1
kmod-crypto-cmac - 4.14.180-1
kmod-crypto-crc32 - 4.14.180-1
kmod-crypto-crc32c - 4.14.180-1
kmod-crypto-ctr - 4.14.180-1
kmod-crypto-des - 4.14.180-1
kmod-crypto-ecb - 4.14.180-1
kmod-crypto-gcm - 4.14.180-1
kmod-crypto-gf128 - 4.14.180-1
kmod-crypto-ghash - 4.14.180-1
kmod-crypto-hash - 4.14.180-1
kmod-crypto-hmac - 4.14.180-1
kmod-crypto-iv - 4.14.180-1
kmod-crypto-manager - 4.14.180-1
kmod-crypto-md4 - 4.14.180-1
kmod-crypto-md5 - 4.14.180-1
kmod-crypto-null - 4.14.180-1
kmod-crypto-pcompress - 4.14.180-1
kmod-crypto-rng - 4.14.180-1
kmod-crypto-seqiv - 4.14.180-1
kmod-crypto-sha256 - 4.14.180-1
kmod-crypto-sha512 - 4.14.180-1
kmod-crypto-wq - 4.14.180-1
kmod-fs-autofs4 - 4.14.180-1
kmod-fs-cifs - 4.14.180-1
kmod-fs-exfat - 4.14.180+2018-04-17-01c30ad5-2
kmod-fs-ext4 - 4.14.180-1
kmod-fs-f2fs - 4.14.180-1
kmod-fs-isofs - 4.14.180-1
kmod-fs-ksmbd - 4.14.180+3.1.3-1
kmod-fs-udf - 4.14.180-1
kmod-fs-vfat - 4.14.180-1
kmod-gpio-button-hotplug - 4.14.180-3
kmod-hid - 4.14.180-1
kmod-hid-generic - 4.14.180-1
kmod-input-core - 4.14.180-1
kmod-input-evdev - 4.14.180-1
kmod-ip6tables - 4.14.180-1
kmod-ipt-conntrack - 4.14.180-1
kmod-ipt-core - 4.14.180-1
kmod-ipt-nat - 4.14.180-1
kmod-ipt-offload - 4.14.180-1
kmod-leds-gpio - 4.14.180-1
kmod-lib-crc-ccitt - 4.14.180-1
kmod-lib-crc-itu-t - 4.14.180-1
kmod-lib-crc16 - 4.14.180-1
kmod-lib-zlib-inflate - 4.14.180-1
kmod-loop - 4.14.180-1
kmod-mac80211 - 4.14.180+4.19.120-1-1
kmod-mii - 4.14.180-1
kmod-nf-conntrack - 4.14.180-1
kmod-nf-conntrack6 - 4.14.180-1
kmod-nf-flow - 4.14.180-1
kmod-nf-ipt - 4.14.180-1
kmod-nf-ipt6 - 4.14.180-1
kmod-nf-nat - 4.14.180-1
kmod-nf-reject - 4.14.180-1
kmod-nf-reject6 - 4.14.180-1
kmod-nls-base - 4.14.180-1
kmod-nls-cp437 - 4.14.180-1
kmod-nls-iso8859-1 - 4.14.180-1
kmod-nls-utf8 - 4.14.180-1
kmod-ppp - 4.14.180-1
kmod-pppoe - 4.14.180-1
kmod-pppox - 4.14.180-1
kmod-rt2800-lib - 4.14.180+4.19.120-1-1
kmod-rt2800-mmio - 4.14.180+4.19.120-1-1
kmod-rt2800-soc - 4.14.180+4.19.120-1-1
kmod-rt2x00-lib - 4.14.180+4.19.120-1-1
kmod-rt2x00-mmio - 4.14.180+4.19.120-1-1
kmod-scsi-cdrom - 4.14.180-1
kmod-scsi-core - 4.14.180-1
kmod-scsi-generic - 4.14.180-1
kmod-slhc - 4.14.180-1
kmod-sound-core - 4.14.180-1
kmod-usb-audio - 4.14.180-1
kmod-usb-core - 4.14.180-1
kmod-usb-ehci - 4.14.180-1
kmod-usb-hid - 4.14.180-1
kmod-usb-net - 4.14.180-1
kmod-usb-net-pl - 4.14.180-1
kmod-usb-ohci - 4.14.180-1
kmod-usb-storage - 4.14.180-1
kmod-usb-storage-extras - 4.14.180-1
kmod-usb-storage-uas - 4.14.180-1
kmod-usb2 - 4.14.180-1
kmod-usb3 - 4.14.180-1
ksmbd-avahi-service - 3.2.1-1
ksmbd-server - 3.2.1-1
ksmbd-utils - 3.2.1-1
libaio - 0.3.112-1
libatomic1 - 7.5.0-2
libattr - 2.4.48-1
libavahi-nodbus-support - 0.8-1
libblkid1 - 2.34-1
libblobmsg-json - 2020-02-27-7da66430-1
libbz2-1.0 - 1.0.8-1
libc - 1.1.24-2
libcap - 2.27-1
libcomerr0 - 1.44.5-2
libdaemon - 0.14-5
libexif - 0.6.21-1
libexpat - 2.2.9-1
libext2fs2 - 1.44.5-2
libf2fs6 - 1.12.0-3
libfdisk1 - 2.34-1
libffi - 3.2.1-3
libffmpeg-mini - 3.4.7-3
libflac - 1.3.3-1
libgcc1 - 7.5.0-2
libgmp10 - 6.1.2-2
libgnutls - 3.6.14-1
libid3tag - 0.15.1b-4
libip4tc2 - 1.8.3-1
libip6tc2 - 1.8.3-1
libiwinfo-lua - 2019-10-16-07315b6f-1
libiwinfo20181126 - 2019-10-16-07315b6f-1
libjpeg - 9c-2
libjson-c2 - 0.12.1-3.1
libjson-script - 2020-02-27-7da66430-1
libltdl7 - 2.4.6-2
liblua5.1.5 - 5.1.5-3
liblucihttp-lua - 2019-07-05-a34a17d5-1
liblucihttp0 - 2019-07-05-a34a17d5-1
libmount1 - 2.34-1
libncurses6 - 6.1-5
libnettle7 - 3.5.1-1
libnl-core200 - 3.4.0-2
libnl-genl200 - 3.4.0-2
libnl-tiny - 0.1-5
libogg - 1.3.3-1
libpthread - 1.1.24-2
librrd1 - 1.0.50-3
librt - 1.1.24-2
libsmartcols1 - 2.34-1
libsqlite3-0 - 3310100-1
libss2 - 1.44.5-2
libubox20191228 - 2020-02-27-7da66430-1
libubus-lua - 2019-12-27-041c9d1c-1
libubus20191227 - 2019-12-27-041c9d1c-1
libuci20130104 - 2019-09-01-415f9e48-3
libuclient20160123 - 2019-05-30-3b3e368d-1
libusb-1.0-0 - 1.0.22-2
libuuid1 - 2.34-1
libvorbis - 1.3.7-1
libxtables12 - 1.8.3-1
logd - 2019-06-16-4df34a4d-3
lsblk - 2.34-1
lua - 5.1.5-3
luci - git-20.136.49537-fb2f363-1
luci-app-firewall - git-20.136.49537-fb2f363-1
luci-app-hd-idle - git-20.204.30585-8750495-1
luci-app-ksmbd - git-20.211.35121-aa4aa72-1
luci-app-minidlna - git-20.216.62629-4d5c88b-1
luci-app-opkg - git-20.136.49537-fb2f363-1
luci-app-statistics - git-20.221.53167-304ad04-1
luci-app-upnp - git-20.216.62629-4d5c88b-1
luci-base - git-20.136.49537-fb2f363-1
luci-compat - git-20.204.30585-8750495-1
luci-lib-ip - git-20.136.49537-fb2f363-1
luci-lib-iptparser - git-20.221.53167-304ad04-1
luci-lib-jsonc - git-20.136.49537-fb2f363-1
luci-lib-nixio - git-20.136.49537-fb2f363-1
luci-mod-admin-full - git-20.136.49537-fb2f363-1
luci-mod-network - git-20.136.49537-fb2f363-1
luci-mod-status - git-20.136.49537-fb2f363-1
luci-mod-system - git-20.136.49537-fb2f363-1
luci-proto-ipv6 - git-20.136.49537-fb2f363-1
luci-proto-ppp - git-20.136.49537-fb2f363-1
luci-theme-bootstrap - git-20.136.49537-fb2f363-1
minidlna - 2019-12-09-0763719f-6
miniupnpd - 2.1.20200510-2
mkf2fs - 1.12.0-3
mount-utils - 2.34-1
msmtp - 1.8.11-1
mtd - 24
netifd - 2019-08-05-5e02f944-1
odhcp6c - 2019-01-11-e199804b-16
odhcpd-ipv6only - 2020-05-03-49e4949c-3
openwrt-keyring - 2019-07-25-8080ef34-1
opkg - 2020-05-07-f2166a89-1
ppp - 2.4.7.git-2019-05-25-3
ppp-mod-pppoe - 2.4.7.git-2019-05-25-3
procd - 2020-03-07-09b9bd82-1
rpcd - 2019-12-10-aaa08366-2
rpcd-mod-file - 2019-12-10-aaa08366-2
rpcd-mod-iwinfo - 2019-12-10-aaa08366-2
rpcd-mod-luci - 20191114
rpcd-mod-rrdns - 20170710
rrdtool1 - 1.0.50-3
smartd - 7.0-3
smartmontools - 7.0-3
swap-utils - 2.34-1
swconfig - 12
terminfo - 6.1-5
tgt - 1.0.79-1
triggerhappy - 0.5.0-1
ubox - 2019-06-16-4df34a4d-3
ubus - 2019-12-27-041c9d1c-1
ubusd - 2019-12-27-041c9d1c-1
uci - 2019-09-01-415f9e48-3
uclibcxx - 0.2.5-3
uclient-fetch - 2019-05-30-3b3e368d-1
uhttpd - 2020-03-13-975dce23-1
urandom-seed - 1.0-1
urngd -2020-01-21-c7f7b6b6-1
usbutils - 007-10
usign - 2019-08-06-5a52b379-1
wireless-regdb - 2019.06.03-1
wpad-basic - 2019-08-08-ca8c2bd2-3
xfs-mkfs - 4.11.0-4
zlib - 1.2.11-3

Here is the block info output:

root@OpenWrt:~# block info
/dev/mtdblock5: UUID="477d51e5-29845057-c5131de3-70baa6fa" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/mtdblock6: MOUNT="/overlay" TYPE="jffs2"
/dev/sda1: UUID="00912c07-b4db-4bf9-85e3-4b187509d0ef" VERSION="1" TYPE="swap"
/dev/sda2: UUID="15986107-db12-4a39-a195-80fd0fe9a368" VERSION="1.0" MOUNT="/mnt/NASShare" TYPE="ext4"

Here is the blkid output:

root@OpenWrt:~# blkid
/dev/mtdblock5: TYPE="squashfs"
/dev/sda1: UUID="00912c07-b4db-4bf9-85e3-4b187509d0ef" TYPE="swap" PARTLABEL="Linux swap" PARTUUID="e5e3658d-9fad-48e6-b0e2-cb4d04e9a21d"
/dev/sda2: UUID="15986107-db12-4a39-a195-80fd0fe9a368" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="5ecf0d80-1e88-4003-a78d-4ecd1202c106"
/dev/sr0: UUID="2012-12-28-06-13-15-72" LABEL="457126_DVDJPEG1" TYPE="iso9660"

Here is what my /etc/config/fstab looks like:

config global
	option anon_mount '1'
	option auto_swap '1'
	option auto_mount '1'
	option delay_root '5'
	option check_fs '1'
	option anon_swap '1'

config global 'automount'
	option from_fstab '1'
	option anon_mount '1'

config swap
	option uuid '00912c07-b4db-4bf9-85e3-4b187509d0ef'
	option enabled '1'
	option device '/dev/sda1'

config mount
	option target '/mnt/NASShare'
	option uuid '15986107-db12-4a39-a195-80fd0fe9a368'
	option enabled '1'
	option fstype 'ext4'
	option enabled_fsck '1'
	option device '/dev/sda2'

config mount
	option target '/mnt/OpticalShare'
	option enabled '1'
	option fstype 'iso9660'
	option autofs '1'
	option device '/dev/sr0'

Again the SMB shares work but I would just like to be able hotswap the USB 2.0 LG DVD drive. Any help is appreciated.

Chad

Some more outputs.

Lsusb output:
root@OpenWrt:~# lsusb
Bus 001 Device 004: ID 152e:2507 LG (HLDS) PL-2507 IDE Controller
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 174c:1153 ASMedia Technology Inc. ASM1153 SATA 3Gb/s bridge
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

My Ksmbd template:

[global]
	netbios name = |NAME|
	server string = |DESCRIPTION|
	workgroup = |WORKGROUP|
	interfaces = |INTERFACES|
	bind interfaces only = yes
	ipc timeout = 40
	deadtime = 15
	map to guest = Bad User
	smb2 max read = 64K
	smb2 max write = 64K
	smb2 max trans = 64K
	cache read buffers = no
	cache trans buffers = no
	server min protocol = SMB2_10
	server max protocol = SMB3_11
##################
	server signing = auto
	guest account = nobody
	#max active sessions (default: 1024)
	restrict anonymous = 0
	#root directory (default: none)
	#max open files (default: 10000)
	#tcp port (default: 445)
	smb3 encryption = yes
	smb2 leases = yes

My rc.local setup:

sleep 60 

#setting hdd idle down
hdparm -S 120 /dev/sda

#mounting the DVD drive
mount -t iso9660 /dev/sr0 /mnt/OpticalShare

#allowing the DVD drive to be ejected with the physical button
eject -i 0 /dev/sr0

exit 0

Dmesg output:

root@OpenWrt:~# dmesg
[    0.000000] Linux version 4.14.180 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11063-85e04e9f46)) #0 Sat May 16 18:32:20 2020
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is Kimax U35WF
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] On node 0 totalpages: 32768
[    0.000000] free_area_init_node: node 0, pgdat 8047e5d0, node_mem_map 81000040
[    0.000000]   Normal zone: 256 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000] random: get_random_bytes called from 0x80481740 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00079806
[    0.000000] Readback ErrCtl register=00079806
[    0.000000] Memory: 123796K/131072K available (3916K kernel code, 187K rwdata, 500K rodata, 1212K init, 215K bss, 7276K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000012] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.015479] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.087730] pid_max: default: 32768 minimum: 301
[    0.097151] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.110180] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.129240] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.148722] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.160902] pinctrl core: initialized pinctrl subsystem
[    0.172506] NET: Registered protocol family 16
[    0.203574] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.214609] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.227211] rt2880_gpio 10000660.gpio: registering 32 gpios
[    0.238215] rt2880_gpio 10000660.gpio: registering 32 irq handlers
[    0.250809] rt2880_gpio 10000688.gpio: registering 1 gpios
[    0.261637] rt2880_gpio 10000688.gpio: registering 1 irq handlers
[    0.278611] clocksource: Switched to clocksource systick
[    0.290280] NET: Registered protocol family 2
[    0.299858] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.313642] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.326226] TCP: Hash tables configured (established 1024 bind 1024)
[    0.339002] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.350530] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.363214] NET: Registered protocol family 1
[    0.371797] PCI: CLS 0 bytes, default 32
[    0.374537] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.387266] Crashlog allocated RAM at address 0x3f00000
[    0.399422] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.417967] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.429469] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.459405] io scheduler noop registered
[    0.467049] io scheduler deadline registered (default)
[    0.478224] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.493649] console [ttyS0] disabled
[    0.500709] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.520381] console [ttyS0] enabled
[    0.534193] bootconsole [early0] disabled
[    0.558015] spi spi0.0: force spi mode3
[    0.566534] m25p80 spi0.0: mx25l12805d (16384 Kbytes)
[    0.576710] 4 fixed-partitions partitions found on MTD device spi0.0
[    0.589384] Creating 4 MTD partitions on "spi0.0":
[    0.598948] 0x000000000000-0x000000030000 : "u-boot"
[    0.609795] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.621334] 0x000000040000-0x000000050000 : "factory"
[    0.632335] 0x000000050000-0x000001000000 : "firmware"
[    0.646410] 2 uimage-fw partitions found on MTD device firmware
[    0.658274] Creating 2 MTD partitions on "firmware":
[    0.668185] 0x000000000000-0x00000017e02c : "kernel"
[    0.679054] 0x00000017e02c-0x000000fb0000 : "rootfs"
[    0.689824] mtd: device 5 (rootfs) set to be root filesystem
[    0.702746] 1 squashfs-split partitions found on MTD device rootfs
[    0.715135] 0x0000003e0000-0x000000fb0000 : "rootfs_data"
[    0.727647] libphy: Fixed MDIO Bus: probed
[    0.744740] gsw: setting port4 to ephy mode
[    0.753157] mtk_soc_eth 10100000.ethernet eth0 (uninitialized): port 4 link up (100Mbps/Full duplex)
[    0.771603] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    0.784118] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.801142] rt2880_wdt 10000120.watchdog: Initialized
[    0.812596] NET: Registered protocol family 10
[    0.825678] Segment Routing with IPv6
[    0.833159] NET: Registered protocol family 17
[    0.842087] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.867927] 8021q: 802.1Q VLAN Support v1.8
[    0.891894] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.
[    0.912724] Freeing unused kernel memory: 1212K
[    0.921773] This architecture does not have kernel memory protection.
[    2.618050] init: Console is alive
[    2.625236] init: - watchdog -
[    2.648573] random: fast init done
[    4.453297] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.553147] usbcore: registered new interface driver usbfs
[    4.564257] usbcore: registered new interface driver hub
[    4.575004] usbcore: registered new device driver usb
[    4.591128] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.605909] ehci-platform: EHCI generic platform driver
[    4.626726] phy phy-usbphy.0: remote usb device wakeup disabled
[    4.638538] phy phy-usbphy.0: UTMI 16bit 30MHz
[    4.647418] ehci-platform 101c0000.ehci: EHCI Host Controller
[    4.658918] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    4.674825] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    4.694699] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    4.708217] hub 1-0:1.0: USB hub found
[    4.716169] hub 1-0:1.0: 1 port detected
[    4.727349] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.741339] ohci-platform: OHCI generic platform driver
[    4.752120] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    4.765737] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    4.781646] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    4.819756] hub 2-0:1.0: USB hub found
[    4.827740] hub 2-0:1.0: 1 port detected
[    4.839722] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.858301] init: - preinit -
[    5.759031] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    6.010450] random: procd: uninitialized urandom read (4 bytes read)
[    6.023686] hub 1-1:1.0: USB hub found
[    6.038466] hub 1-1:1.0: 4 ports detected
[    6.499471] 8021q: adding VLAN 0 to HW filter on device eth0
[    6.609417] usb 1-1.1: new high-speed USB device number 3 using ehci-platform
[    6.708331] usb 1-1.2: new high-speed USB device number 4 using ehci-platform
[    8.506270] jffs2: notice: (420) jffs2_build_xattr_subsystem: complete building xattr subsystem, 75 of xdatum (3 unchecked, 72 orphan) and 172 of xref (76 dead, 0 orphan) found.
[    8.571787] mount_root: loading kmods from internal overlay
[   12.851837] kmodloader: loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[   13.198226] exFAT: Version 1.2.9
[   14.489336] SCSI subsystem initialized
[   14.951177] usb-storage 1-1.1:1.0: USB Mass Storage device detected
[   14.970764] scsi host0: usb-storage 1-1.1:1.0
[   14.980156] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[   14.994037] scsi host1: usb-storage 1-1.2:1.0
[   15.003356] usbcore: registered new interface driver usb-storage
[   15.045900] usbcore: registered new interface driver uas
[   15.057331] kmodloader: done loading kernel modules from /tmp/overlay/upper/etc/modules-boot.d/*
[   16.043799] scsi 0:0:0:0: Direct-Access     ASMT     2115             0    PQ: 0 ANSI: 6
[   16.065947] sd 0:0:0:0: [sda] Very big device. Trying to use READ CAPACITY(16).
[   16.082062] scsi 1:0:0:0: CD-ROM            HL-DT-ST DVDRAM GSA-E40L  SE02 PQ: 0 ANSI: 0
[   16.110592] sd 0:0:0:0: [sda] 5860533168 512-byte logical blocks: (3.00 TB/2.73 TiB)
[   16.126083] sd 0:0:0:0: [sda] 4096-byte physical blocks
[   16.164798] sd 0:0:0:0: [sda] Write Protect is off
[   16.174399] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[   16.183819] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   16.238237] block: attempting to load /tmp/jffs_cfg/upper/etc/config/fstab
[   16.259707] block: extroot: not configured
[   16.269340] mount_root: switching to jffs2 overlay
[   16.330927] overlayfs: upper fs does not support tmpfile.
[   16.347453]  sda: sda1 sda2
[   16.359211] sd 0:0:0:0: [sda] Attached SCSI disk
[   16.562966] urandom-seed: Seeding with /etc/urandom.seed
[   16.773268] procd: - early -
[   16.779303] procd: - watchdog -
[   17.566206] procd: - watchdog -
[   17.574582] procd: - ubus -
[   18.133235] random: ubusd: uninitialized urandom read (4 bytes read)
[   18.162324] random: ubusd: uninitialized urandom read (4 bytes read)
[   18.180854] random: ubusd: uninitialized urandom read (4 bytes read)
[   18.194756] procd: - init -
[   19.882524] urandom_read: 5 callbacks suppressed
[   19.882534] random: jshn: uninitialized urandom read (4 bytes read)
[   20.392570] kmodloader: loading kernel modules from /etc/modules.d/*
[   20.665503] urngd: jent-rng init failed, err: 2
[   20.762179] jitterentropy: Initialization failed with host not compliant with requirements: 2
[   22.373632] loop: module loaded
[   23.081603] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   23.206416] sr 1:0:0:0: [sr0] scsi3-mmc drive: 125x/125x writer dvd-ram cd/rw xa/form2 cdda tray
[   23.224017] cdrom: Uniform CD-ROM driver Revision: 3.20
[   23.235055] sr 1:0:0:0: Attached scsi CD-ROM sr0
[   23.439802] hidraw: raw HID events driver (C) Jiri Kosina
[   23.514149] sd 0:0:0:0: Attached scsi generic sg0 type 0
[   23.524977] sr 1:0:0:0: Attached scsi generic sg1 type 5
[   23.553679] Loading modules backported from Linux version v4.19.120-0-gfdc072324f3c
[   23.569015] Backport generated by backports.git v4.19.120-1-0-g60c3a249
[   23.590555] ip_tables: (C) 2000-2006 Netfilter Core Team
[   23.617488] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[   23.774005] usbcore: registered new interface driver ums-alauda
[   23.788616] usbcore: registered new interface driver ums-cypress
[   23.806444] usbcore: registered new interface driver ums-datafab
[   23.821192] usbcore: registered new interface driver ums-freecom
[   23.841737] usbcore: registered new interface driver ums-isd200
[   23.856521] usbcore: registered new interface driver ums-jumpshot
[   23.873772] usbcore: registered new interface driver ums-karma
[   23.894323] usbcore: registered new interface driver ums-sddr09
[   23.912403] usbcore: registered new interface driver ums-sddr55
[   23.927406] usbcore: registered new interface driver ums-usbat
[   23.992007] usbcore: registered new interface driver usbhid
[   24.003173] usbhid: USB HID core driver
[   24.079128] xt_time: kernel timezone is -0000
[   24.204484] usbcore: registered new interface driver plusb
[   24.220337] PPP generic driver version 2.4.2
[   24.235790] NET: Registered protocol family 24
[   24.556559] usbcore: registered new interface driver snd-usb-audio
[   24.607047] rt2800_wmac 10180000.wmac: loaded eeprom from mtd device "factory"
[   24.621528] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[   24.636994] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[   24.651440] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   24.666664] jitterentropy: Initialization failed with host not compliant with requirements: 2
[   24.691324] kmodloader: 1 module could not be probed
[   24.704628] kmodloader: - jitterentropy_rng - 0
[   35.609686] 8021q: adding VLAN 0 to HW filter on device eth0
[   35.628013] br-lan: port 1(eth0) entered blocking state
[   35.638518] br-lan: port 1(eth0) entered disabled state
[   35.649309] device eth0 entered promiscuous mode
[   35.661170] br-lan: port 1(eth0) entered blocking state
[   35.671652] br-lan: port 1(eth0) entered forwarding state
[   35.682634] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   36.709337] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   39.076406] Adding 1048572k swap on /dev/sda1.  Priority:-2 extents:1 across:1048572k
[   41.414373] random: crng init done
[   45.645915] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts:
[  112.796138] ISO 9660 Extensions: Microsoft Joliet Level 1
[  112.809422] ISOFS: changing to secondary root

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output.
grafik
Please edit your post accordingly. Thank you! :slight_smile:

1 Like

you have provided alot of information... kudos...

just wanted to clarify to things that are a little murky in your reasoning;

a disk and a drive are two different things

  1. hotplug and 'block' are very different things... often related or appearing to provide a single operation...

  2. any service/script utilizing (removable) file systems or mounts often needs to also factor in the 'removal/unmount' part of the equation... which can get tricky depending on the fs/service/scripts in question. ( i'd strongly suggest removing all services ~smb~ from the equation while initially implementing / testing said feature )

2 Likes

Thanks for the suggestion about the SMB disable. I guess I should clarify. I would like to share the DVD drive to the clients on my network. The discs that we are utilizing are CD roms all the way to DVD roms. No need to allow the creation of media by writing to discs. Just want to have an ability to read them through a network client.

All disks regardless of type or contents I am mounting to /mnt/OpticalShare. My workflow is to insert the disk, by pressing the eject button, power on the Kimax, rc.local will mount to the /mnt/OpticalShare, with a client navigate to the /mnt/OpticalShare with the SMB protocol. Do what I need to do with the data, eject the disc, insert new disc, close the tray and reboot the Kimax.

I would like to avoid the reboot process of the Kimax just to get a new mount.

Chad

1 Like
  1. Make just you have the correct smb.conf settings/setup

  2. Test them

What is your smb configuration currently?

To understand what we are dealing with, collect the environment variables for block related events.

I am not using Samba but the lighter Ksmbd. But here is my SMB config:

And here is the global template:

[global]
	netbios name = |NAME|
	server string = |DESCRIPTION|
	workgroup = |WORKGROUP|
	interfaces = |INTERFACES|
	bind interfaces only = yes
	ipc timeout = 40
	deadtime = 15
	map to guest = Bad User
	smb2 max read = 64K
	smb2 max write = 64K
	smb2 max trans = 64K
	cache read buffers = no
	cache trans buffers = no
	server min protocol = SMB2_10
	server max protocol = SMB3_11
##################
	server signing = auto
	guest account = nobody
	#max active sessions (default: 1024)
	restrict anonymous = 0
	#root directory (default: none)
	#max open files (default: 10000)
	#tcp port (default: 445)
	smb3 encryption = yes
	smb2 leases = yes

I am attempting to use a block code I found here and I am hoping that I just have a syntax error here somewhere: https://gist.github.com/lanceliao/455687b8e9780d8e487d#file-10-mount-sh-L123

From the link above:
10-mount.sh

#!/bin/sh

. /lib/functions/block.sh

set_devices(){
	set_section="$(uci show fstab | grep "$get_uuid" | awk -F "." '{print $2}')"
	old_device=$(uci get fstab.${set_section}.device)
	[ "$old_device" != "/dev/$device" ]&&{
		uci set fstab.${set_section}.device="/dev/$device"
		uci commit fstab
	}
}

set_fstab(){

	# modified to fit for blkid of barrier breaker
	my_fstype="`blkid | grep "/dev/$device" | awk -F 'TYPE="' '{print $2}' | sed 's/\" //' | awk -F 'PARTUUID=' '{print $1}' | sed 's/"//g'`"
	
	[ -n "$my_fstype" ] && {
		
		if [ "$my_fstype" = 'swap' ]; then
			
			n=$(uci show fstab | grep "fstab.@swap" | grep -c "=swap")
			
			[ $n -gt 0 ] && {
				for i in $(seq 0 $n)
				do
					old_swap="$(uci get fstab.@swap[$i].device)"
					[ "$old_swap" = "/dev/$device" ] && {
						FLAG="SKIP"
						break
					}
				done
			}

			[ "$FLAG" != "SKIP" ] && {
				uci add fstab swap
				uci set fstab.@swap[$n]="swap"
				uci set fstab.@swap[$n].enabled='1'
				uci set fstab.@swap[$n].device="/dev/$device"
			}

		else
			
			n=$(uci show fstab | grep "fstab.@mount" | grep -c "=mount")

			uci add fstab mount
			uci set fstab.@mount[$n]="mount"
			uci set fstab.@mount[$n].enabled=1
			uci set fstab.@mount[$n].device="/dev/$device"
			uci set fstab.@mount[$n].uuid="${get_uuid}"
			uci set fstab.@mount[$n].target="/mnt/$device"
			uci set fstab.@mount[$n].fstype="$my_fstype"

			case "$my_fstype" in
				ext*)
					uci set fstab.@mount[$n].options="rw";;
				'ntfs')
					uci set fstab.@mount[$n].options="noatime";;
				'exfat')
					uci set fstab.@mount[$n].options="noatime";;
				'vfat')
					uci set fstab.@mount[$n].options="utf8=1,umask=0000,dmask=0000,fmask=0000";;
			esac
		fi
		uci commit fstab
	}
}

blkdev=`dirname $DEVPATH`
if [ `basename $blkdev` != "block" ]; then

    device=`basename $DEVPATH`
    mountpoint=`sed -ne "s|^[^ ]*/$device ||; T; s/ .*//p" /proc/self/mounts`

    case "$ACTION" in
	add)
		get_uuid=`blkid | grep "/dev/${device}" | awk -F "UUID=" '{print $2}'| awk -F "\"" '{print $2}'`
		[ -n "$get_uuid" ] && {
			have_uuid=$(uci show fstab | grep -c "$get_uuid")
			[ "$have_uuid" = "0" ] && set_fstab
			[ "$have_uuid" != "0" ] && set_devices
		}
		local from_fstab
		local anon_mount
		local anon_swap
		local anon_fsck
		local mds_mount_target
		local mds_mount_device
		local mds_mount_fstype
		local sds_swap_device
		local use_device
		
		local autoswap_from_fstab
		local automount_from_fstab

	    mount_dev_section_cb() {
    		mds_mount_target="$2"
			mds_mount_device="$3"
			mds_mount_fstype="$4"
			mds_mount_options="$5"
			mds_mount_enabled="$6"
	    }

	    swap_dev_section_cb() { 
			sds_swap_device="$2"
			return 0
	    }

		config_get_automount
		automount_from_fstab="$from_fstab"
		[ "$automount_from_fstab" -eq 1 ] && {
			config_get_mount_section_by_device "/dev/$device"
			use_device="$mds_mount_device"
			[ "$mds_mount_enabled" -eq 1 ] && {
				if [ -n "$mds_mount_target" ]; then
					grep -q "/dev/$device" /proc/mounts || {
						mkdir -p "$mds_mount_target"
						logger -t 'fstab' "Chang permission of mount point ${mds_mount_target}"
						chmod 777 "$mds_mount_target"
						case "$mds_mount_fstype" in
						   'ntfs')
						   env -i /bin/mount -o "$mds_mount_options" /dev/$device "$mds_mount_target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
						    ;;
							*)
								env -i /bin/mount -t "$mds_mount_fstype" -o "$mds_mount_options" /dev/$device "$mds_mount_target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab';;
						esac										
					}
				else
					logger -t 'fstab' "Mount enabled for $mds_mount_device but it doesn't have a defined mountpoint (target)"
				fi
			}
			pgrep aria2c >/dev/null 2>&1 || /etc/init.d/aria2 start
			pgrep smbd >/dev/null 2>&1 || /etc/init.d/samba start
			# hack for 2.5 inch hard drive delay
			#[ -n "`which hdparm`" -a -n "hdparm -I /dev/$device | grep 5400" ] && hdparm -B 254 /dev/$device
		}

		[ -z "$use_device" ] && {
			config_get_autoswap
			autoswap_from_fstab="$from_fstab"
		
			[ "$autoswap_from_fstab" -eq 1 ] && {
				config_get_swap_section_by_device "/dev/$device"
				use_device="$sds_swap_device"
			}
		}

		grep -q "/dev/$device" /proc/mounts || {
			[ "$anon_mount" -eq 1 -a -z "$use_device" ] && {
				case "$device" in
					mtdblock*) ;;
					*)
					[ -z "`blkid | grep "/dev/$device" | awk -F 'TYPE="' '{print $2}' | sed 's/\" //'`" ] && {
					logger -t 'fstab' "/dev/$device is a Logic Disk or has not supported filesystem "
					return 0
					}
						( mkdir -p /mnt/$device && chmod 777 /mnt/$device && mount /dev/$device /mnt/$device ) 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
					;;
				esac
			}
		}
		;;
	remove)
		umount $mountpoint
		rm -rf $mountpoint
		;;
    esac	

fi
20-swap.sh
#!/bin/sh
# Copyright (C) 2009-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

. /lib/functions/block.sh

blkdev=`dirname $DEVPATH`

if [ `basename $blkdev` != "block" ]; then

    device=`basename $DEVPATH`


    case "$ACTION" in
	add)
		local autoswap_from_fstab
		local automount_from_fstab
		local from_fstab
		local anon_mount
		local anon_swap
		local anon_fsck
		local mds_mount_device
		local sds_swap_device
		local sds_swap_enabled
		local use_device
		local do_swap=0

	    mount_dev_section_cb() {
			mds_mount_device="$3"
	    }

	    swap_dev_section_cb() { 
			sds_swap_device="$2"
			sds_swap_enabled="$3"
			return 0
	    }

		config_get_automount
		automount_from_fstab="$from_fstab"
		
		[ "$automount_from_fstab" -eq 1 ] && {
			config_get_mount_section_by_device "/dev/$device"
		}
		
		# skip trying swap if this device is defined as a mount point
		[ -z "$mds_mount_device" ] && {		
			config_get_autoswap
			autoswap_from_fstab="$from_fstab"
		
			[ "$autoswap_from_fstab" -eq 1 ] && {
				config_get_swap_section_by_device "/dev/$device"
				use_device="$sds_swap_device" 
				do_swap="$sds_swap_enabled"
			}

			[ -z "$use_device" ] && [ "$anon_swap" -eq 1 ] && {
				use_device="/dev/$device" && do_swap=1
			}
		}

		[ -n "$use_device" ] && [ "$do_swap" -eq 1 ] && {
			grep -q "$use_device" /proc/swaps || grep -q "$use_device" /proc/mounts || {
				swapon "$use_device"
			}
		}
		;;
	remove)
		grep -q "/dev/$device" /proc/swaps && {
			swapoff "/dev/$device"
		}
		;;
    esac	
fi

And block.sh

#!/bin/sh
# Copyright 2010 Vertical Communications
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

. /lib/functions.sh

config_get_mount() {
	local gm_cfg="$1"
	local gm_param="$2"
	local gm_target
	local gm_device
	local gm_fstype
	local gm_options
	local gm_enabled
	local gm_enabled_fsck
	local gm_uuid
	local gm_label
	local gm_is_rootfs
	config_get gm_target "$1" target
	config_get gm_device "$1" device
	config_get gm_fstype "$1" fstype 'auto'
	config_get gm_options "$1" options 'rw'
	config_get_bool gm_enabled "$1" enabled 1
	config_get_bool gm_enabled_fsck "$1" enabled_fsck 0
	config_get gm_uuid "$1" uuid
	config_get gm_label "$1" label
	config_get_bool gm_is_rootfs "$1" is_rootfs 0
	mount_cb "$gm_cfg" "$gm_param" "$gm_target" "$gm_device" "$gm_fstype" "$gm_options" "$gm_enabled" "$gm_enabled_fsck" "$gm_uuid" "$gm_label" "$gm_is_rootfs"
}

config_get_swap() {
	local gs_cfg="$1"
	local gs_param="$2"
	local gs_device
	local gs_enabled
	local gs_uuid
	local gs_label
	config_get gs_device "$1" device
	config_get_bool gs_enabled "$1" enabled 1
	config_get gs_uuid "$1" uuid
	config_get gs_label "$1" label

	swap_cb "$gs_cfg" "$gs_param" "$gs_device" "$gs_enabled" "$gs_uuid" "$gs_label"
}

config_get_automount() {
	config_load fstab
	config_get_bool from_fstab "automount" from_fstab 1
	config_get_bool anon_mount "automount" anon_mount 1
	config_get_bool anon_fsck "automount" anon_fsck 0
}

config_get_autoswap() {
	config_load fstab
	config_get_bool from_fstab "autoswap" from_fstab 1
	config_get_bool anon_swap "autoswap" anon_swap 0
}

config_create_swap_fstab_entry() {
	local device="$1"
	local enabled="$2"

	[ -n "$device" ] || return 0

	local fstabnew

	mkdir -p /var/lock
	lock /var/lock/fstab.lck
	fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
	cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
	[ "$enabled" -eq 1 ] && echo "$device	none	swap	sw	0	0" >> "$fstabnew"
	cat "$fstabnew" >/tmp/fstab
	rm -f $fstabnew
	lock -u /var/lock/fstab.lck
}

config_create_mount_fstab_entry() {
	local device="$1"
	local target="$2"
	local fstype="$3"
	local options="$4"
	local enabled="$5"
	options="${options:-rw}"
	[ "$enabled" -eq 0 ] && options="noauto,$options"
	[ -n "$target" ] || return 0
	[ -n "$device" ] || return 0

	local fstabnew

	mkdir -p /var/lock
	lock /var/lock/fstab.lck
	fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
	cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
	echo "$device	$target	$fstype	$options	0	0" >>"$fstabnew"
	cat "$fstabnew" >/tmp/fstab		
	rm -f $fstabnew
	lock -u /var/lock/fstab.lck
}

libmount_find_token() {
	local token="$1"
	local value="$2"
	local device
	device="$(blkid -w /dev/null -c /dev/null | grep "$token=\"$value\"" | cut -f1 -d:)"
	echo "$device"
}

libmount_find_device_by_id() {
	local uuid="$1"
	local label="$2"
	local device="$3"
	local cfg_device="$4"
	local found_device
	
	if [ -n "$uuid" ]; then
		found_device="$(libmount_find_token "UUID" "$uuid")"
	elif [ -n "$label" ]; then
		found_device="$(libmount_find_token "LABEL" "$label")"
	elif [ "$device" = "$cfg_device" ]; then
		found_device="$device"
	elif [ -z "$device" ] && [ -e "$cfg_device" ]; then
		found_device="$cfg_device"
	fi
	[ -n "$device" ] && [ "$device" != "$found_device" ] && {
		found_device=""
	}
	echo "$found_device"
}

config_get_mount_section_by_device() {
	local msbd_device="$1"
	local msbd_mount_cfg=
	local msbd_target=
	local msbd_mount_device=
	local msbd_fstype=
	local msbd_options=
	local msbd_enabled=
	local msbd_enabled_fsck=
	local msbd_uuid=
	local msbd_label=
	local msbd_is_rootfs
	local msbd_blkid_fstype_match=
	mount_cb() {
		local mc_cfg="$1"
		local mc_device="$2"
		shift
		local mc_target="$2"
		local mc_cfgdevice="$3"
		local mc_fstype="$4"
		local mc_uuid="$8"
		local mc_label="$9"
		shift
		local mc_is_rootfs="$9"
		local mc_found_device=""
		
		mc_found_device="$(libmount_find_device_by_id "$mc_uuid" "$mc_label" "$mc_device" "$mc_cfgdevice")"
		if [ -n "$mc_found_device" ]; then
			msbd_mount_cfg="$mc_cfg"
			msbd_target="$mc_target"
			msbd_mount_device="$mc_found_device"
			msbd_fstype="$mc_fstype"
			msbd_options="$4"
			msbd_enabled="$5"
			msbd_enabled_fsck="$6"
			msbd_uuid="$7"
			msbd_label="$8"
			msbd_is_rootfs="$9"
		fi
		return 0	
	}
	config_foreach config_get_mount mount "$msbd_device"
	[ -n "$msbd_mount_device" ] && config_create_mount_fstab_entry "$msbd_mount_device" "$msbd_target" "$msbd_fstype" "$msbd_options" "$msbd_enabled" 
	mount_dev_section_cb "$msbd_mount_cfg" "$msbd_target" "$msbd_mount_device" "$msbd_fstype" "$msbd_options" "$msbd_enabled" "$msbd_enabled_fsck" "$msbd_uuid" "$msbd_label" "$msbd_is_rootfs"
}

config_get_swap_section_by_device() {
	local ssbd_device="$1"
	local ssbd_swap_cfg=
	local ssbd_swap_device=
	local ssbd_enabled=
	local ssbd_uuid=
	local ssbd_label=
	swap_cb() {
		local sc_cfg="$1"
		local sc_device="$2"
		local sc_uuid="$5"
		local sc_label="$6"
		local sc_cfgdevice="$3"
		local sc_found_device

		sc_found_device="$(libmount_find_device_by_id "$sc_uuid" "$sc_label" "$sc_device" "$sc_cfgdevice")"
		if [ -n "$sc_found_device" ]; then
			ssbd_swap_cfg="$sc_cfg"
			ssbd_swap_device="$sc_found_device"
			ssbd_enabled="$4"
			ssbd_uuid="$5"
			ssbd_label="$6"
		fi
		return 0	
	}
	config_foreach config_get_swap swap "$ssbd_device"
	[ -n "$ssbd_swap_device" ] && config_create_swap_fstab_entry "$ssbd_swap_device" "$ssbd_enabled"
	swap_dev_section_cb "$ssbd_swap_cfg" "$ssbd_swap_device" "$ssbd_enabled" "$ssbd_uuid" "$ssbd_label"
}

yes there are some issues here... once you validated atuotmount/block/hotplug... without samba...

2 Likes

Writing/debugging code without data is problematic.
Troubleshooting requires you to collect environment variables.
You need to catch the event of replacing the DVD disk/drive.

+1 for that.

Divide the problem into two phases.

  • First get the automount/hotplug to work with the disk change. Just operate from the SSH console and work with file access from there
  • Only after you have a working automout hotplug start looking for the network file share samba side.
1 Like

I see one issue that may be causing problem. The mount script that I am using calls to Samba and I am using Ksmbd. I will start there if no luck split this into two phases. Thanks all for your help.

I enjoy this problem solving.

Chad