Uhttpd troubleshooting - it doesn't run and cannot be started

I use a self compiled snapshot main OpenWrt build and it worked OK.
I've decided to make a new compile using these optimization settings. All other settings I used were from my old working config.

CONFIG_TARGET_OPTIMIZATION="-O3 -pipe -mcpu=cortex-a53+crc+crypto"

Additionally I've used these optimizations from menuconfig advanced.

CONFIG_USE_LTO=y; CONFIG_USE_MOLD=y; CONFIG_ZLIB_OPTIMIZE_SPEED=y
for higher Performance.
I use OpenSSL.

I flashed the build and it's running but Luci is not accessible. I checked and I can see that uhttpd doesn't work and cannot be started.
Any help or ideas what may caused this?
IPs were masked.

root@QNAP:~# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      6409/wsdd2
tcp        0      0 0.0.0.0:3702            0.0.0.0:*               LISTEN      6409/wsdd2
tcp        0      0 192.168.2.1:53          0.0.0.0:*               LISTEN      8686/dnsmasq
tcp        0      0 xxxxx109.255:53        0.0.0.0:*               LISTEN      8686/dnsmasq
tcp        0      0 0.0.0.0:22           0.0.0.0:*               LISTEN      2058/dropbear
tcp        0      0 192.168.1.1:53          0.0.0.0:*               LISTEN      8686/dnsmasq
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      8686/dnsmasq
tcp        0      0 192.168.1.1:60222       192.168.1.2:10694       ESTABLISHED 29227/dropbear
tcp        0    960 192.168.1.1:60222       192.168.1.2:5643        ESTABLISHED 29735/dropbear
tcp        0      0 192.168.1.1:60222       192.168.1.2:10745       ESTABLISHED 29248/dropbear
tcp        0      0 xxxxxxxxx:3d87:53 :::*                    LISTEN      8686/dnsmasq
tcp        0      0 :::5355                 :::*                    LISTEN      6409/wsdd2
tcp        0      0 xxxxxxxxxxx:a8e0:53 :::*                    LISTEN      8686/dnsmasq
tcp        0      0 xxxxxxxxxx:ec7::1:53  :::*                    LISTEN      8686/dnsmasq
tcp        0      0 :::3702                 :::*                    LISTEN      6409/wsdd2
tcp        0      0 :::445                  :::*                    LISTEN      -
tcp        0      0 xxxxxxxxxx:f9a3:53 :::*                    LISTEN      8686/dnsmasq
tcp        0      0 xxxxxxxxxxxx:a8db:53 :::*                    LISTEN      8686/dnsmasq
tcp        0      0 :::22                :::*                    LISTEN      2058/dropbear
tcp        0      0 ::1:53                  :::*                    LISTEN      8686/dnsmasq
tcp        0      0 xxxxxxxxxxe52:a8df:53 :::*                    LISTEN      8686/dnsmasq
tcp        0      0 xxxxxxxxxxe:ee8::1:53  :::*                    LISTEN      8686/dnsmasq
tcp        0      0 ::ffff:192.168.1.1:445  ::ffff:192.168.1.2:1849 ESTABLISHED -

root@QNAP:~# logread -f
Fri Apr 12 23:16:57 2024 daemon.err uhttpd[526]: Failed to initialize ustream-ssl
Fri Apr 12 23:16:57 2024 daemon.info procd: Instance uhttpd::instance1 s in a crash loop 9 crashes, 0 seconds since last crash

Your log clearly points the finger towards ustream-ssl. I have no idea how your optimizations could have selectively affected the build of this one utility, but a practical way forward would be to download and reinstall the package providing it.

I've commented out https and it started but that's just a workaround.

config uhttpd 'main'
	list listen_http '0.0.0.0:80'
	list listen_http '[::]:80'
	# list listen_https '0.0.0.0:443'
	# list listen_https '[::]:443'
	option redirect_https '0'
	option home '/www'
	option rfc1918_filter '1'
	option max_requests '3'
	option max_connections '100'
	option cert '/etc/uhttpd.crt'
	option key '/etc/uhttpd.key'
	option cgi_prefix '/cgi-bin'
	list lua_prefix '/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua'
	option script_timeout '60'
	option network_timeout '30'
	option http_keepalive '20'
	option tcp_keepalive '1'
	option ubus_prefix '/ubus'

config cert 'defaults'
	option days '730'
	option key_type 'ec'
	option bits '2048'
	option ec_curve 'P-256'
	option country 'ZZ'
	option state 'Somewhere'
	option location 'Unknown'
	option commonname 'OpenWrt'

https://downloads.openwrt.org/releases/packages-23.05/aarch64_cortex-a53/base/libustream-openssl20201210_2023-02-25-498f6e26-1_aarch64_cortex-a53.ipk

https://downloads.openwrt.org/releases/packages-23.05/aarch64_cortex-a53/base/libopenssl3_3.0.13-1_aarch64_cortex-a53.ipk

I use the main branch.

I don't think you can get pre-built packages for the development branch. Also IMO the packages for 23.05 should work fine with it.

I have these
libustream-openssl20201210 2024.04.07 ~d61493a4-r1
libopenssl 3 3.0.13-r1

This line in your log

Fri Apr 12 23:16:57 2024 daemon.err uhttpd[526]: Failed to initialize ustream-ssl

Shows that ustream-ssl which you compiled is not working. Not that you don't have it. There might be an issue with this package, or with the package it depends on - libopenssl. This does not exhaust all possible problems but the easy thing to try is reinstall both libraries and check if that helped.

1 Like

Undo this, does it work then?

If that doesn’t help,

CONFIG_TARGET_OPTIMIZATION="-O3 -pipe -mcpu=cortex-a53+crc+crypto"

undo the other idea you did and see if that work.

That was a pending task.
One question though, Do I need make clean for example?
Should I compile from scratch after disabling the options or I can just deselect and recompile?

Always before every compile.

You will at least also need to run the make defaultconfig command after you make changes to the config.