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

**URL:** https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516
**Category:** Debian family
**Tags:** debian, raspberry-pi-3, stretch, raspberry-pi-2, raspberry-pi-4, buster, edi
**Created:** [April 30, 2019, 8:19pm UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516 "2019-04-30T20:19:32Z")
**Posts on this page:** 9
**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: [April 30, 2019, 8:19pm UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/1 "2019-04-30T20:19:33Z")

</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 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](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 18.04 those tools can be installed as follows:

```bash
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](https://packages.debian.org/buster/mender-artifact) and install it on Ubuntu Bionic:

```bash
sudo dpkg -i mender-artifact*.deb

```

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:

For Raspberry Pi 3, arm64:

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

```

For Raspberry Pi 2 or 3, armhf:

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

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

```

For Raspberry Pi 2 or 3, armhf:

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

```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 U-Boot bootloader setup please take a look at this [blog post](https://www.get-edi.io/Booting-Debian-with-U-Boot/).

* * *

_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!_

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [May 2, 2019, 12:05pm UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/2 "2019-05-02T12:05:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mnachev](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@mnachev](https://hub.mender.io/u/mnachev)
#### Post date: [July 2, 2019, 8:16am UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/3 "2019-07-02T08:16:57Z")

</div>

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

---

<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: [July 2, 2019, 9:07am UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/4 "2019-07-02T09:07:02Z")

</div>

Did you install edi according to [this instructions](https://docs.get-edi.io/en/latest/getting_started.html)?  
Does the command `edi version` work? What version of Ubuntu/Debian are you using?

---

<div class="post-metadata">

### Author: ![mnachev](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@mnachev](https://hub.mender.io/u/mnachev)
#### Post date: [July 3, 2019, 11:20am UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/5 "2019-07-03T11:20:49Z")

</div>

Ubuntu 19.04 (disco)  
I installed the correct ‘edi’ application and now I have the following error:  
Error: Get [http://unix.socket/1.0:](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.

---

<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: [July 3, 2019, 5:31pm UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/6 "2019-07-03T17:31:20Z")

</div>

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

Could it be something like:

> <https://stackoverflow.com/questions/54505663/error-get-http-unix-socket-1-0-dial-unix-var-snap-lxd-common-lxd-unix-socke>

What does the command `groups` show for your user?

---

<div class="post-metadata">

### Author: ![mnachev](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@mnachev](https://hub.mender.io/u/mnachev)
#### Post date: [July 4, 2019, 5:17am UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/7 "2019-07-04T05:17:02Z")

</div>

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

---

<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: [July 4, 2019, 7:01am UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/8 "2019-07-04T07:01:14Z")

</div>

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](https://docs.get-edi.io/en/latest/getting_started.html).

---

<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: [February 5, 2020, 9:10pm UTC](https://hub.mender.io/t/raspberry-pi-2-model-b-3-model-b-b-debian-stretch-edi/516/9 "2020-02-05T21:10:56Z")

</div>

A small update: The [Raspberry Pi 4](https://www.get-edi.io/Getting-Started-with-a-new-Embedded-System/) is now also supported. The default setup got upgraded to Debian buster.
