Thanks for your answer. I would like to ask you some things about packages.
I read on the forum that if i upgrade a packages, it always use more space (in particular if the packages was installed in the firmware and not by the user), is this true?
So what is the best thing to do with packages?
Compile firmware with all the packages that i need, or compile with only base packages and install them later with opkg or luci? Does packages installed in firmware uses less space than when installed with opkg?
But installing packages firmware means that i shouldn't update them if i don't want to loose space.
So if I want to update some packages the best way is to do a sysupgrade (upgrade the packages in the firmware)? If I do a sysupgrade do I loose all my files in /root and /usr/bin folder (for example some sh script I have written)?
Is it better to use openwrt firmware selector and specify the packages or build custom images?
I understand that packages installed through image build use less space than installed through opkg thanks to compression of rootfs. But i have read this:
Many devices are limited in storage capacity and there is no guarantee that the build system will detect when you have added too many packages to fit into the device storage space, which may render the device unbootable if installed. If in doubt, do not go overboard. Use what you had installed on the device last as a guide or create a minimal image first, install it to the device and test what you would like to add first.
So how can i know how many packages can i install with image builder without making my device unbootable?
it's a compressed file system. you can't be 100% sure.
it all comes down to the compression ratio on each file. but if you can install them post flash, they'll be installable mid flash too.
firmwareselector should fail to build an image, if your package list is larger than the available flash space.
Especially, but not necessarily only, older devices (10++ years in particular) did not always have maximum images size correctly defined (and there were also semi-generic images covering a variety of -e.g. bcm47xx- devices, with varying specs).
Even today, not all practical limits might have been identified for all devices. This (kind of-) regularly happens when newer kernels suddenly grow beyond the limits given by SOC and bootloader, but can also apply to the maximum image- or rootfs size (e.g. xiaomi ax3600/ ax9000 have limits < free flash space) and the free RAM available also puts a limited on the maximum image size flashable.
So... it's complicated...
Don't go too wild, especially if your device doesn't have mature means of recovery.
Someone will always be the first to notice...
So if I create a build with more packages installed, I will have more large /rom partition and smaller /overlay, is this correct? But the packages installed in /rom will use less space thanks to compression.
Right now I see 100% usage (9Mb usage) in /rom and 10.3Mb free space in /overlay. So if I install more packages in the build image I will have larger /rom (for example 15Mb usage) and smaller /overlay.
If i install all the package i need in the image, then when i want to update some packages, i have to build a new image and do a sysupgrade every time. Does sysupgrade keep my interface, firewall settings and files that i have create in /root folder?
the package for a stable release should never update.
doesn't matter if you generate a new image.
if they were, you're kind of risking the same scenario as in the link I posted earlier.
yes, it'll keep all settings if you tell it not to reset the device config.
there's a file called /etc/sysupgrade.conf where you can list all non default files the upgrade process should keep, but I'm not sure if it works for files and folders outside of /etc.
I try to explain me better. I had iperf3 3.15 installed in my image. Then I have found in opkg update that a new version has been released, so i update with opkg upgrade to 3.16 version. I know understand that i shouldn’t have done it. If i understand correctly, i know have two iperf package, because the one in read only partition can’t be upgrade, so opkg installed entirely a new one.
So i was thinking that If I make a custom build image I can install new iperf version 3.16 directly in the image, right?