# Raspberry Pi 4 - Debian bullseye - no U-Boot (edi)

**URL:** <https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283>\
**Category:** Debian family\
**Tags:** raspberry-pi-4, edi, bullseye\
**Created:** [November 5, 2021, 10:06am UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283 "2021-11-05T10:06:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lueschem](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lueschem/32/214_2.png) [@lueschem](https://hub.mender.io/u/lueschem)\
**Post date:** [November 5, 2021, 10:06am UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283/1 "2021-11-05T10:06:59Z")

</div>

# Introduction

The setup described below uses the tool [edi](https://www.get-edi.io) and the configuration [edi-pi](https://github.com/lueschem/edi-pi) to generate the following artifacts on a Ubuntu or Debian host machine:

- A Debian bullseye arm64 (64bit) image suitable for the Raspberry Pi 4.
- A matching Mender update artifact for the above configuration.
- An amd64/arm64 based LXD container with a pre-installed cross development toolchain for C and C++.

# Building the Artifacts

## Preparation

Prior to using the edi-pi configuration you have to install [edi](https://www.get-edi.io) according to [this instructions](https://docs.get-edi.io/en/latest/getting_started.html). 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 20.04 those tools can be installed as follows:

```bash
sudo apt install e2fsprogs dosfstools bmap-tools mtools parted rsync zerofree python3-sphinx mender-artifact

```

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

```bash
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:

```bash
vi configuration/mender/mender.yml

```

Please enter your tenant token like this:

```bash
mender_tenant_token: YOURTENANTTOKENRETRIEVEDFROMHOSTEDMENDER

```

## Creating the Artifacts

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

```bash
sudo edi -v image create pi4-bullseye-arm64.yml

```

**Please upgrade your Raspberry Pi 4 EEPROM prior to using the just created artifacts!**

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!** ):

```bash
sudo bmaptool copy artifacts/pi4-bullseye-arm64.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):

```bash
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](https://docs.get-edi.io) and [this blog post](https://www.get-edi.io/A-new-Approach-to-Operating-System-Image-Generation/).

For more details about the Mender integration please refer to this [blog post](https://www.get-edi.io/Updating-a-Debian-Based-IoT-Fleet/).

If you are curious about the bootloader setup please take a look at this [blog post](https://www.get-edi.io/Debian-Bullseye-Upgrade-for-the-Raspberry-Pi/).

---

<div class="post-metadata">

**Author:** ![wombat](https://avatars.discourse-cdn.com/v4/letter/w/e480ec/32.png) [@wombat](https://hub.mender.io/u/wombat)\
**Post date:** [November 30, 2021, 5:04pm UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283/2 "2021-11-30T17:04:54Z")

</div>

Thanks Matthias,

I’m new to edi, and really interested in trying this.

My initial goal would be to build an mender-enabled arm64 image (for RPi4), ideally with dual-partition (A/B) booting; I’m currently using `mender-convert`, which doesn’t yet support arm64 ([MEN-3663](https://tracker.mender.io/browse/MEN-3663)).

**Q. Does your `edi-pi` example create a dual-partition image?** (apologies I have not tried your method above yet)

Best regards,

Tom

---

<div class="post-metadata">

**Author:** ![lueschem](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lueschem/32/214_2.png) [@lueschem](https://hub.mender.io/u/lueschem)\
**Post date:** [November 30, 2021, 8:29pm UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283/3 "2021-11-30T20:29:18Z")

</div>

Yes, exactly - edi-pi creates a minimal dual-rootfs image for the Pi 4. The image gets created from scratch and by modifying the configuration you can easily extend it according to your use case.

---

<div class="post-metadata">

**Author:** ![wombat](https://avatars.discourse-cdn.com/v4/letter/w/e480ec/32.png) [@wombat](https://hub.mender.io/u/wombat)\
**Post date:** [November 30, 2021, 10:06pm UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283/4 "2021-11-30T22:06:21Z")

</div>

Sweet! Exciting times…and without needing to build a new arm64 uboot?

I am not an embedded systems engineer myself (for example, I don’t know Yocto Project), but it seems to me (having read your [edi presentations](https://docs.get-edi.io/en/latest/presentations.html) about Debian, IoT, etc.) that mender and edi could be a great combination for people who want to get up and running quickly with Debian based projects. _My “gold” systems are already provisioned with Ansible, so it sounds like that should be easy to inject via the edi plugins._ 🙂

So I look forward to diving into the [edi configuration management](https://docs.get-edi.io/en/latest/config_management/introduction.html) in due course.

In the meantime, I just tried creating an image using the example in your post above (`pi4-bullseye-arm64.yml`) but it’s failing at the `apt_setup` task in the sample playbook:

```auto
...
TASK [apt_setup : Initialize apt.] *********************************************************************************************
fatal: [edi-tmp-e17f2af7ff11261d23bb]: FAILED! => {"changed": false, "cmd": ["apt-get", "update"], "delta": "0:03:05.605031", "end": "2021-11-30 16:55:10.615755", "msg": "non-zero return code", "rc": 100, "start": "2021-11-30 16:52:05.010724", "stderr": "E: Failed to fetch http://deb.debian.org/debian/dists/bullseye/main/i18n/Translation-en Connection timed out [IP: 199.232.138.132 80]\nE: Some index files failed to download. They have been ignored, or old ones used instead.", "stderr_lines": ["E: Failed to fetch http://deb.debian.org/debian/dists/bullseye/main/i18n/Translation-en Connection timed out [IP: 199.232.138.132 80]", "E: Some index files failed to download. They have been ignored, or old ones used instead."], "stdout": "Get:1 h...
...

```

I’m an edi newbie, so I don’t yet know how the Ansible playbooks are setup for the container; it seems like an apt cache problem. My host is Debian 11 (bullseye) on amd64.

Thanks again!

---

<div class="post-metadata">

**Author:** ![lueschem](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lueschem/32/214_2.png) [@lueschem](https://hub.mender.io/u/lueschem)\
**Post date:** [November 30, 2021, 10:30pm UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283/5 "2021-11-30T22:30:42Z")

</div>

Could it be that Docker is crashing the party? See also [failed to build due to python3-apt package missing · Issue #3 · lueschem/edi-var · GitHub](https://github.com/lueschem/edi-var/issues/3)

---

<div class="post-metadata">

**Author:** ![lueschem](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lueschem/32/214_2.png) [@lueschem](https://hub.mender.io/u/lueschem)\
**Post date:** [January 19, 2024, 3:37pm UTC](https://hub.mender.io/t/raspberry-pi-4-debian-bullseye-no-u-boot-edi/4283/6 "2024-01-19T15:37:24Z")

</div>

The Raspberry Pi 5 is now supported too!
