How to set static ip addres in fail safe mode to acces web gui again

I made a wrong config in web gui and since then I dont know the IP address of the router or maybe its not listing to any.
I have managed to get ssh login into failsafe mode and tried to set ethernet static ip address 192.168.5.10 but when i reboot the devise it does not listen to this IP ping.

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd11:c5ac:cf22::/48'

config interface 'lan'
	option ifname 'eth0'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.5.10'

I dont want to factory reset the router just yet.
Please suggest.

I failsave yo can not modify the config in flash because the full system is running from ram with default config.

You have to mount root from flash, edit the config and then reboot.
If i'm right there will be shown some shell commands for recovery or reset if you login in over ssh in failsave mode.

Check out: https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset#fixing_your_settings

Reconnect/reboot your PC to get a new DHCP lease.
If the issue persists show the diagnostics:

ip a; ip r

The router is likely still reachable via IPv6.

1 Like

I have called mount_root. The config/network dump is correct.
Here I have given the same dump of /etc/config/network and also /etc/config/fstab
My devise uses extroot with an external 16G USD Stick.

root@(none):~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                   512.0K         0    512.0K   0% /dev
tmpfs                    13.8M     24.0K     13.7M   0% /tmp
/dev/mtdblock3          768.0K    648.0K    120.0K  84% /overlay
overlayfs:/overlay      768.0K    648.0K    120.0K  84% /
root@(none):~# cd /etc/config/
root@(none):/etc/config# cat network

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd11:c5ac:cf22::/48'

config interface 'lan'
	option ifname 'eth0'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.5.10'

root@(none):/etc/config# cat fstab
config 'global'
	option	anon_swap	'0'
	option	anon_mount	'0'
	option	auto_swap	'1'
	option	auto_mount	'1'
	option	delay_root	'5'
	option	check_fs	'0'

config 'mount'
	option	target	'/overlay'
	option	uuid	'dbe17f48-8ed7-474c-9594-7005a63cb2e6'
	option	enabled	'1'

config 'mount'
	option	target	'/mnt/downloads'
	option	uuid	'6e1ee0ef-3a57-4dfb-a73e-96094d85775d'
	option	enabled	'1'

Seems mount_root does only mount your lower rootfs (internal flash) from your overlayfs and not your extroot fs as upper overlayfs.
Mount your overlayfs manually at /mnt and modify your config optios from there.

For example:

mount $(findfs UUID=dbe17f48-8ed7-474c-9594-7005a63cb2e6) /mnt

Can't run this cmd as findfs: not found. Any other way to find the /dev/ file?
I can see that /overlay/upper is loaded:

root@(none):/dev# cd /overlay/
root@(none):/overlay# ls -l
drwxr-xr-x   12 root     root             0 Jan  1 00:08 upper
drwxr-xr-x    3 root     root             0 Jan  1 00:00 work
root@(none):/overlay# ls -l upper/
drwxr-xr-x   14 root     root             0 Oct 18  2017 etc
drwxr-xr-x    3 root     root             0 Oct 18  2017 lib
drwxr-xr-x    3 root     root             0 Jul 10  2018 mnt
drwxr-xr-x    2 root     root             0 Jun 30  2018 sbin
drwxr-xr-x    4 root     root             0 Oct 18  2017 usr
root@(none):/overlay# ls -l upper/etc
-rw-r--r--    1 root     root           516 Jun 29  2018 board.json
drwxr-xr-x    2 root     root             0 Jan  1 00:00 config
-rw-r--r--    1 root     root          1368 Oct 17  2017 dnsmasq.conf
drwxr-xr-x    2 root     root             0 Jan  1 00:00 dropbear
-rw-r--r--    1 root     root             0 Jun 29  2018 ethers
-rw-r--r--    1 root     root           352 Oct 17  2017 firewall.user
-rw-r--r--    1 root     root           145 Oct 17  2017 group
-rw-r--r--    1 root     root           110 Oct 17  2017 hosts
drwxr-xr-x    3 root     root             0 Jun 30  2018 hotplug.d
drwxr-xr-x    2 root     root             0 Jun 30  2018 init.d
-rw-r--r--    1 root     root           106 Oct 17  2017 inittab
drwxr-xr-x    2 root     root             0 Jan  1 00:00 iproute2
drwxr-xr-x    2 root     root             0 Jan  1 00:00 luci-uploads
drwxr-xr-x    2 root     root             0 Aug 21  2018 modules-boot.d
drwxr-xr-x    2 root     root             0 Aug 21  2018 modules.d
drwxr-xr-x    3 root     root             0 Jan  1 00:00 opkg
-rw-r--r--    1 root     root           110 Oct 17  2017 opkg.conf
-rw-r--r--    1 root     root           244 Jun 29  2018 passwd
-rw-r--r--    1 root     root          1461 Oct 17  2017 profile
-rw-r--r--    1 root     root          2541 Oct 17  2017 protocols
drwxr-xr-x    2 root     root             0 Jul  6  2018 rc.d
-rw-r--r--    1 root     root           132 Oct 17  2017 rc.local
-rw-r--r--    1 root     root          3017 Oct 17  2017 services
-rw-------    1 root     root           178 Jun 29  2018 shadow
-rw-r--r--    1 root     root             9 Oct 17  2017 shells
-rw-r--r--    1 root     root           896 Oct 17  2017 sysctl.conf
drwxr-xr-x    2 root     root             0 Jan  1 00:00 sysctl.d
-rw-r--r--    1 root     root           128 Oct 17  2017 sysupgrade.conf
drwxr-xr-x    2 root     root             0 Jun 30  2018 uci-defaults
-rw-------    1 root     root           512 Jun 30  2018 urandom.seed
root@(none):/overlay#

Sorry for confusion... Your read-only lower rootfs is always the same from flash and the upper rootfs is also on your flash by default. With extroot you move your upper rootfs to a usb stick or something else, your old upper from flash will stay untuched after booting with extroot and a boot without your usb stick or mount_root uses your old upper rootfs from internal flash.

Try to find your overlay partition manually in /dev/sdX[1-9], mount it without findfs and fix your config...

Good luck

1 Like

Since you made that in the GUI, chances are little that you did something that's drastically problematic. My best guess would be that you either set the IP to some other IP or you set it to DHCP client. I would suggest you follow @vgaetera advice and see if the PC gets an IP from the router, check for the default gateway IP and that should be the router's IP.

If otherwise the PC gets no IP form the router then you likely have set the LAN IP on the router to DHCP client. Easiest solution in this case is to connect both the router and the PC to another router, access you OpenWrt router and set its LAN IP back to static.

1 Like

I think if you boot the device with the external drive unplugged you end up running the config from the internal overlay (192.168.5.1) and also have the filesystem drivers loaded. You can then plug in the drive and manually mount it and make changes to the external overlay configuration which is broken.

An alternative would be to mount the drive on another machine and locate the files in drive_root/overlay/upper/etc/config.

2 Likes