Hello,
I tried to build own image but it looks that balena don’t have apt-get so how can I add some package to my image?
Hello,
I tried to build own image but it looks that balena don’t have apt-get so how can I add some package to my image?
Hey, you can add a docker container and install the required packages there.
thanks for the answer, do you have any tutorial how?
Yes we do, I think following a getting started guide would help you understand the balena ecosystem better. Follow this guide in our docs, you can change the language and device type for your use case. Once you are setup, you can add the apt install command within a docker file to install your package. Please follow through examples posted in to getting started guide, they will point to the examples specific to that language.
I got a error durring try to push this example
Step 1/7 : FROM balenalib/raspberrypicm4-ioboard-node:14-buster-run
[main] manifest for balenalib/raspberrypicm4-ioboard-node:14-buster-run not found: manifest unknown: manifest unknown
Ok, it looks that 14-buster-run is a problem, for this system only 16 is available. It looks that if i want to have any additional package i need to run another docker which will by not same like a main but another? How can I run application from this docker in main system?
Hello there,
What packages do you want to install? As my colleague said, you will be able to install packages in the dockerfile that defines your container image that will be run as part of the application. Are the packages that you need not available in the balenalib/raspberrypicm4-ioboard-node:14-buster-run
base image? Are you getting an error message while trying to push an application?
More than that, what is your application or use case? If I understand what you are trying to achieve, I will be able to give you clearer advice
balenalib/raspberrypicm4-ioboard-node:14-buster-run
it was about your example from the documentation but fogot about it, the problem was the node version
What packages do you want to install?
e.g. i2c-tools package to have i2cdetect but i’m asking general for the future.
Now i created the dockerfile but it looks that I just created another instance of the system. From my point of view is like a two independend operation system, main os and another one. The problem is how to share the application which i installed by docker to mainOS
Hi, we use docker (balenaEngine) to separate services, so they can be updated, can be fail resistant etc. So you don’t need to install packages in the hostOs (main), each container can have their own set of packages. You can also have just one container(service) in your balenaOs. I hope this clears the confusion.
Can you elaborate on why you need to share the application between docker and the hostOs? If you are using the docker file to copy over your application code, the application is already within your docker container (and not in your hostOs).
To be honest, my goal is to be independent and I just create this topic to know how can i install some package if I need it. I understand docker conception but is not neccessary for now because i just want to install some application which is not included in basic system, please focus on it and let my know how is possible. Don’t focus on exactly application but just a problem.
I see that yocto have own possibility to add application, it can by done by this Cookbook:Example:Adding packages to your OS image - Yocto Project, the problem is that for now it is not working in your system or maybe build/conf/local.conf is not a good place to add CORE_IMAGE_EXTRA_INSTALL.
Btw. now i have a issue that main system don’t have i2cdetect application but it looks that have a i2c-tools package which should contain this application. I created docker container and install there i2c-tools and i2cdetect is working in docker but not in main system. Do you know why?
Hello,
Thanks for providing context. If I understand correctly, you are trying to install a package on the hostOS for usecase. Maybe providing context about balenaOS would be helpful to you. BalenaOS is meant to be fail-resistant in the event of a shutdown or abrupt poweroff of the device. To enable that functionality, balenaOS comes with a ready-only root filesystem and hence installing packages or making any changes directly to the HostOS aren’t possible (Read more).
Especially not with using a package tool like apt-get
since this is not a Debian distro. As you already mentioned, I am reaching out to the balenaOS team to find why the Yocto way of adding an application doesn’t work as well. The answer could possibly be the same explanation that I provided but I think confirming that would go a long way in helping us understand.
Can you confirm the device type and OS version you are using for us to reproduce this? We can use these details to check manifest files for balenaOS and actually see if the i2c-tools package is being installed or not: https://balenaos-manifest.balena.io/
Hope this helps!
Hi, if you are building a custom OS for development purposes and you want to add some Yocto packages, you can add the following to conf/local.conf
:
IMAGE_INSTALL:append = " packagename"
Note that CORE_IMAGE_EXTRA_INSTALL
will also work if you are building a balena-image
or balena-image-flasher
bitbake target.
Thanks for the answer,
below is the information from your dashboard:
OS: balenaOS 2.98.17
Device type: Raspberry Pi CM4 IO Board
below is the information from the device
root@2c8c1b3:~# uname -a
Linux 2c8c1b3 5.10.95-v8 #1 SMP PREEMPT Thu Feb 17 11:43:01 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
I see that from full i2c-tools only i2ctransfer is available
I see that from full i2c-tools only i2ctransfer is available
Indeed, to keep balenaOS slim and smaller we only keep a subset of only the most essential tools. Hope this answers your query. Let us know if you need more help.
I understand but I need i2cdetect as i wrote before. How can i add? I saw in recipe that it should be but something died that is not. How can i fix it?
Hey there, it looks like the i2c-tools
recipe includes the i2cdetect
binary that you need.
https://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/i2c-tools/i2c-tools_4.2.bb?h=hardknott
Have you tried adding the following to build/conf/local.conf
when building your custom OS image?
IMAGE_INSTALL:append = " i2cdetect"
Normally we don’t recommend adding packages to the hostOS as the root filesystem is very small and mounted as read only. The intent is that any application utilities would be installed in a container and the hostOS would remain unmodified for security and reliability.
Is there a reason you can’t run i2cdetect from your application container? Why does it need to be installed on the hostOS?
You can disregard my last question about the application container, I can see from this thread you are already aware of the differences but would still like to install in the hostOS via Yocto.
Just a reminder that there is a possibility of the rootfs not having enough room for any additional packages since we set a size limit in the partition table. If this is the case you will see an error at build time to that effect.
Can I use other device tree or overlay in container?
since we set a size limit in the partition table
Can I change this limit?
Hey there, it looks like the
i2c-tools
recipe includes thei2cdetect
binary that you need.
Yes, I wrote this but from no idea why is not included in hostOS.
Can I use other device tree or overlay in container?
Device trees need to be built into the image to make them available at boot. Overlays must also be built into the image if they’re required at boot.
Can I change this limit?
Yes, this is defined in layers/meta-balena/meta-balena-common/recipes-core/images/balena-image.bb
. You can override this by defining a balena-image.bbappend
with the variable IMAGE_ROOTFS_MAXSIZE
. See this for an example.
Yes, I wrote this but from no idea why is not included in hostOS.
The design and intent of balenaOS requires user applications to be distributed and run in containers. The utilities provided by i2c-tools aren’t required by the container engine, so they’re not included in the host OS.
As an example of downloading and running an application not present in the host OS, htop can be run like so:
$ balena run -it --pid=host wrboyce/utils:htop
i2cdetect
can also be run in a similar manner, without rebuilding the OS to include it:
$ balena run -it --privileged alpine \
/bin/sh -c "apk add --update i2c-tools && i2cdetect -y 0"
Does this help explain why it’s not included by default?
Of course, I understand why you not add all application to main system Everythink is clear for my in this point but i2cdetect is very simple way if you need to manage device tree which is most important part for my, you can think to add for the future. If i can use only one device tree in host then i need to access to check what is happend and why I can’t turn on my i2c I hope that you also understand why I need this. In Monday i will do more test and let you know if is enougt for my. Btw. As I understand if I will see some device in host on i2c then in container I can also access for it?