I broke the luci config and I also have ssh login disabled

So I learned the hard way that uninstalling random "unnecessary" packages is not the best way to do things.

Do I have to hard-reset my router or is there another option I can do without losing my settings?

The error when I attempt to access via luci:

/usr/lib/lua/luci/dispatcher.lua:724: No valid theme found
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:724: in function 'init_template_engine'
	/usr/lib/lua/luci/dispatcher.lua:848: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:478: in function </usr/lib/lua/luci/dispatcher.lua:477>

TIA.

You will need to reset your router. See failsafe mode

2 Likes

Regarding this statement, obviously you are dealing with to consequences of that action. That said, I will ask why you were doing this (not in a judgmental way, but rather to understand what you were trying to achieve).

Although it is counterintuitive, removing the packages you believe to be unnecessary will not free up any space. Quite the opposite, actually, as it will consume space. This is is because the entire installation resides in a ROM partition. This means that the packages cannot actually be removed. Instead, what happens is that the packages are 'marked' as deleted in the overlay partition (that is R/W) -- but this actually requires space in order to tell the system to ignore the contents of ROM. In your case, this is actually a good thing because the files are all intact in the ROM, so a failsafe based reset-to-defaults (firstboot) will resolve the issue.

If you are trying to save space, you will need to build your own image. This isn't hard, but it isn't quite as straightforward as just downloading the pre-built firmware image. You can completely customize your own image, though, including removing packages that you don't need for space or other resource/security reasons. Be careful, though, recovering from a poorly constructed image could be more complicated.

5 Likes

Hi psherman, sorry for the delay (I had a covid scare). Thank you for writing that up and helping me with my issue.

I tried the methods listed on the docs page. The softboot method did not work with either of the two buttons on the router. The router does not have any sort of LED boot sequence: all the lights flash on when the router is turned on, and the only way to know when the router is fully booted is to test through a connected machine (it takes about 40 seconds).

I tried the second method of setting a static IP and listening on a port, which did not yield anything.

Finally, I tried hard resetting via holding down the reset button on the router, which did nothing. The router is soft-bricked in that it actually perfectly works as a router with all of its settings, but I can't access it or reset it in any way.

The router is a Netgear WNDR3400. I tried to remove one of the luci-theme packages because I figured they were extra themes or something (I needed just a tiny bit more space, not something worth rolling a custom image for). That's why it's yelling at me about no themes being found. Anyway that would not have been a problem had I not forgotten that I had SSH login disabled. I did that out of a flash of paranoia over security, which I have been advised now is a little unnecessary for my use case.

Sorry to hear you had a COVID scare. I hope everything is okay now.

So you have two options that I can think of...

  1. Try the failsafe again (it might be possible, I'll explain shortly)
  2. Open the device and connect a USB-Serial adapter. There are serial header pads on the board. Once the device is booted up, you should be able to run a serial session that would be equivalent to ssh, but doesn't require the dropbear service to be running/listening.

On the failsafe, try the following:

  • set your computer to a static IP address in the 192.168.1.0/24 network (for example: 192.168.1.10, subnet 255.255.255.0).
  • start a continuous ping test to 192.168.1.1
  • Power cycle the router.
  • immediately after applying power, press the WPS button repeatedly
  • watch for the pings to return, when they do, you can stop pressing the WPS button
  • attempt to ssh into the router (username root, password is blank)

I tried the failsafe method you described at least five times and unfortunately it did not work.

I also do not have any USB-serial adapter. I've never even seen one in real life. I see that this may be the last resort so I will have to consider ordering one online if I want to fix this.

Thank you for your help.

Fortunately, usb serial adapters are cheap. Often less than $10 us.

Would you be willing to link an example of this cable? All I find are USB-serial connectors with the type of serial that comes with printers and motherboards. I see no such connection when I open up my router.

Something like this sill work.
https://www.amazon.com/dp/B00IJXZQ7C/ref=cm_sw_r_cp_api_glt_fabc_DBJTVXWTVHK137TDYTF5

On many of my devices, at the last step, the LAN link goes down, and the IP-address that you just statically set will be removed again ... and the ping to 192.168.1.1 then fails.

So in those cases either:

  • Be real quick, and/or prepare a command like ip a a 192.168.1.3/24 dev eth0; ping 192.168.1.1 to launch as soon as the Link LED switches on on your computer

or

  • Add a switch in between your PC and the router, so that the PC wont loose link during the powercyle.

I don't use windows, but I've never seen this type of thing happen on a Mac or Linux system. If you set the IP address manually, it should not be removed, although the interface will become inactive when the link goes down. But as soon as the link comes back up, the static address that was set manually should work as expected, at least on all the systems I have used.

EDIT: if you need to ensure that the link doesn't go down, just stick a cheap unmanaged switch between the computer and the router.

I am on Linux. Also, both of the machines I have at home have static leases (if that matters), though I did try the resetting process with and without setting an IP manually.

I am but a humble layman and do not have any of this fancy equipment just sitting around : (

I'd hardly call this fancy equipment -- an unmanaged switch is loosely like a splitter. It allows you to connect more wired devices. Like this one.

Static leases might be something different.

If you set the address manually on the computer itself (typing in all of the network info), you have a static IP address set on the computer. If the computer uses DHCP to obtain an address and the router has a static lease set, the computer is expecting to get the information from the router (and the router will always assign the same address to the computer -- the static lease is also called a DHCP reservation).