Should OpenWrt/LEDE support devices with only 4MB Flash?

So here's the deal. LEDE is very limited in terms of developers hence there's not an option or value to deviate too much from upstream whether we like it or not unless we want to create some strange fork that's going to be a pain to maintain. The Linux kernel is growing, so are stock libs and applications. Work is being done to slim these down by default but again, no one is going to rewrite half of the distro's software and there's little to no interest upstream to maintain 8y+ (usually) old devices while adding new ones. There's just too much overhead, code-rot etc by doing so which more or less translates into that "everything" has to fit the new "way"/code. Also, having the above in mind we want upstream support when it comes to kernel/software etc, there's not enough manpower to reinvent the wheel and having support for a lot of custom software is a pain.

If you want to use your low-end router you have to accept that the newest and latest software wont run. 386 systems isn't support at all these days, I doubt 486 systems runs very well/at all on a recent kernel. You don't see ppl complaining about that...

So here's the deal. LEDE is very limited in terms of developers hence there's
not an option or value to deviate too much from upstream whether we like it or
not unless we want to create some strange fork that's going to be a pain to
maintain. The Linux kernel is growing, so are stock libs and applications.
Work is being done to slim these down by default but again, no one is going to
rewrite half of the distro's software and there's little to no interest
upstream so maintain 8y+ (usually) old devices while adding new ones. There's
just too much overhead, code-rot etc by doing so which more or less translates
into that "everything" has to fit the new "way"/code. Also, having the above
in mind we want upstream support when it comes to kernel/software etc, there's
not enough manpower to reinvent the wheel and having support for a lot of
custom software is a pain.

Nobody here is disagreeing with the above statements.

If the software grows too big to run then the device can't be supported any
longer.

What we are objecting to is the rush by some people to abandon/delete support
for devices.

There are always options to consider, smaller/lighter versions of software to
consider using, ways to NOT use some software.

As a couple of examples LEDE does not use glibc or systemd, in large part
because of the size of those packages. According to some people in the Linux
world, those would not be reasonable options to consider and any hardware that
wasn't big enough to run them isn't big enough to support at all.

But in some cases, we do need to look at tweaking/re-writing software. For
example, if opkg is unable to run on 32M ram, even if 10M ram is available, then
it's probably appropriate to find out why and figure out other ways to get the
job done. My uninformed guess is that opkg does something along the lines of
enumerating possible packages in ram, and as the list of supported packages
grows, it eats more and more ram. Options like mmapped files or using disk files
instead of ram are options if this is the case.

Nobody is objecting to dropping support for devices when they can't be loaded
with a minimum build, and nobody is objecting to dropping pre-built images for
systems when the standard image will no longer fit.

We are objecting to the idea that "someday it won't fit, so let's drop support
now".

We are trying to suggest a path for graceful degredation of support over time.

Personally, I see support as a continum, something along the lines of

  1. best support, able to run the standard image and load significant amount of
    additional packages

  2. limited support, able to run the standard image, but not able to load much in
    the say of additional packages.

  3. minimal support, no longer able to run the standard image, but able to run a
    "hello world" minimal image, so still useful for people doing customized things.

it seems as if the 4/32 routers are in category 2 right now. The imagebuilder
tool seems to be the key to making good use of these devices.

But for those saying that we should abandon support for everything that can't
run LUCI + Samba, etc. I'll point out that the project is "Linux Embedded
Development Environment", not "Linux Access Point OS". The project is intended
to support devices beyond just APs. As long as the hardware is able to boot a
minimalist build, someone can make use of it.

David Lang

1 Like

I'm doing to say best effort without doing intrusive changes to upstream source. We can always speculate about using but history shows that there's much talk and little work in that regard and it's not always desirable for newer systems and it can introduce limitations. I think tmomas is very realistic and fully agree with this warning.

1 Like

Unless you're willing to change the mind of devs upstream that's pretty much a fact, no one is going to stop you from using an older checkout.

1 Like

this should be changed to "4MB devices may not be able to install a GUI (LuCI)"

This information is geared towards new users not experienced one

As OP on this topic, I apologize that I have out of the loop for a couple days.

