How to free some flash memory

Hello,
I use a router TP-LINK TD-W8970 with 20% (584 KB) left for new packages.I'll have to install new packages and need to free some space.
The config is router without DSL nor ATM. Internet is from interface eth0.2, lan is to interface eth0.1/wlan0
Is it possible to remove/uninstall some packages, ie:

  • dsl-vrx200-firmware-xdsl-a
  • dsl-vrx200-firmware-xdsl-b-patch
  • kmod-atm
  • kmod-ltq-atm-vr9
  • kmod-ltq-vdsl-vr9
  • kmod-ltq-vdsl-vr9-mei
  • kmod-ppp
  • kmod-pppoa
  • kmod-pppoe
  • kmod-pppox
  • linux-atm
  • ltq-vdsl-app
  • ppp
  • ppp-mod-pppoa
  • ppp-mod-pppoe

Thanks

No, packages in the ROM will always consume flash, even if they are deleted. Deleting them just "puts Wite-out over them" to hide them. If anything it lightly reduces the free space.

You need to build your own image to reduce the flash consumption. It will also help with the ones you add to the ROM, as they are compressed in a ROM image, but not when installed in /overlay.

https://openwrt.org/playground/faq/which_packages_can_i_safely_remove_to_save_space

https://openwrt.org/docs/guide-developer/build-system/start

1 Like

https://openwrt.org/docs/guide-user/additional-software/saving_space
https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

1 Like

Thank you for your answers.
This not easy to do, need to install (not so hard, I run OpenSuse) and learn how to build my own image. Moreover this is my only router, so no Internet, no Lan, no phone while flashing the firmware, with a chance to break all.
I think I should try to find and set an old router on my shelf before playing with firmware.
BTW, the page "save space" is good to know but nothing about ACTION: remove ATM, remove DSL, remove VDSL, more?
What about kmod-pppoe in action remove pppoe?

You might save a couple kB in removing modules from the image. You're likely to have more benefit from building or assembling your own images with either the full build chain or the image builder. The packages that you add to the ROM remain compressed, and take up very roughly half of what they would if installed after flashing. As long as you've got three "erase blocks" free after you build the ROM (3 * 64 kB ~ 200 kB, as I recall), then you should be able to run the device and have it save config.

Yes, it can be "challenging" to resolve Internet issues without the Internet available! If you've got another device that can run OpenWrt, that might be a good way to get comfortable with the process. Knowing how to get the device into TFTP mode (and downloading a "release" version for TFTP that you can use), assuming it supports it, is a good thing to check before flashing your custom-built images. That way you can recover to a "known-good" image if you have to. A 3.3 V serial adapter is a good idea, but not essential for a device that supports TFTP in the boot loader.

How much do you need?

I don't know exactly but I don't want to be stuck when I install the packages.
I plan to install what needed for usb printer sharing, samba

I tried to install sane for my scanner following the howto.
I installed few package and had the error message Can't open status file //usr/lib/opkg/status: No space left on device..
So I need to build my own image.
Before staring reading the doc,
1- Could you tell me if it's possible with Imagebuilder to get the full list of packages that are in the ready to go image available to download and remove step by step what I don't need? Where to find this list?
2- How to get the list of packages I installed in the overlay after firmware upgrade?

See posts above for links about what others have found possible to remove.

I think that installing the packages you need into ROM, rather than post facto onto flash may be sufficient. Certainly worth trying before spending a lot of time removing "stock" packages. Note that ROM packages are compressed, so the size shown in ls or the like won't be the amount of flash recovered (or consumed, if added), but very roughly half of the shown size.

The manifest for an image shows what packages have been installed, such as http://downloads.openwrt.org/releases/18.06.1/targets/lantiq/xrx200/openwrt-18.06.1-lantiq-xrx200.manifest

opkg list-installed will show everything installed on the device. There are some suggestions for scripts that show only post-facto installed packages at Script to list installed packages? (for simplifying sysupgrade)