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

1 Like

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…

Thank you very much, I will rest my tests until the new version is out and try with it then :)!

Dear @zubairlk and @robertgzr - is there any ETA for the new release of balenaOS for RPi 1 / Zero? It looks like the current ( BalenaOS 2.32.0+rev1 ) revision is missing the kernel files for the PiCamera, hence it does not work. The 2.44.0 which I still had here seems to be not having this issue :slight_smile:

( I guess its the 2.44.0 I got, as the balenaEngine is from October )

Client:
 Version:           18.09.10-dev
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        7cb464a406748016f2df0c31a9851d20456a3d31
 Built:             Thu Oct 17 14:28:36 2019
 OS/Arch:           linux/arm
 Experimental:      false

Server:
 Engine:
  Version:          18.09.10-dev
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       7cb464a406748016f2df0c31a9851d20456a3d31
  Built:            Thu Oct 17 14:28:36 2019
  OS/Arch:          linux/arm
  Experimental:     true

Best regards

Nico

Hi Nico,

after some investigation we found that the issue is a dependency between the userspace camera libraries and the firmware, so a possible solution if it’s urgent for you to use a Raspberry Pi Zero with the 2.32 version of the OS, is to downgrade libraspberrypi-bin and you can do this by adding apt-get install libraspberrypi-bin/oldstable --allow-downgrades -y to your Dockerfile.
Another solution is to use a 2.4x version of the OS which will be available in production in about two weeks, for the pi-zero.
Finally, if you have a raspberry pi 3 you can use that as 2.44 version of balenaOS is available.

Kind Regards,
Marios

1 Like

Thanks Marios, that sounds awesome :)!
Best regards,
Nico