Whats the reason then, to keep the no-IPV6 option for packages in menuconfig ?
I even see lot of packages, capable of being built with something like noIPv6, to save code. Which makes sense for low RAM devices.
Can be even considered a good security feature :-): Better to build a new image, with new kernel, new packages, for a low-RAM device, than to keep old openwrt, because new one too large.
I.e. new mwan3 Makefile allows noIPv6, but can not be enabled. Causing start of redundant processes to monitor IPv6 connections, which will never show up.
Anyway, the option in menuconfig allows disabling IPV6 for packages. So kernel modules still to be built incl. IPv6 support, if required. But it looks like, both ipv6 options for kernel and packages disabled. Should be called a bug, or not ?
It was already discussed last March in the developer mailing list if the option should be dropped. But that was not wanted to be done before the 22.03 branching. So 22.03 still has that option (but it is problematic).
Disabling IPv6 functions and services, rather than trying to remove kernel modules and packages, is probably a better approach. I expect you will find you have missed a bunch of things, if you are looking to do more than simply disable the dhcp ipv6 lease assignment on your lan interface.
You are just asking for errors in logs related to missing things expected to be there by trying to strip out libraries and kernel modules related to ipv6 that packages generally depend on to build properly, whether they use the ipv6 features or not.
One starting point is to turn off ipv6 defaults in the kernel, by dropping sysctl directives, much the same as you would on any linux based device and then to tell uci to turn off ipv6 related services that you do not want running.
Direct the kernel how you would like it to startup:
Next, direct UCI on various IPv6 settings and services you would like to disable or remove
uci set network.wan.ipv6='0'
uci set network.lan.ipv6='0'
uci set network.wan6.auto='0'
uci set network.loopback.ipv6='0'
uci delete network.lan.ip6assign
uci set network.lan.delegate='0'
uci delete network.globals.ula_prefix
uci commit network
uci set dhcp.lan.dhcpv6='disable'
uci set dhcp.lan.ra='disable'
uci commit dhcp
A quick ip addr on the CLI will tell you how your interfaces are setup, and should exclude any IPv6 network configuration. You might have other interfaces that may need to be considered.
A quick check of logread will help to confirm if any remaining services might be a bit noisy or slow to start due to the disabled ipv6 leading to any further configuration as determined by whatever packages you have installed.
That is the basic approach, what you wrote. However, there are packages, really using the option of --noIPv6 during compile time. A very good example is mwan3. There is quite a lot of RAM used for supervising and tracking possible IPv6 connections, which will never show up when using your system options, in case, mwan3 built incl. IPv6. But now impossible to build without. Unless doing extensive patching of Makefile(s), which is a bit too far fetched.