Posted: Mon Jun 14, 2021 18:55 Post subject: [WORKAROUND] Mounting USB before starting dnsmasq, SmartDNS?
Router: ASUS RT-AC1900P / RT-AC68P
dnsmasq (with addn-hosts), SmartDNS (DoT); USB (ext2) mounted on /jffs
Services > USB:
Automatic Drive Mount: Enable
Mount this Partition to /jffs: populated with the UUID
When smartdns.conf and addn-hosts were on the internal flash, dnsmasq and SmartDNS automatically started at bootup without issue.
But due to JFFS2 issues (mainly "Error garbage collecting note at ...!" since "compression type 0x06 not available" didn't matter?), I migrated /jffs to a USB flash drive.
But with /jffs on USB, dnsmasq is started before the USB is mounted, so I have to manually start it via CLI, which is not sustainable.
syslog:
Quote:
daemon.err dnsmasq[1372]: failed to load names from /jffs/dnsmasq/hosts.txt: No such file or directory
...
kern.info kernel: hub 2-0:1.0: USB hub found
kern.info kernel: hub 2-0:1.0: 2 ports detected
kern.info kernel: usb 1-2: new high-speed USB device number 2 using ehci-pci
kern.info kernel: xhci_hcd 0000:00:0c.0: xHCI Host Controller
kern.info kernel: xhci_hcd 0000:00:0c.0: new USB bus registered, assigned bus number 3
kern.info kernel: xhci_hcd 0000:00:0c.0: hcc params 0x02501164 hci version 0x100 quirks 0x00000010
kern.info kernel: hub 3-0:1.0: USB hub found
kern.err kernel: hub 3-0:1.0: config failed, hub doesn't have any ports! (err -19)
kern.info kernel: xhci_hcd 0000:00:0c.0: xHCI Host Controller
kern.info kernel: xhci_hcd 0000:00:0c.0: new USB bus registered, assigned bus number 4
kern.info kernel: usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
kern.info kernel: hub 4-0:1.0: USB hub found
kern.info kernel: hub 4-0:1.0: 1 port detected
kern.notice kernel: SCSI subsystem initialized
kern.info kernel: usb-storage 1-2:1.0: USB Mass Storage device detected
kern.info kernel: usb-storage 1-2:1.0: Quirks match for vid 4146 pid ba01: 80
kern.info kernel: scsi host0: usb-storage 1-2:1.0
kern.info kernel: usbcore: registered new interface driver usb-storage
...
kern.info kernel: sda: sda1
kern.notice kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
user.info : cron : daemon successfully stopped
kern.warn kernel: EXT4-fs (sda1): Ignoring removed nobh option
Did not work:
Services > USB > Run-on-mount Script Name: /jffs/etc/dnsmasq/restart_dns.sh
Can USB be mounted before dnsmasq is started?
If not, how might I work around this issue, such as automating start/restart of dnsmasq after the USB is mounted?
Last edited by Particle Man on Wed Jun 16, 2021 18:36; edited 2 times in total
Joined: 08 May 2018 Posts: 14246 Location: Texas, USA
Posted: Tue Jun 15, 2021 17:49 Post subject:
Perhaps the title of this thread should be, "How to restart dnsmasq, SmartDNS after USB drive successfully mounted?"... since that would likely be more logical considering the delay for the USB drive to mount. _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Thanks for the suggestions. To be clear, the issue was not with making dnsmasq or SmartDNS work. The issue is/was these services starting before the USB is (automatically) mounted.
But, curiously, adding sleep before a restart script (the one-liner in the OP to start/stop/reload) did not work, although it works in the CLI.
While "How to restart dnsmasq, SmartDNS after USB mounts?" addresses this workaround, it does not address the issue.
And I'm unaware of any ramifications of (unintuitively) disabling SmartDNS in the UI (while instead starting it in a script), as it has been working whether disabled or enabled in the UI.