Here are a couple thoughts about what I've read in the discussion:

  1. Development for 4/32 devices will certainly continue for a long time. The build system is in place, the rough edges have been worn down, and they'll be stable for the forseeable future. The developer community are likely not affected. If those 4/32 devices are working for you, then there's no value in "throwing them off the cliff".

  2. But... The "support community" (those of you reading this note, for example) really care about getting people to purchase the right device.

  3. I think it's our responsibility to help new people with recommendations and forum, and website. I think it's safe to recommend that newcomers, or people who "Just want a LEDE router that works without a lot of farbling around" should get a router with 8/64 or better to start.

  4. Despite the reluctance to recommend specific hardware in the LEDE community, there's room to tell people that any new purchase should be 8/64 or better.

  5. I like @tmomas' work with the warnings. There also needs to be a clear explanation on the Quick Start Guide

  6. I also appreciate that we're abiding by Rule #12. Things have got a little heated, but steered way clear of unpleasantness. Thanks!

Update: Fixed to say 8/64 everywhere.

1 Like

First of all, I'm not pretending to speak for the LEDE team, however looking at the plain numbers presents a quite obvious situation.

Taking "Why no images generated for default D-Link DIR-600A1?" as an example (yes, some other 4 MB flash devices are a bit better than this particular specimen, the trend remains to be the same though).

D-Link DIR-600A1:
Backfire 10.03..............: 2293764 bytes Backfire 10.03.1............: 2949124 bytes Attitude Adjustment 12.09...: 2883588 bytes Barrier Breaker 14.07.......: 3276804 bytes Chaos Calmer 15.05..........: 3342340 bytes Chaos Calmer 15.05.1........: 3407876 bytes LEDE 17.01 release branch...: 3473412 bytes absolute firmware size......: 3735576 bytes maximum usable firmware size: 3538944 bytes
(all of these figures are for release images, including luci and a more or less identical feature set).

