Luci ( uhttpd ) - channel 3: open failed: connect failed:

Hi everyone,

I would appreciate some help with some errors after upgrading my openWRT box.

I have upgraded from 19.7.2 to 19.7.7 and Luci is not working on HTTPS.

After the upgrade, it worked on the default 192.168.1.1:80 however when I restored my previous config from 19.7.2 Luci stopped responding as before and the logs were showing :

daemon.err uhttpd[6325]: Error: No sockets bound, unable to continue

I did some research on the internet and noticed that the default /rom/etc/uhttpd had some different lines and I have copied the default to my current config /etc/config/uhttpd and Luci started to fail with the below :

daemon.err uhttpd[6382]: /usr/bin/lua: /usr/lib/lua/luci/ccache.lua:6: module 'nixio.fs' not found:
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no field package.preload['nixio.fs']
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file './nixio/fs.lua'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/share/lua/nixio/fs.lua'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/share/lua/nixio/fs/init.lua'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/lib/lua/nixio/fs.lua'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/lib/lua/nixio/fs/init.lua'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file './nixio/fs.so'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/lib/lua/nixio/fs.so'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/lib/lua/loadall.so'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file './nixio.so'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/lib/lua/nixio.so'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       no file '/usr/lib/lua/loadall.so'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]: stack traceback:
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       [C]: in function 'require'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       /usr/lib/lua/luci/ccache.lua:6: in main chunk
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       [C]: in function 'require'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       /usr/lib/lua/luci/cacheloader.lua:6: in main chunk
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       [C]: in function 'require'
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       /www/cgi-bin/luci:2: in main chunk
Fri Mar 19 03:35:35 2021 daemon.err uhttpd[6382]:       [C]: ?

I have again after some research on the archives found a solution :

root@R1 /root > opkg install luci-lib-nixio
Installing luci-lib-nixio (git-21.072.27936-731d2e3-1) to root...
Downloading http://downloads.openwrt.org/releases/19.07.7/packages/arm_cortex-a9_vfpv3-d16/luci/luci-lib-nixio_git-21.072.27936-731d2e3-1_arm_cortex-a9_vfpv3-d16.ipk
Configuring luci-lib-nixio.
root@R1 /root > /etc/init.d/uhttpd restart

Luci then started to work and become accessible on port 80 however no luck on port 443 and started to fail with the below on the shell every time a connection is attempted:

root@R1 /etc/ssl > channel 4: open failed: connect failed:

I have followed the wiki and reissued Luci's certificates but the above error still happens.

The uhttpd config is as below :

root@R1 /etc/ssl > uci show uhttpd
uhttpd.main=uhttpd
uhttpd.main.listen_http='0.0.0.0:80' '[::]:80'
uhttpd.main.redirect_https='1'
uhttpd.main.home='/www'
uhttpd.main.rfc1918_filter='1'
uhttpd.main.max_requests='3'
uhttpd.main.max_connections='100'
uhttpd.main.cert='/etc/ssl/r1.crt'
uhttpd.main.key='/etc/ssl/r1.key'
uhttpd.main.cgi_prefix='/cgi-bin'
uhttpd.main.lua_prefix='/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua'
uhttpd.main.script_timeout='60'
uhttpd.main.network_timeout='30'
uhttpd.main.http_keepalive='20'
uhttpd.main.tcp_keepalive='1'
uhttpd.main.listen_https='0.0.0.0:443'
uhttpd.defaults=cert
uhttpd.defaults.days='730'
uhttpd.defaults.key_type='rsa'
uhttpd.defaults.bits='2048'
uhttpd.defaults.ec_curve='P-256'
uhttpd.defaults.country='ZZ'
uhttpd.defaults.state='Somewhere'
uhttpd.defaults.location='Unknown'
uhttpd.defaults.commonname='OpenWrt'

I am not sure how to fix the error above and any help would be appreciated. :smiley:

Have you installed luci-ssl package?

(Default in 19.07 is without SSL capability...)

2 Likes

The package luci-ssl was not installed, after installing it and changing the Luci's config it is now serving HTTPS as expected :grinning_face_with_smiling_eyes:

root@R1 /etc/config > uci show uhttpd
uhttpd.main=uhttpd
uhttpd.main.listen_https='127.0.0.1:443'
uhttpd.main.redirect_https='1'
uhttpd.main.home='/www'
uhttpd.main.rfc1918_filter='1'
uhttpd.main.max_requests='3'
uhttpd.main.max_connections='100'
uhttpd.main.cert='/etc/ssl/r1.crt'
uhttpd.main.key='/etc/ssl/r1.key'
uhttpd.main.cgi_prefix='/cgi-bin'
uhttpd.main.lua_prefix='/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua'
uhttpd.main.script_timeout='60'
uhttpd.main.network_timeout='30'
uhttpd.main.http_keepalive='20'
uhttpd.main.tcp_keepalive='1'
uhttpd.defaults=cert
uhttpd.defaults.days='730'
uhttpd.defaults.key_type='rsa'
uhttpd.defaults.bits='2048'
uhttpd.defaults.ec_curve='P-256'
uhttpd.defaults.country='ZZ'
uhttpd.defaults.state='Somewhere'
uhttpd.defaults.location='Unknown'
uhttpd.defaults.commonname='OpenWrt'

I did not backup the packages installed prior the upgrade which proved being a big mistake. I am going to check it before upgrading my other two openWRT boxes.

Thanks for your help. :+1:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.