luci icon indicating copy to clipboard operation
luci copied to clipboard

LuCi: DHCP and DNS option fails

Open rastersoft opened this issue 1 year ago • 11 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

screenshots or captures

Captura desde 2024-12-25 23-51-08

Actual behaviour

I went to DHCP and DNS option in OpenWrt 24.10.0-rc4 and it shows that error. It works fine in OpenWrt 23.05.5

Expected behaviour

It should show the DHCP and DNS screen.

Steps to reproduce

Go to Network -> DHCP and DNS

Additional Information

NAME="OpenWrt"
VERSION="24.10.0-rc4"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 24.10.0-rc4"
VERSION_ID="24.10.0-rc4"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r28211-d55754ce0d"
OPENWRT_BOARD="ramips/mt7621"
OPENWRT_ARCH="mipsel_24kc"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 24.10.0-rc4 r28211-d55754ce0d"
OPENWRT_BUILD_DATE="1734915335"

What browsers do you see the problem on?

Firefox

Relevant log output

No response

rastersoft avatar Dec 25 '24 23:12 rastersoft

Please paste the output from the browser console. (Ctrl+alt+k or so?)

systemcrash avatar Dec 25 '24 23:12 systemcrash

Here it is:

TypeError: nodes.querySelector(...) is null
    renderContents https://192.168.0.251/luci-static/resources/view/network/dhcp.js?v=24.357.59006~41cbd31:49
    promise callback*render/s.renderContents https://192.168.0.251/luci-static/resources/view/network/dhcp.js?v=24.357.59006~41cbd31:49
    promise callback*render https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:159
    renderChildren https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:34
    renderContents https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:48
    promise callback*render https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:48
    render https://192.168.0.251/luci-static/resources/view/network/dhcp.js?v=24.357.59006~41cbd31:112
[luci.js:154:9](https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31)

Uncaught (in promise) TypeError: nodes.querySelector(...) is null
    renderContents https://192.168.0.251/luci-static/resources/view/network/dhcp.js?v=24.357.59006~41cbd31:49
    promise callback*render/s.renderContents https://192.168.0.251/luci-static/resources/view/network/dhcp.js?v=24.357.59006~41cbd31:49
    promise callback*render https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:159
    renderChildren https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:34
    renderContents https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:48
    promise callback*render https://192.168.0.251/luci-static/resources/form.js?v=24.357.59006~41cbd31:48
    render https://192.168.0.251/luci-static/resources/view/network/dhcp.js?v=24.357.59006~41cbd31:112
[luci.js:49:647](https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31%20line%20171%20%3E%20eval)
    error https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:158
    (Asíncrono: promise callback)
    __init__ https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:139
    super https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:15
    ClassConstructor https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:5
    compileClass https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:175
    (Asíncrono: promise callback)
    compileClass https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:171
    (Asíncrono: promise callback)
    require https://192.168.0.251/luci-static/resources/luci.js?v=24.357.59006~41cbd31:177
    instantiateView https://192.168.0.251/luci-static/resources/ui.js?v=24.357.59006~41cbd31:369
    <anonymous> https://192.168.0.251/cgi-bin/luci/admin/network/dhcp:50
    (Asíncrono: promise callback)
    <anonymous> https://192.168.0.251/cgi-bin/luci/admin/network/dhcp:49

rastersoft avatar Dec 25 '24 23:12 rastersoft

And as capture: imagen

rastersoft avatar Dec 25 '24 23:12 rastersoft

Please share the contents of your /etc/config/dhcp file. You can redact any settings you think sensitive.

systemcrash avatar Dec 26 '24 00:12 systemcrash

At a guess it appears as though you might not have any dnsmasq section entries (or they were deleted?).

Are you able to say how that might have happened?

systemcrash avatar Dec 26 '24 00:12 systemcrash

Until there is better handling of this situation, you can add the following to your /etc/config/dhcp

config dnsmasq

And go to the GUI and tweak your settings.

systemcrash avatar Dec 26 '24 00:12 systemcrash

Confirmed: adding that "fixes" the problem. Thanks!

rastersoft avatar Dec 26 '24 13:12 rastersoft

To figure out if this is a regression or if LuCI has been always behaving this way for missing config dnsmasq, I've made /etc/config/dhcp an empty file with echo -n > /etc/config/dhcp. With OpenWrt 23.05.5 (r24106-10cc5fcd00) the /cgi-bin/luci/admin/network/dhcp says

Dnsmasq is a lightweight DHCP server and DNS forwarder. This section contains no values yet Screenshot_2025-01-09_22-04-10

So there is some error message there but it does not really provide a good way to recover anyway -- it is not possible to click Add with just an empty textfield to create the global config dhcp.

I did not try on 24.* if a completely empty /etc/config/dhcp would trigger the TypeError behaviour or the original 23.* error message.

@systemcrash Have you got any hints / guidance to what might have changed in 24 vs. 23, and what the general recovery mechanism for this situation should be?

adelton avatar Jan 09 '25 21:01 adelton

Same problem here on my Netgear r6260.

I don't need DHCP, so I disabled it by the checking "Ignore interface" at Interfaces->Lan->DHCP Server, Upgraded from 23.05.5 to 24.10.0 Then the error appeared when accessing "DHCP and DNS" settings.

Adding "config dnsmasq" to the end of "/etc/config/dhcp" fixed it.

Andreotti100 avatar Feb 07 '25 23:02 Andreotti100

I'd removed dnsmasq and replaced it with odhcpd+unbound. Removing dnsmasq hid the DHCP and DNS menu entry under the Network item, preventing me from managing my static leases.

Re-installing dnsmasq and rebooting returned the menu entry, but then I encountered this issue.

Adding config dnsmasq to the end of /etc/config/dhcp fixed it for me.

YodaDaCoda avatar Feb 09 '25 01:02 YodaDaCoda

Seems like https://github.com/openwrt/luci/commit/7e1b545bfa1d98a72d18c39528dade2b35421ed5 should allow access to the DHCP tab without dnsmasq. Till then, on 24.10 I just did touch dnsmasq in /usr/sbin to make the DHCP and DNS menu item load without installing the dnsmasq package.

prajaybasu avatar Nov 27 '25 01:11 prajaybasu