Slimdown balenaOS for smaller hosts

Dear all,

for several projects, using very resource limited platforms like the RPi Zero, I thought about “sliming down” balenaOS. Essentially, after being setup with the application container, certain types of applications won’t need the balena supervisor with its own node.js powered API and other services - hence these could be removed without any problems - or the vpn connection (especially if its used as local, non balenaCloud enabled system) - freeing up valuable cpu and memory resources.

I wanted to use the oppurtunity to ask if other guys also had that idea and done something in this direction :).

Due to this specializied request, @zubairlk did open up an repo on github to prepare a “trimmer” script which can disable certain services on the balenaOS. You can find it here: https://github.com/balena-io-playground/balenaos-trimmer - maybe we can take this further?

Best regards,

Nico

Hi,

So I’ll describe my own workflow while making the balenaos-trimmer script. I think it is vital to use a development image and have some sort of serial/uart access to the device while working on trimming the OS. Even if the final device needs to use the serial port, that is a separate activity to working on the script.

I personally use the piuart and can recommend it. It is very handy to always have access to the boot console as it happens. I can see the timeouts happen. And can adjust as I go. https://www.adafruit.com/product/3589

On a separate note, you mentioned earlier that the container starts at a ‘random’ time. Can you check dmesg if balenaEngine depends on random initialisation?

We faced this issue once and had fixed it. But I see a comment on the balenaEngine repo and it is with the pi0w. Check this for more detail. https://github.com/balena-os/balena-engine/issues/105#issuecomment-550281934

Regards,
ZubairLK

also. just to add. I’ve been testing on a pi3b+… Going to try to rummage through the drawers for a pi0… still don’t know where everything is after moving recently.

Hello @zubairlk,

I am still in very bad health, but will try to see if I can come up with something and would then test the stuff with the development image.

I also saw that the 2.44 balenaOS image for Raspberry Pi 1 / Zero has been taken down from the official website. Has there been some issue identified?

Best regards,

Nico

Hi,

best wishes for a speedy recovery o/

regarding the pulled release. we found that 2.44 introduced a race condition between supervisor and engine on subsequent reboots, details on it here: https://github.com/balena-os/meta-balena/issues/1748
The fix is already in 2.45.1 and in staging for some device types…