Presseeding a BeagleBone Black
Automated installation of Debian on a BeagleBone Black


Posted on 2020-06-17

Introduction

I have gotten a hold of quite a few BeagleBone Blacks, a single-board computer much like the more well known Raspberry Pi. The important difference to a Rasperry is that the BeagleBone Black can run a completely open-source system. BeagleBone does provide images based on Debian that you can flash directly, however I prefer to run upstream Debian without modifications.

As an example one of my use-cases for some BeagleBones is as simple WiFi Access Points in order to extend the coverage of my home WiFi network. I might detail that setup in a future post.

This post will show how I go about installing Debian on a BeagleBone Black.

First steps

When I first try to boot the Debian installer from an SD-card it fails, the only output on the serial console is an ever growing number of the character C:

CCCCCCCCCCCCCCCCCCCCCCCCCC

I don't understand why this is however I think its related to the u-boot version that is flashed on my BeagleBones (which is not the same as what they come shipped with).

Installing BeagleBones official image

In order to solve the boot issue I first install the BeagleBone provided image, which upgrades the u-boot version.

First off, lets download the latest image from BeagleBones website and flash it to an SD-card:

xzcat ~/Downloads/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz > /dev/sdb

In order to get the BeagleBone to boot from the SD-card you need to hold down the button next to the USB-port while you power the BeagleBone, otherwise it will simply boot from the eMMC.

Then I follow these instructions for flashing that image to the eMMC. Essentially this only involves uncommenting the following line in /boot/uEnv.txt:

# cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

and then reboot, which will start flashing the image to the eMMC.

Installing Debian

After the BeagleBone provided image has been flashed I can boot the ordinary Debian installer from an SD-card. According to the Debian manual the images can be downloaded from a debian mirror and written to an SD-card:

wget http://http.us.debian.org/debian/dists/buster/main/installer-armhf/current/images/netboot/SD-card-images/firmware.BeagleBoneBlack.img.gz
wget http://http.us.debian.org/debian/dists/buster/main/installer-armhf/current/images/netboot/SD-card-images/partition.img.gz

zcat firmware.BeagleBoneBlack.img.gz partition.img.gz > /dev/SD_CARD_DEVICE

Once inserted into the BeagleBone once again hold down the button next to the USB-port while powering it to boot from the SD-card.

Preseeding

We will use preseeding to automate the installation. This makes the system more easily reproducible and allows us to leave the installation mostly unattended, which is especially nice on a slower system such as the BeagleBone. In my case I chose to preseed from a webserver as it requires the least amount of setup beforehand.

First off, we need to stop the automatic boot, I generally just spam the space bar as soon as I have powered on the system. The serial-port will display something similar to:

Press SPACE to abort autoboot in 0 seconds

Then we just need to provide our own boot arguments to the installer to have it fetch the preseed file:

env set bootargs auto url=https://example.com/preseed.cfg
boot

Once the installer has started we can press ESC and select the preseed entry in the menu:

Download debconf preconfiguration file

Before the installer downloads the preseed file it will ask a couple of questions. Last I checked installation it asked for the hostname and domain name of the machine, which is slightly annoying as that is part of the questions I have preseeded.

However, once the installer has downloaded the preseed file it will continue with the rest of the installation unattended and leave you with a working system by the end.

Date issues

The BeagleBone does not have a persistent hardware clock so it is not uncommon for the time of the device to be off by years. This is problematic when the installer needs to fetch the preseed file over https as that requires a system time to be somewhat close to reality. When it is too far off, i.e. years, the certificates will be invalid as their notBefore date is in the far future.

This can easily be solved by just setting the time, press ESC and select the shell entry in the menu:

Execute a shell

Once in the shell, set the date and exit:

date --set "2020-06-17 00:00"
exit

Once done retry the "Download debconf preconfiguration file" step.