Booting of balena OS on beaglebone Black

Hi,
I have to install balena OS and to upload a sample hello world onto balena cloud. I am using Ubuntu OS on beaglebone black. I have removed SD card and booted balena OS onto it and put it on beaglebone. While entering through putty, it is showing ubuntu login only. How do I boot balena OS and how do I get balena login so that I can work on it and host a sample hello world application and push it on balena Cloud. Do I need an empty beaglebone black as ubuntu is already there for booting balena OS. Please let me know if you have any support documents or links available to me

Hi

One possible explanation of this might be that you incorrectly flashed balenaOS. Did you have Ubuntu already running on the eMMC of the BeagleBone Black? Perhaps you flashed the SD card correctly, but the OS on the eMMC was what you used when you tried to putty

Thanks for the reply. But to flash balena OS on to the beaglebone is there any process and to login through putty what I have to do?Please send me any link is available?

By default the beaglebone will boot from its internal storage, in order to make it boot from the SD card you need to press down the small button near the SD slot while powering on and hold it until the blue LEDs start flashing. This will copy balenaOS from the SD card to the internal storage (wiping ubuntu). When the device shuts down (all the LEDs are off) you can remove the SD card and power on the device, it should boot up into balenaOS.

Thank you for the reply. My doubt is how to install balena CLI on balena cloud as it is showing root terminal where it is having access of HOST OS and in that I need to upload one sample hello world application as a fleet onto that balena cloud. How to do that? Any link is available?

@rajasimha I’m having a little bit of trouble understanding the question. It seems like you are saying that you now have BalenaOS on the device and now you are asking how to get your sample application on to the device? If so, then from the folder where the sample application is located, run the following command:

balena push FLEETNAME

Where FLEETNAME is the name of your fleet. This will push the code to the cloud builder, which will build it and create a release. This will then sync to your device. See this page for documentation: Deploy to your fleet - Balena Documentation

If you are asking how to install Balena CLI, then this page is where you want to go: balena-cli/INSTALL.md at master · balena-io/balena-cli · GitHub

Thanks for the reply. I have done as per that. How to we upload files not fleet onto the balena cloud. I am not finding any option of uploading the files on it. Could you please send me any link available. The OS installed in my beaglebone black is
[balena OS 2.85.16+rev1] development version

So, I think (please correct me if I’m wrong) what you are trying to do is “upload” some files to just one device? That is, you want to put files on a particular device, rather than on the entire fleet?

Balena does not have a concept of “uploading” files to some storage location. You have two option to put files on a device.

  1. If you include something as part of a release, then it will be pushed to all devices in the fleet. Or at least, it will be pushed to all devices that are tracking that release. There can be multiple releases and devices can be pinned to different ones or they can “track latest”.

  2. If you absolutely must put special files on a particular device, you could manually copy them over using scp. See this documentation on using ssh, since scp uses ssh under the hood SSH access - Balena Documentation Keep in mind that the host OS is read only and you could only copy files under /mnt/data or into a shared volume folder.

I feel like the question is perhaps revealing a misunderstanding about how balena cloud works. All devices in a fleet run the exact same code. This is the concept of “cattle” in the “pets versus cattle” analogy. If you are not familiar with that analogy, take a look at this link: Cattle vs Pets - DevOps Explained

Copying files manually to devices is of limited utility. You cannot deploy applications this way. If you wanted to run specialized code on just one device (perhaps for debugging) you would have to manually SSH to the device and pull an image using the balena-engine commands (which mirror the docker commands) and run it in a container.

In summary, while it is possible to forcibly put files or even application code on just one device in a fleet, it is not natural to the way balena cloud works or sustainable for managing a fleet of significant size.

Hi ,
Thank you for the reply. I did upload a sample hello world program on balena cloud through balena CLI and got the file uploaded on it. My next task is do balena have the process of uploading the data on docker level and OS levels. My requirement is when I upload a docker image on one device ex.,beaglebone it should replace the old data and new data should come and this process to be followed to the total number of devices connected to each other for example 50 devices. Is it possible? If so , how will be ?

Hi,

See here for more details.

Basically everything you do in your Dockerfile will be propagated to the fleet.
New images completely replace the old images.
So if for example you use the following as your first release:

FROM balenalib/raspberrypi3-debian
RUN mkdir -p /usr/app
WORKDIR /usr/app
COPY application /usr/app
COPY application_v1.conf /usr/app
CMD ["/usr/app/application"]

This will run your application in a volume that gets replaced by your next release.
If you then change it to:

FROM balenalib/raspberrypi3-debian
RUN mkdir -p /usr/app
WORKDIR /usr/app
COPY application /usr/app
COPY application_v2.conf /usr/app
CMD ["/usr/app/application"]

Your devices will now only have application_v2.conf on them, and not the application_v1.conf.
This way you can push global files to the entire fleet, they are in fact part of the image you push.

If you want to persist your files between releases, you should write them to /data/.
The files in /data/ are specific to the individual devices, not to the image that is pushed to all of them.
I use files in /data/ for example to customize credentials for my devices and to store databases and logfiles.

Hi,
Thanks for the reply. I will do as per the process mentioned. My another doubt is how do we link up the balena OS to bitbucket and how will the changes made in balena OS through application will reflect on to the bitbucket ?

Hi,

If you click the button Add release in your fleet overview, you will get a screen showing how it works.
Basically you can do a balena push <orginazation>/<fleet>, or you can push to a git remote <username>@git.balena-cloud.com:<organization>/<fleet>.

I have all my applications on a private git server for development and only push them to Balena whenever I want to deploy a new release.

Great replies, @tjvv :clap: Just a couple of things to add…

  • if you are deploying more than one service (ie, more than one container will be running on the device), you’ll have to use a docker-compose.yml to put them all together in one release. See this link for documentation on Balena support for docker-compose.
  • As @tjvv points out, container data is ephemeral. Whatever you write in a container’s file system will disappear when the container is recreated. So if you want data to live on between releases, you need to write it to a folder mounted to a volume. If you want to save to /data, then you will need to create a volume and have the container mount it to /data.
  • Although git integration is possible as indicated, and remains a supported feature, it is deprecated as the “recommended” way of pushing releases. Using the Balena cli is the recommended approach.
  • Again, as was explained very well, the release will go to all devices that are “Tracking Latest”. Every time you create a non-draft release, it becomes “latest”. You can also “pin” devices to a particular release. In that case, that pinned device will not be updated until you put it on “Track Latest” or pin it to a different release. Note that draft releases will never be pushed to a device automatically and will only be pushed when a device is pinned to it.