OpenWrt Forum Archive

Topic: FailSafe - Can't do Overlay Remove

The content of this topic has been archived on 13 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

Recently installed openwrt to my AP -not modem- and while tinkering with it -to get it connected internet via my PC, I started doing some experiments on etc/config/network.

Used WinSCP and backed up original config file as a tar file. Then rebooted and unfortunately I can't connect afterwards.

So I followed failsafe instructions and -I guess- I succeeded in that for some bits, but then I realized that I can't restore my config sets to back to open wrt originals.

Can you help me with this?
--



This dump below should give a better explanation of my attempts: (this is copied from telnet after FailSafe boot)


=== IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
------------------------------------------


BusyBox v1.19.3 (2012-03-09 18:37:39 MST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
ATTITUDE ADJUSTMENT (bleeding edge, r30857) ----------
  * 1/4 oz Vodka      Pour all ingredients into mixing
  * 1/4 oz Gin        tin with ice, strain into glass.
  * 1/4 oz Amaretto
  * 1/4 oz Triple sec
  * 1/4 oz Peach schnapps
  * 1/4 oz Sour mix
  * 1 splash Cranberry juice
-----------------------------------------------------
root@(none): /# mount_root
Unlocking rootfs ...

root@(none): /# rm -r /overlay/*
rm: can't remove '/overlay/*': No such file or directory
root@(none): /# rm -r /overlay/
root@(none): /# rm -r /overlay
rm: can't remove '/overlay': No such file or directory
root@(none): /# rm -r /overlay/
rm: can't remove '/overlay': No such file or directory
root@(none): /# rm -r /overlay/
rm: can't remove '/overlay': No such file or directory

root@(none): /# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root

root@(none): /# rm -r /overlay
rm: can't remove '/overlay': No such file or directory
root@(none): /# rm -r /overlay/
rm: can't remove '/overlay': No such file or directory

root@(none): /# dir
/bin/ash: dir: not found

root@(none): /# echo *
bin dev etc lib mnt proc rom root sbin sys tmp usr var www

root@(none): /# cd etc
root@(none): /etc# cd config
root@(none): /etc/config# echo *
archive.tgz dhcp dropbear firewall network system ubootenv wireless

root@(none): /etc/config# reboot -f


Connection to host lost.

(Last edited by katlivacib on 14 Mar 2012, 09:07)

Are you using SquashFS ?

To list files and directories (folders), use "ls"

Hi,

using the other one - JFss or sth.

Btw thx for advice on echo and ls. But does it have something to do with my prob?

(Last edited by katlivacib on 14 Mar 2012, 08:43)

if you use a jffs2-image, than you don't have an overlay partition, you have just one rootfs and the only way to get back to the initial-state of the routers config is to reflash the router. Using jffs2-rootfs also means no failsafe, so I'm curious how you managed to get into failsafe-mode.

btw. normally it's always better to use squashfs as rootfs, you get a better compression-rate on the fs, failsafe-mode, and the fs-overlay is fully transparent so no problems with this either.

eleon216 wrote:

if you use a jffs2-image, than you don't have an overlay partition, you have just one rootfs and the only way to get back to the initial-state of the routers config is to reflash the router. Using jffs2-rootfs also means no failsafe, so I'm curious how you managed to get into failsafe-mode.

btw. normally it's always better to use squashfs as rootfs, you get a better compression-rate on the fs, failsafe-mode, and the fs-overlay is fully transparent so no problems with this either.

So I guess I need to reflash using squashfs via FailSafe mode. Unfortunately, I don't know how.

Because after failsafe mode,  I can only telnet. After setting passwd, I need to reboot to open SSH & SCP connection. Which is my problem, can't remove old config.

But I'm thinking of extracting that tgz file (See my first post, bold text) via backup archive.tgz I made, IF I CAN DO THIS via TELNET?

(Last edited by katlivacib on 14 Mar 2012, 10:29)

katlivacib wrote:

But I'm thinking of extracting that tgz file (See my first post, bold text) via backup archive.tgz I made, IF I CAN DO THIS via TELNET?

Telnet and SSH connections should have no difference regarding write rights etc.
If you have telnet access, either extract those old settings from that tgz file or alternatively use an editor (nano, vi, whatever you have installed) to edit the main network config files like /etc/config/network. You should be able to check the default contents from Openwrt source code and then edit the file manually to be identical with that.

Ps. Setting the password is not mandatory. It you have telnet access, do not set password, but use telnet to modify the settings.

Pps. I think you have not mentioned your device, so far. Knowing which device you have might enable others to give to device-specific advice.

(Last edited by hnyman on 14 Mar 2012, 11:11)

depends on your hardware, but maybe you can flash a new image mit tftp from the bootloader (without dealing with the serial).
if you can telnet to the router you can use wget on the router to download a firmware-image over http or ftp to /tmp/, and than flash with "sysupgrade -n <firmwarefile>"
Check TOH to find the possible options for your device.

(Last edited by eleon216 on 14 Mar 2012, 11:08)

hnyman wrote:
katlivacib wrote:

But I'm thinking of extracting that tgz file (See my first post, bold text) via backup archive.tgz I made, IF I CAN DO THIS via TELNET?

Telnet and SSH connections should have no difference regarding write rights etc.
If you have telnet access, either extract those old settings from that tgz file or alternatively use an editor (nano, vi, whatever you have installed) to edit the main network config files like /etc/config/network. You should be able to check the default contents from Openwrt source code and then edit the file manually to be identical with that.

Ps. Setting the password
is not mandatory. It you have telnet access, do not set password, but use telnet to modify the settings.

Pps. I think you have not mentioned your device, so far. Knowing which device you have might enable others to give to device-specific advice.

This is a real encouraging reply. Thank you for that.

Yeah, I ignored to mention my HW inorder to avoid potential "can't do that" "won't do that" "not possible" replies. But from this point I see no conflicts or blocking thoughts about getting help.

My device is, http://wiki.openwrt.org/toh/tp-link/tl-wa701nd (but 1.1 hw revision)

I'm at work now,  so I can't access device for at least 5 hours from now on.

I'm gonna try doing "tar -xf archive.tgz" on etc/network/config.

If that fails, can you tell me a way to pull both these files via telnet? I'm a better android user than a pc-Linux one. So I guess someway of pulling is possible but I don't know if telnet supports file transfers or not.

And I have another request,
Let me remind you with highlights of the file structure I'm dealing with:

archive.tgz dhcp dropbear firewall network system ubootenv wireless

This folder has two files worth mentioning to aid my explanation:
1st file: archive.tgz contains network config-file revision before my last & almost brutal commit.
2nd file: network is the corrupt-ish active config-file.

I think I may also need pure openwrt network config beforehand. Which I don't have. My archive.tgz is only the latest save (It should be a working one).

Any one or any way I can get only this file in its pure form?

Here below is the full story of the reason I started this thread smile

Installed latest JFSS2 image from trunk via Web interface of TP-Link.
Then I wanted Luci to setup repeater-mode more easily via web interface.

To install Luci on my router, the router must be connected to internet.

Therefore, I was experimenting on this file to accept internet of my Windows-running PC (connects internet via WiFi). I adjusted it to use dhcp, deleted IP row from it. Then I enabled Internet Connection Sharing on windows machine to provide necessary settings to router.

And you can see that these attempts doesn't work out.

(Last edited by katlivacib on 14 Mar 2012, 12:26)

eleon216 wrote:

depends on your hardware, but maybe you can flash a new image mit tftp from the bootloader (without dealing with the serial).
if you can telnet to the router you can use wget on the router to download a firmware-image over http or ftp to /tmp/, and than flash with "sysupgrade -n <firmwarefile>"
Check TOH to find the possible options for your device.

FTP enabled on failsafe mode? In this mode, device is only telnet-able afaik. Please correct me if I'm wrong.

katlivacib wrote:

My device is, http://wiki.openwrt.org/toh/tp-link/tl-wa701nd (but 1.1 hw revision)

Ok. It is an ar71xx based device, so that is the correct source branch to look for solutions:
https://dev.openwrt.org/browser/trunk/t … nux/ar71xx

Based on default config generation, you might try to generate new default /etc/config/network with this:
1) login with telnet
2) cd /etc/config
3) mv network network.faulty
4) /etc/uci-defaults/network

That should generate a new default /etc/config/network for you
https://dev.openwrt.org/browser/trunk/t … ts/network

If that works, you can then probably continue fixing other settings & flashing the new version.

hnyman wrote:

4) /etc/uci-defaults/network

Hi, maybe it need be (in my case I have a jffs overlay working):
 

/rom/etc/uci-defaults/network

At least, over a nomal SSH console that I test it smile (and it only work after 3, it no network file present).
However, the best is type "df" before and see all mounted file systems. Regards.

(Last edited by almursi on 14 Mar 2012, 14:00)

Update: None of the above worked except for using vi hmm

Here is the log,


root@(none):/# cd /etc/uci-defaults
root@(none):/etc/uci-defaults# ls
root@(none):/etc/uci-defaults#
root@(none):/etc/uci-defaults# cd /rom/etc/
/bin/ash: cd: can't cd to /rom/etc/
root@(none):/etc/uci-defaults# cd /rom
root@(none):/rom# ls
note
root@(none):/rom# etc/uci-defaults/network
/bin/ash: etc/uci-defaults/network: not found
root@(none):/rom# /rom/etc/uci-defaults/network
/bin/ash: /rom/etc/uci-defaults/network: not found
root@(none):/rom# cd /etc/config
root@(none):/etc/config# ls
archive.tgz  dropbear     network.modif      ubootenv     yetwork
dhcp         firewall     system       wireless
root@(none):/etc/config# vi yetwork

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

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'dhcp'
        option netmask '255.255.255.0'
        option dns '8.8.8.8'


config 'interface' 'example'
        option 'proto'   'dhcp'
        option 'ifname'  'eth0'
        option 'gateway' '0.0.0.0'
~
~
~
~
root@(none):/etc/config# vi network.modif






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

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option netmask '255.255.255.0'
        option dns '8.8.8.8'
        option ipaddr '192.168.1.250'
        option gateway '192.168.1.1'




root@(none):/etc/config# cd /etc/config
root@(none):/etc/config# tar -xf archive.tgz
tar: short read
root@(none):/etc/config# mv network.modif network
root@(none):reboot -f
--

network.modif is modified network file I happen to make the device work.

Now the device is working.  But I still can't make it access internet via my pc.

(Last edited by katlivacib on 15 Mar 2012, 21:28)

The discussion might have continued from here.