How to mount pen-drive in failsafe mode?

Hi,

I am trying to read an pen-drive that was formated on another OpenWRT router with overlay, in failsafe mode withou success.

I tryed to mount it in normal mode and all works well but when in failsafe I can't.

In normal boot without the pen-drive thera are no /dev/sd*. Imediately I inserted teh pen-drive and a new ls /dev/sd* shows the partition of sd*.

When I do exactly the same in falsafe mode (without pen-drive and then inserting it) no /dev/sd* apears. Why? How can I load the /sd* partitions?

Thanks in advance.
carliedu

failsafe doesn't load optional kernel modules, in other words it skips loading /etc/modules.d/ - you will have to load the required ones manually.

In failsafe mode, the kmods necessary to access the drive will not be loaded, unless they were built into the base image. Release builds are not so built, you have to install the kmods separately. Those end up in the overlay filesystem which is intentionally not mounted for failsafe.

You would have to mount_root to obtain access to the installed packages, then load the kmods manually.

Thanks slh.
mk24 wrote the same and I will try to load it manualy.
Best
carliedu

Thanks mk24,
so, I understood that it isn't loaded in failsafe, but I can do it manualy if i install the package kmods in normal mode first. Then in failsafe again, after mount_root, I can load kmods manually.
I will try it out tomorrow.
Best,
carliedu

If you just need to copy some files off of the drive I would suggest mounting it on a PC with a live Linux disk.

Yes, it would be a possibility but what I'm looking for is to recover from bad configuration changes that blocks the access to the router. This happened so many times for me that I'm studing a fast way to correct the error.

So guys. Finaly I found the solution for my problem:

PROBLEM:
I have an router with only 4 MB flash size with an USB socket. I need more space. So I take an 1 GB pen-drive and install it (see: http://www.brendangrainger.com/entries/13).
All works fine until I make a wrong configuration and the router could not boot again or the access to the router was blocked with a wronf firewall configuration.
This happened so many times for me :hot_face:. How to correct the error without having to make a clean install and restore the last good configuration (if I have a backup).
I tried to boot in failsafe mode and tried to mount the pen-drive in failsafe to correct the configuration. It took me a long time studying how the boot process works and how to mount the pen-drive again with the fstab that haven't (in failsafe) the pen-drive configuration. With help in this forum I realised that it would be dificult if I had not installed some packages before the problem occurs. In failsafe mode the boot do not load optional kernel modules.

SOLUTION:
After a good night's sleep, "dreaming" with openwrt, I found out that the solution is simple, but it was not resolved.

I will post it again when I complete it.

Best,
carliedu
Brazil-Sao Paulo

So now I am sure that my solution works. I tested it out from beginning to end.

PROBLEM:

I have an router with only 4 MB flash size with an USB socket. I need more space. So I take an 1 GB pen-drive and install it (see: http://www.brendangrainger.com/entries/13).

All works fine until I make a wrong configuration and the router could not boot again or the access to the router was blocked with a wronf firewall configuration.

This happened so many times for me :hot_face:. How to correct the error without having to make a clean install and restore the last good configuration (if I have a backup).

I tried to boot in failsafe mode and tried to mount the pen-drive in failsafe to correct the configuration. It took me a long time studying how the boot process works and how to mount the pen-drive again with the fstab that haven't (in failsafe) the pen-drive configuration. With help in this forum I realised that it would be dificult if I had not installed some packages before the problem occurs. In failsafe mode the boot do not load optional kernel modules.

SOLUTION:

After a good night's sleep, "dreaming" with openwrt, I found out that the solution is much simpler than I was trying. Failsafe is not necessary to recover from a missconfiguration made on a pendrive.

• Shut down the router
• Remove the Pen-drive (where the wrong configuration do not let the router boot or be accessed)
• Boot the router in normal mode without the pen-drive until you can access it by ssh
• Connect the pen-drive to the USB port
mount -t ext4 /dev/sda2 /mnt/usbdrive (adapt this line to your configuration)
• Edit the wrong config file(s) (that are on /mnt/usbdrive ) and make the correction(s):
vi /mnt/usbdrive/upper/etc/config/xxxxx (xxxxx is the file with wrong configuration)
• Do not forget to return the fstab setting
mv /etc/config/fstab /etc/config/fstab_old
cp /mnt/usbdrive/upper/etc/config/fstab /etc/config/fstab
• reboot

So simple and I lost so much time.

I hope this helps another users with the same problem.

PS.: this text can be used in wiki.

Best,

carliedu

Brazil-Sao Paulo

1 Like

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