Cleaning Up Packages - Ran out of space while configuring a VPN

As title says, I was following this guide to configure a VPN on my router.

While installing the required packages, I ran out of space.

I was then following this guide to uninstall and remove the installed and partially installed packages.

I inspected some of the packages and they installed files in the /usr/lib directory which is a read-only directory. When I try to delete those files, it gave me an error saying that it cannot remove those files because they are read-only.

I had some question in regarding to cleaning them up:

  1. Can I delete these files using sudo without any problems although they are in a read-only directory?
  2. I have 8MB of space on my router. Is this enough to configure an OpenVPN service on it?
  3. Do I need to use Exroot to get more space?
  4. Are there any default packages that can be uninstalled to save space?

You need to understand that you can't delete any files from the firmware itself.

  • The firmware is read-only squashfs partition /rom
  • All your additions, changes, removals, configs go to read-write jffs2 overlay partition /overlay.

Normally you sees these combined as /rom + /overlay = / and you do not need to care about that at all.

But if you try to delete a files that was in the flashed firmware, you in reality only add a delete-marker to /overlay and the original file stays in /rom (and you consumed a few more bytes of flash space)

Old but still valid explanation:
https://wiki.openwrt.org/doc/techref/file_system

In general, 8 MB is rather little space. You probably can get things in if you cook your own firmware containing the packages as then the files get compressed.

I checked out the link and it has a pretty good explanation (thanks for that - although I still can't understand the diagrams very well). Correct me if I am wrong but what I understood from that is that I cannot brick the router by just deleting files using ssh because failsafe mode will always be available.

I am too much of a noob to cook my own firmware right now, and too afraid considering I bricked a router just trying to reinstall the original firmware.

Luckily, the VPN package is the only thing I need so hopefully everything fits in using that.

Question:
So why are the files that I just installed read-only? I am unable to delete them.

Pretty much so (as long as you know how to reach the failsafe :wink:

And you can even use "firstboot" command to easily wipe the whole /overlay and revert the router to a situation just like after a clean flash with just the default settings.

That safety and easy resettability is the beauty of the rom+overlay scheme

Probably they are meant to be protected from malicious scripts etc., so the package has installed them as read-only. Just "chmod" them to be writable. Basic Linux stuff.
(If they were installed by a package in the running, they can be modified)

Pretty cool!

Definitely not everyone's cup of tea though. I can see a lot of non-technical people just walk away from this in an instant.

UPDATE:
chmodding them doesn't work either:

chmod -R u+w ssl/certs/
chmod: ssl/certs/: Read-only file system
chmod: ssl/certs/: Read-only file system

I may just do a firstboot.

UPDATE 2:
Did a firstboot and realize I have 60+ MB of space actually. The below URL guide is terribly space inefficient.

https://lede-project.org/docs/user-guide/openvpn.client

The jffs does not recover gracefully after being overfilled. It is almost imperative to firstboot it and start over.

Thanks! That's what I went with.

Any good guides there to configure a VPN on the router?

@openwrt_newbie999, In general, if you are not aware, you should also consult the OpenWrt wiki pages. There is a lot of material there, albeit older, that is of value.
https://wiki.openwrt.org/start

Without having to create a new topic, thought I'd just ask here.

Was playing around with the settings and wanted to wipe them again so I did a soft reset. Surprisingly, my password remained the same and the previously installed packages did not get removed either. So I tried again, same result.

Then I did a hard reset, again the same result.

Any idea what is going on?

It did give me this message after I confirmed the wipe, if that helps:

/dev/mtdblock3 is not mounted
/dev/mtdblock3 will be erased on next mount

This is what the df command gives me:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2560      2560         0 100% /rom
tmpfs                    62820       588     62232   1% /tmp
tmpfs                    62820        52     62768   0% /tmp/root
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3            2176      1912       264  88% /overlay
overlayfs:/overlay        2176      1912       264  88% /

Seems like /dev/mtdblock3 is not being wiped.

How can I wipe it?

  • When you say "soft reset," you're referring to Failsafe, Firstboot or an erase holding the reset button, correct?
  • You can always flash over the firmware if you're still having difficulty, making sure to uncheck "Keep Current Settings"

By soft reset I mean that I sshed into 192.168.1.1 and performed:

umount /overlay && firstboot && reboot

But did not seem to work to erase my passwords / previously installed packages.

I solved this by going to 'System > Backup / Flash Firmware > Perform reset'. Now it reset my password and I have my space back.

However, just to help me understand, could you explain why the previous ssh command did not work for the reset? It worked the first time and then stopped working after that.

That works too...

Good question...not sure. I do know '&&' only works if the previous command completed "successfully" (perhaps because /overlay was already mounted). But...if you were booted normally into LEDE, all you needed to run was firstboot then reboot, since the proper devices were already mounted.

Okay, I'm trying to access mine too:

root@OpenWrt:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2048      2048         0 100% /rom
tmpfs                    13584        76     13508   1% /tmp
/dev/mtdblock5             320       304        16  95% /overlay
overlayfs:/overlay         320       304        16  95% /
tmpfs                      512         0       512   0% /dev

I've been pretty frustrated with it so far.

That looks like a 4MB flash chip. There is very little space left in those. Custom builds with the packages you want and some of the standard ones omitted may be necessary.

1 Like

Then you should think of buying a device with sufficient flash MB.
Once you have 8MB or more to work with, all your troubles with too little space will be gone. $20 well spent.

1 Like

I have the same exact device with luci_git-15.363.78009-956be55 installed and it works fine - What I did was 'updated' to openwrt from the D-Link software/gui, had problems, was able to get into busybox, and so on.
What I think I might want to look at is to flash it somehow, but I do not know how to do that.

3 posts were split to a new topic: 16MB flash size, but only ~3.30MB free

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