How to make the read only file system writable on BusyBox

busybox

I want to change some files on my router. Firstly I can change everything in /var, but I want to change /etc/fstab. When I try to change it, I get an error message that says the file system is read only.

BusyBox inside the router has limited commands, so I got a BusyBox binary for MIPs, and uploaded it by tftp:

tftp -g -r busybox-mips my.i.p.addr

I can now use full commands (/var/tmp/busybox-mips command).

There is no ROM inside the router (SDRAM), nor is there any other partition. It must be related with BusyBox.

# /var/tmp/busybox-mips df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 1344      1344         0 100% /

# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
proc on /proc type proc (rw,nodiratime)
ramfs on /var type ramfs (rw)
# 

Model: 
        Airties 5021
Processor:
        BCM6332KFBG
        HS1037 P12
        994981 N1
Memory: 
        M12L64164A-7T (SDRAM)
        ANM1P02HL 1028

Best Answer

Squashfs is immutable. To change /etc/fstab you would need to make a new FS image for your router on a linux box. To get that on the router you do a "firmware upgrade".

You could also look in /proc/mounts to check whether mount is lying to you, as it only reads /etc/mtab. But the latter is in most distros a symbolic link.

Related Question