Reinstalling uhttpd

Hello, I mistakenly removed uhttpd via the Luci web interface. I was trying to remove Bandwidth Monitor and thought it was related (and Luci was independent).

This immediately stopped the Luci web interface. Whoops.

I've ssh'ed in and run opkg update then opkg install uhttpd to reinstall uhttpd.

the opkg commands complete without error but then uhttpd cannot be started.

service uhttpd start generates no web interface or uhttpd process.

/etc/init.d/uhttpd start or stop or reload all do nothing and leave no uhttpd processing running.

There is no error showing in dmesg.

It's unclear what's failing.

How can I reinstall the uhttpd process and start it?

OpenWrt 22.03.2

This version is eol and unsupported. You should upgrade to the latest (23.05.5). The upgrade process will fix the issue along the way.

1 Like

Examine logread -e uhttpd , it will hint on what is wrong with configurations.
One possibility is to flash 22.03.7 default image which contains operable uhttpd then assess upgradability to 23.05.5, in worst case it means typing back confguration from configuration backup file ipo automatic upgrade. Please show output of

ubus call system board

To help us assist you on upgrade.

1 Like

Hello, thank you for your inputs.

It's good advice and I've tried to upgrade but am having difficulty.

I got the upgraded firmware installed for OpenWrt 23.05.5 but Luci did not start up at reboot. This, perhaps, was expected because I preserved configuration settings with the sysupgrade command:

sysupgrade -v /tmp/openwrt-23.05.5-mvebu-cortexa9-linksys_wrt1900ac-v1-squashfs-sysupgrade.bin

Preserving config files in /etc preserved (a) my settings and (b) the very problem I was trying to recover from which was an accidentally uninstalled uhttpd. So, preserving settings was not a smart move in hindsight (again).

I had configured command-line login for an alternative username and disabled root login for root. So the upgrade occurred fine and it's running OpenWrt 23.05.5, and I can login via the alternative user, but that user is not privileged and there's no sudo or su command available. There's a login command but root cannot authenticate with login.

I tried to use sysupgrade to install OpenWRT for the first time (using factory image), at the 23.05.5 command line. Even adding the force -F flag results in this error:

myUname@OpenWrt:/tmp$ sysupgrade -v /tmp/openwrt-23.05.5-mvebu-cortexa9-linksys_wrt1900ac-v1-squashfs-factory.img
Sat Nov 23 18:07:48 EST 2024 upgrade: Image metadata not present
Sat Nov 23 18:07:48 EST 2024 upgrade: Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware
Image check failed.
myUname@OpenWrt:/tmp$ 

What are the command-line steps to install factory default image for OpenWrt from a running shell in that same version OS?

Or how can I get root access? Or how can uhttpd be started with a non-priveliged user?

You have to use sysupgrade images to upgrade openwrt

Attempts to upgrade again, without saving configuration settings seems to complete but it doesn't reboot and manual rebooting doesn't seem to reboot into the newly installed OS.

myuname@OpenWrt:/tmp$ sysupgrade -v -F /tmp/openwrt-23.05.5-mvebu-cortexa9-linksys_wrt1900ac-v1-squashfs-sysupgrade.bin
Sat Nov 23 18:22:30 EST 2024 upgrade: The device is supported, but this image is incompatible for sysupgrade based on the image version (1.0->2.0).
Sat Nov 23 18:22:30 EST 2024 upgrade: Partition design has changed compared to older versions (up to 19.07) due to kernel size restrictions. Upgrade via sysupgrade mechanism is not possible, so new installation via factory style image is required.
Image check failed but --force given - will update anyway!
Sat Nov 23 18:22:30 EST 2024 upgrade: Saving config files...
etc/config/fstab
etc/config/luci
etc/config/openssl
etc/config/ubootenv
etc/config/ucitrack
etc/config/wireless
etc/fw_env.config
etc/group
etc/hosts
etc/hotplug.d/online/50-opkg-restore
etc/inittab
etc/luci-uploads/.placeholder
etc/nftables.d/10-custom-filter-chains.nft
etc/nftables.d/README
etc/opkg/keys/2f8b0b98e08306bf
etc/opkg/keys/4d017e6f1ed5d616
etc/opkg/keys/b5043e70f9a75cde
etc/passwd
etc/profile
etc/profile.d/opkg.sh
etc/rc.local
etc/shells
etc/shinit
etc/ssl/mycert.crt
etc/ssl/mycert.key
etc/sysctl.conf
etc/sysupgrade.conf
etc/uhttpd.crt
etc/uhttpd.key
Failed to create the configuration backup.
myuname@OpenWrt:/tmp$

The firstboot command also appears to have done something but rebooting (a) fails from command line and (b) doesn't do anything after power cycling.

myuname@OpenWrt:/$ firstboot
This will erase all settings and remove any installed packages. Are you sure? [N/y] y
/dev/ubi0_1 is mounted as /overlay, only erasing files
myuname@OpenWrt:/$  reboot
reboot: Operation not permitted
myuname@OpenWrt:/$ 

Changes seem to be written from the command line but nothing changes after reboot

I tried both. sysupgrade and also the factory resets images. neither are resulting in any change after reboot

It's hard to say why you're having so many issues, but the solution would be to boot into failsafe mode and then reset (firstboot -y && reboot)

https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset

That's exaclty what was necessary.

Failsafe to the rescue.

The Linksys WRT1900AC's are not easy to see the light, but it's on the far left and very dim.

Pressing reset during the entire reboot process fails, but waiting until the (dim) light is blinking quickly then pressing the reset button was the only way to enter failsafe mode.

From there firstboot worked and all settings were re-implemented.

    root@(none):~# firstboot
    This will erase all settings and remove any installed packages. Are you sure? [N/y]
    y
    /dev/ubi0_1 is not mounted
    /dev/ubi0_1 will be erased on next mount
    root@(none):~# 

Thanks for helping.

you're welcome.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

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