The erase block size for this (and most other) devices is 64 KB, so you now end up with 256 KB (== 4 erase blocks) free space, compared to 320 KB (== 5 erase blocks before). While this may look comfortable at a first glance, you have to consider that free space can only be assigned in (full) block size chunks, so once you touch the overlay partition at all, you already have one erase block in use (64 KB). Therefore the firmware creation tools used by LEDE enforce at least 3 erase blocks reserve for the overlay filesystem (that's where the maximum usable firmware size comes from, compared to the total size of the firmware partition). In other words, with 17.01 you'll only have 1 erase block (64 KB) before the hard limit, while 15.05.1 still gave you 2 spare erase blocks (128 KB) for your own use. On top of this there is the file system overhead needed for formatting to jffs2 as well (jffs2 does some light compression, but its fs header and log (more or less directory entries) need some space, then there is the hard requirement to keep some free space (in erase block == 64 KB chunks) for the garbage collection to work) at all times, reducing the usable free space even further. Around 25 KB are used by the configuration overlay immediately after firstboot, before you actually get a chance to configure anything.

Assuming pure statistics, what will the situation be in 12 or 24 months[1]?

No one has yet raised the suggestion to actually remove the hardware support for affected devices from LEDE's source repository. If you look deeper, you can still find full support for the Linksys WRT-54GL (4 MB flash, 16 MB RAM) in the repo, although support for devices with just 16 MB RAM had already been discontinued with Attitude Adjustment 12.09 and despite the fact that actually building a working up-to-date firmware for this device today is quite challenging[2].

This thread merely serves as a reminder for 'normal users', who expect to download and flash LEDE under the expectation to use it as a full featured replacement for the vendor firmware (including a webinterface, luci). Also keep in mind that luci is enabled for release builds, which means that it either fits into the firmware image (with the mandatory safety margin of at least 3 erase blocks) or no release images can be created for the affected devices[3], [4]. In my very personal opinion, this needs to be documented quite obviously, avoiding to raise false hope and expectations for (especially new) users.
Advanced users will obviously be able to delay the inevitable by quite some margin - depending on their use-cases and abilities to reduce LEDE's footprint below normal system requirements.

Despite the title, the RAM size is actually a much harder limit, affecting much more than just 4 MB flash devices. If you look through the commit log, you will notice quite some efforts to get opkg to use less RAM, but it's still a problem with just 32 MB RAM (even for normal operations, before touching opkg). Likewise you already are in trouble with sysupgrade and trying to flash a (larger) 6-8 MB firmware on a device with just 32 MB RAM, unless you really clean up services and loaded kernel modules manually beforehand, there is a high risk that you'll oom during the sysupgrade and brick your device for good (requiring bootloader/ tftp assistance to recover in the best case).


[1] switching from mach files to device tree (post 17.01) offers a potential to free up a little space in the kernel, but this isn't a whole lot and will probably be eaten more or less completely by upgrading to kernel 4.9+ (also keep in mind that the FDT file needs to be appended to the kernel image, which might or might not compress as well as the mach files before), so don't expect a significant positive effect from this switch.

[2] no webinterface, better no pppd, quite some custom configurations to get the kernel's runtime memory requirements as small as possible, disabling whatever is humanly possible (definately no IPv6, better no wireless either).

[3] with LEDE's pretty new feature of device specific rootfs images, it would technically be possible to decide between installing luci or omitting it on a per device basis, e.g. based on flash sizes, but support for something like this hasn't been implemented yet and would require quite some attention (both as in source patches and tagging of device classes) from interested parties. As implemented right now, the decision is binary - either the default (release) config (including luci) fits XOR building a firmware image for the affected device fails and no firmware will be available.

[4] I would expect that there already are a couple of 4 MB flash devices in the target list for which no release firmware can be built for 17.01, because of less ideal flash partitioning schemes chosen by the vendor (dropping free space below 3 erase blocks). Those are probably a minority, but given the close numbers, I'd be very suprised if there wouldn't be any affected.

3 Likes

Thanks slh that is a very thorough assessment.

[quote="metai, post:67, topic:1018, full:true"]Wait, are you serious? At the moment there is no official release build for any device (as of this post, the buildbot has been building packages for 17.01 for the last few days), and there is no word from any dev in the matter. And yet you are making the blanket statement "4MB devices won't be able to install GUI (LuCI)" on the official web page.[/quote]I actually wrote that sentence as a stopgap until we could make something better. It's technically true. Devices with 4MiB can't install a damn thing through opkg, especially 250-ish KiB packages like luci, and it's not exactly news. Luci is the most sought after package most newbies want to install after flashing LEDE so it's good enough for a stopgap.

As you may notice, it has been replaced with another statement by tmomas and I currently proposed a more elaborate error message in this post that will clear that "my 4 MB device will never have a GUI" issue you raised

But in general yes, we need a clear warning for newbies, there are many devices that are still technically supported but are not recommended, and we need to make sure newbies stay clear of them (because seriously, with like 20$ you can buy stuff with 128MiB RAM and 16 MiB flash).

@slh Good assessment with facts, that's much better than a random opinion.

@tmomas how about cloning slh's analysis in the article where we explain the issue in the warning messages ? A paragraph like "In-depth analysis of the issue" or something.

(note that I'm not asking you to do it, I ask your opinion here. I can move things to wiki too)

Also big yes to this. @tmomas do we have a field for this in the ToH? I remember that one of the goals in LEDE ToDo was to categorize the devices in support classes like this.

1 Like

@slh Thank you for this perfect explanation.

Yes please, go ahead!

full / limited / minimal support

No.
I remember that we had discussions about this when building the current OpenWrt ToH, which ended in having the "Unsupported" field, where things can be put that are not working. This information is more valuable than a classification "limited support", where you anyway need to state somewhere what limited means for this device.

I remember that we had discussions about this when building the current
OpenWrt ToH, which ended in having the "Unsupported" field, where things can
be put that are not working. This information is more valuable than a
classification "limited support", where you anyway need to state somewhere
what limited means for this device.

"limited support" is possibly the wrong term, because it can be confused with
"partial support" where some parts fo the device are not usable by openwrt.

In the continum that I listed above, limited means that the standard image
distributed by LEDE will install and run, but that you are going to have severe
trouble installing anything after that (although with the imagebuilder approach,
you can change what's in the base image and probably install some other stuff)

This could be because opkg hits OOM, or because there are not enough flash
blocks left free to be usable. The exact definition can be discussed and
hammered out. It doesn't really matter which limit you run into, just that you
have run into a limit.

But it means the same thing for all devices, it's not something that varies in
meaning by device.

The idea is to identify devices that are still able to be installed with the
standard release image (including LUCI if that's in the what we define as the
standard release image) but that you can't expect to add anything else in
addition.

The devices are perfectly usable, just maxed out to start with.

The minimal support category is for the devices that you can no longer fit the
standard release packages onto. They can still be used with custom images, but
are very much in the 'experts only' category.

based on the discussions that I've been seeing, the criteria for hitting
'limited support' are

RAM: 32M

This is because as I understand things, opkg won't run reliably with 32M, but
is comfortable in 64M

FLASH: 4 flash blocks available (effectivly 1 flash block of storage after
overhead)

This is not X MB of flash because the amount of flash left after compiling
things is going to vary from device to device (instruction set density, flash
block size and what kernel modules are needed to support the hardware are three
significant things off the bat).

The analysis last night on the difference between having 5 flash blocks
available and having 4 is what I'm relying on. Per that discussion, 5 flash
blocks is still fairly usable, but at 4 you can still store configs on the
system, but not any noticable packages.

It may be that we want to set the limit a little higher, or that there is a way
to reduce the number of flash blocks that the filesystem keeps idle, so let's
discuss if this is the case or not.

Ideally, the build process would be able to generate a warning at the end of the
build if the particular image created is that tight. (and it may be that it's
tight/unusable in some filesystem types but not in others).

David Lang

Just providing my rather pragmatic opinion on the topic here:

  • I do not believe in arbritarily dropping device support
  • We usually support devices as long as it is feasible
  • A device should be considered supported as long as
  • it is possible to build bootable images
  • small enough images can be produced to still allow configuration persistence
  • no patches or other modifications to the source and buildroot are required

Eventually we might need to think about support tiers like:

  • Full => allows for running gui, has working opkg and plenty of space to allow packages
  • Medium => allows for running gui, has working opkg and at least enough space for setting up extroot
  • Small => bootable images can be built when either sacrificing gui or opkg while still having configuration persistence
  • Micro => only choice are heavily tailored custom images that require special measures like pre-shipped configuration, NFS mounts, preconfigured extroot etc.
5 Likes

Thanks jow for sharing your point of view.

How do we get now the classification Full/medium/small/micro for each supported device? As far as I have understood, there is no general rule, and free space after installation (and hence the classification) depends on the specific device.

1145 devices in the ToH
638 devices listed as supported by LEDE
170 thereof with 4MB flash

I can certainly add a new field to the dataentries, but before doing so, I would like to have the classification for each device, in order to have this field filled for all devices and being useful for the users.

A list that is automatically generated via script would be prefered; a manually updated list should be avoided (high maintenance effort, never complete, always outdated).

Could you generate such a list?

Thanks @jow for the insight. And I share the concerns from @tmomas - it will be hard to create and maintain a list.

I started this thread to ask the question "Should LEDE support devices with only 4MB Flash?" The clear answer is, YES.

The discussions also revealed two follow-on recommendations:

  1. For people who want to buy a new router for your home that "just works", we need to make the recommendation to seek a model with 8/64 mbytes.

  2. For those who want to use an existing 4/32 mbyte router, our recommendation should be, "It may work, and will certainly be more effort than using a 8/64 mbyte router. Check the device page and forums for assistance."

Choice #1 is the easy path; Choice #2 is sort of "choose your own adventure."

Beyond that, I would want to stay away from defining various levels of support since those suggest much larger commitments of attention/effort/understanding than most/any of us are willing to offer.

1 Like

Thanks jow for sharing your point of view.

How do we get now the classification Full/medium/small/micro for each supported device? As far as I have understood, there is no general rule, and free space after installation (and hence the classification) depends on the specific device.

1145 devices in the ToH
638 devices listed as supported by LEDE
170 thereof with 4MB flash

I can certainly add a new field to the dataentries, but before doing so, I would like to have the classification for each device, in order to have this field filled for all devices and being useful for the users.

A list that is automatically generated via script would be prefered; a manually updated list should be avoided (high maintenance effort, never complete, always outdated).

Could you generate such a list?

Is it possible to get the amount of available flash out of the build system?

David Lang

That is a good summary. The key thing is to warn people looking for a new router that anything below 8/64 can be considered challenging.

I feel that trying to figure out yet another classification and to maintain it would be too burdensome in the long run. We should not make the device database over-complicated.

I'm using LEDE even on Nanostation2 4MB flash/16MB ram - with Luci.
This is internal AP so don't need:

  • disabled IPv6,
  • remove all related elements to iptables
  • remove dhcp servers,
  • remove opkg - not needed as I don't have more place and ram :slight_smile:
  • added LUCI and zram

I have few router TP-link 4MB flash/32MB ram so there just disable IPv6 and remove opkg, and add Luci, wireguard, Zram

So I think there is no point to complain just read:
https://lede-project.org/docs/guide-developer/use-buildsystem

And once again thanks developer for their hard work and making openwrt/LEDE so modular that everyone can take what want/need