Raspberry Pi 2 Model B / 3 Model B/B+ - Debian stretch (EDI)

Introduction

The setup described below uses the tool edi and the configuration edi-pi to generate the following artifacts on a Ubuntu 18.04 host machine:

  • A pure Debian stretch arm64 (64bit) image suitable for the Raspberry Pi 3.
  • A pure Debian stretch armhf (32bit) image suitable for the Raspberry Pi 2 or 3.
  • Matching Mender update artifacts for the above configurations.

Building the Artifacts

Preparation

Prior to using the edi-pi configuration you have to install edi according to this instructions. Please take a careful look at the “Setting up ssh Keys” section since you will need a proper ssh key setup in order to access the Rasperry Pi using ssh.

The image processing steps require some additional tools. On Ubuntu 18.04 those tools can be installed as follows:

sudo apt install e2fsprogs dosfstools bmap-tools mtools parted

To generate the Mender update artifact, the mender-artifact tool is required. Unfortunately it did not make it into the Ubuntu Bionic apt repositories. Luckily this package comes with a small number of dependencies and therefore it is without risk to download it from Debian and install it on Ubuntu Bionic:

sudo dpkg -i mender-artifact*.deb

Now you can clone the edi-pi project configuration repository from GitHub:

git clone https://github.com/lueschem/edi-pi.git
cd edi-pi

Mender Configuration

To get connected to your tenant you have to add your tenant token to your image build:

vi configuration/mender/mender.yml

Please enter your tenant token like this:

mender_tenant_token: YOURTENANTTOKENRETRIEVEDFROMHOSTEDMENDER

Creating the Artifacts

A Raspberry Pi image and a Mender update artifact can be created using the following command:

For Raspberry Pi 3, arm64:

sudo edi -v image create pi3-stretch-arm64.yml

For Raspberry Pi 2 or 3, armhf:

sudo edi -v image create pi23-stretch-armhf.yml

The resulting image can be copied to a SD card (here /dev/mmcblk0) using the following command (Please note that everything on the SD card will be erased!):

For Raspberry Pi 3, arm64:

sudo bmaptool copy artifacts/pi3-stretch-arm64.img /dev/mmcblk0

For Raspberry Pi 2 or 3, armhf:

sudo bmaptool copy artifacts/pi23-stretch-armhf.img /dev/mmcblk0

If the command fails, unmount the flash card and repeat the above command.

Once you have booted the Raspberry Pi using this SD card you can access it using ssh (the access should be granted thanks to to your ssh keys):

ssh pi@IP_ADDRESS

The password for the user pi is raspberry (just in case you want to execute a command using sudo or login via a local terminal).

The Mender update artifacts can be found in the same artifacts folder like the the full images.

More Information

For more information please read the edi documentation and this blog post.

For more details about the Mender integration please refer to this blog post.

If you are curious about the U-Boot bootloader setup please take a look at this blog post.


If this post was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!

2 Likes

Thanks for sharing, I have made a slight adjustment of the title of the post

I received the following error “Command not available” when execute
sudo edi -v image create pi3-stretch-arm64.yml
or
sudo edi -v ~/Downloads/Raspberry-Pi/2019-06-20-raspbian-buster.img create pi3-stretch-arm64.yml

Did you install edi according to this instructions?
Does the command edi version work? What version of Ubuntu/Debian are you using?

Ubuntu 19.04 (disco)
I installed the correct ‘edi’ application and now I have the following error:
Error: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: permission denied
Error: Command ‘[‘sudo’, ‘-u’, ‘miron’, ‘/usr/bin/lxc’, ‘config’, ‘get’, ‘images.compression_algorithm’]’ returned non-zero exit status 1.
For more information increase the log level.

I guess that your user does not have the secondary group lxd.

Could it be something like:

What does the command groups show for your user?

groups:
miron adm dialout cdrom sudo dip plugdev lpadmin sambashare docker

Ok, the lxd group is missing. It seems that you have to add it manually on Ubuntu Cosmic:

sudo usermod -a -G lxd $USER

After this you have to logout and login again to apply this change. Sometimes it is even needed to restart the system.

Finally, the groups command should show the group lxd and the command lxc list should properly work.

I have updated the instructions here.