Openwrt rc.local: Read-only issue

To add into psherman's explanation, you can only really delete stuff that exists in /overlay/upper directory. Those are the files & packages that you have added after flashing the image.

E.g. in my own overlay there are only a few settings, stats backup etc.
There are 7.3 MB files in RO /rom , and only 0.2 MB in RW /overlay, and only those 0.2 MB would be deletable.

root@router1:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 7.3M      7.3M         0 100% /rom
tmpfs                   232.4M   1004.0K    231.4M   0% /tmp
/dev/ubi0_1              75.1M    240.0K     71.0M   0% /overlay
overlayfs:/overlay       75.1M    240.0K     71.0M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev

root@router1:~# du -d 2 /overlay/upper/
52      /overlay/upper/etc/opkg
12      /overlay/upper/etc/dropbear
0       /overlay/upper/etc/luci-uploads
4       /overlay/upper/etc/adblock
152     /overlay/upper/etc/backup.stats
0       /overlay/upper/etc/uci-defaults
104     /overlay/upper/etc/config
388     /overlay/upper/etc
24      /overlay/upper/lib/firmware
24      /overlay/upper/lib
0       /overlay/upper/mnt/mtdblock6
0       /overlay/upper/mnt
4       /overlay/upper/usr/libexec
4       /overlay/upper/usr
416     /overlay/upper/
2 Likes

i have

root@LEDE:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M    460.0K     13.3M   3% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    260.0K    252.0K  51% /overlay
overlayfs:/overlay      512.0K    260.0K    252.0K  51% /

how i can delete some files here?

i can not go to /overlay directory directly (as the dev/mtdblock3)

root@LEDE:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M    460.0K     13.3M   3% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    260.0K    252.0K  51% /overlay
overlayfs:/overlay      512.0K    260.0K    252.0K  51% /
root@LEDE:~# cd /dev/mtdblock3
-ash: cd: can't cd to /dev/mtdblock3
root@LEDE:~# cd /overlay
root@LEDE:/overlay# ls
upper  work
root@LEDE:/overlay# rm upper
rm: 'upper' is a directory
root@LEDE:/overlay# rm -rf upper
root@LEDE:/overlay# ls
work
root@LEDE:/overlay# rm -rf work
root@LEDE:/overlay# ls
root@LEDE:/overlay# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M    460.0K     13.3M   3% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    264.0K    248.0K  52% /overlay
overlayfs:/overlay      512.0K    264.0K    248.0K  52% /
root@LEDE:/overlay# 

why i become no more place at /overlay ? i have delete all directories in...

Normally. Like I said a few mesages ago.

cd /overlay/upper
rm something...

i have try this

root@LEDE:~# cd /overlay/upper
-ash: cd: can't cd to /overlay/upper

Have you already rebooted?
(Like I said above)

Reboot should allow overlayfs to notice that there no files any more in /overlay

yes i have rebooted

after deleting and reboot

root@LEDE:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M     76.0K     13.7M   1% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    240.0K    272.0K  47% /overlay
overlayfs:/overlay      512.0K    240.0K    272.0K  47% /
root@LEDE:~# 

what i do wrong?

root@LEDE:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M     76.0K     13.7M   1% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    240.0K    272.0K  47% /overlay
overlayfs:/overlay      512.0K    240.0K    272.0K  47% /
root@LEDE:~# cd /overlay/upper
root@LEDE:/overlay/upper# ls
etc
root@LEDE:/overlay/upper# rm -rf etc
root@LEDE:/overlay/upper# ls
root@LEDE:/overlay/upper# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M     76.0K     13.7M   1% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    236.0K    276.0K  46% /overlay
overlayfs:/overlay      512.0K    236.0K    276.0K  46% /
root@LEDE:/overlay/upper# reboot
root@LEDE:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    13.8M     76.0K     13.7M   1% /tmp
tmpfs                    13.8M     48.0K     13.7M   0% /tmp/root
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock3          512.0K    252.0K    260.0K  49% /overlay
overlayfs:/overlay      512.0K    252.0K    260.0K  49% /

You might be better off simply resetting to defaults -- this will erase everything you have installed or stored on your router, and restore the basic configuration. Then you can see how much free space really exists.

make a backup before you reset so that you can at least restore the basic config files.