# Development of Raspbian Gladys 4 Image - Reflection

**URL:** <https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920>\
**Category:** Développement\
**Created:** [September 11, 2019, 2:23pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920 "2019-09-11T14:23:33Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 11, 2019, 2:23pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/1 "2019-09-11T14:23:33Z")

</div>

Hello everyone!

As I mentioned in my last newsletter, one of my priorities right now is to create an official Raspbian image for Gladys 4.

**The specifications are as follows:**

- Must be functional for all versions of the Raspberry Pi (1, 2, 3, 4, Zero, Zero W, etc…)
- Gladys 4 installed via Docker
- Must be able to update itself without having to connect via CLI.
- Gladys data (DB, etc..) stored in `/var/lib/gladysassistant`
- USB ports managed and exposed in Docker
- Hostname «&nbsp;gladys&nbsp;»

**My current problem**

From what I’ve found, there is currently a problem with the latest versions of Docker on ARMv6 devices (i.e., Raspberry Pi 1 and W). The builds do not run on these Rasps.

See:  
[https://github.com/moby/moby/issues/38175](https://github.com/moby/moby/issues/38175)  
[https://github.com/moby/moby/issues/39542](https://github.com/moby/moby/issues/39542)

One possibility is to switch back to an older version of Docker, BUT without switching to Raspbian Buster, as these versions have only been built on Stretch.

From my tests, it seems there are not many solutions:

1. Create 2 different images: one for Raspberry Pi ARMv6 (Rpi 1 and W) and one for the others (2, 3, 4). The image for Raspberry Pi ARMv6 would be based on Stretch. (This is a lot of work)
2. Create only one image under Buster, and say that Gladys is no longer compatible with Raspberry Pi 1/W (I’m not a fan of this solution)
3. Use the latest version of [HypriotOS](https://blog.hypriot.com/downloads/), an OS based on Raspbian Buster with the latest version of Docker pre-installed. I haven’t tested it yet, but HypriotOS seems to be a good solution!
4. Use HypriotOS + flash + cloud-init! That would be the ultimate combo, the goal being to create the image via CLI on my side thanks to a cloud-init YAML file ([Example](https://github.com/hypriot/flash/blob/master/sample/rainbow.yml)), then without ever booting it, publish it as is on the site. Thus, the image is very clean (since I never booted it on my side) and on the first startup, the image downloads + runs the Gladys 4 Docker image in its latest version. The advantage is that the image is always up to date. The disadvantage is that the Raspberry Pi must be connected to the internet on the first startup of Gladys, and the download can take a bit of time on slow connections.

In short, it’s work in progress, I’m open to feedback, if you have any remarks/tips, I’m interested 🙂

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [September 11, 2019, 3:19pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/2 "2019-09-11T15:19:24Z")

</div>

Clearly, the downside of solution 4 is not really a downside, I think most RPIs have internet access, completely offline RPIs are isolated cases, and the users in question are in the «&nbsp;expert&nbsp;» category and will know how to handle it 😁.

Solution 5 would be to build an RPI image with QEMU.  
[https://github.com/RPi-Distro/pi-gen](https://github.com/RPi-Distro/pi-gen)

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 11, 2019, 3:28pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/3 "2019-09-11T15:28:28Z")

</div>

I agree that solution 5 is the «&nbsp;perfect&nbsp;» solution, but it’s also the most time-consuming ^^ Not easy to set everything up and understand everything!

I think I have more added value at the moment working on the services 🙂

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 11, 2019, 3:56pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/4 "2019-09-11T15:56:33Z")

</div>

I just tested method 4 on a Raspberry Pi 1, equivalent to a Pi Zero W, not very representative of the fleet, but better to test under the worst conditions to know what to expect.

The setup time is still quite long… It’s not very fast for the user. The `docker pull` takes forever (on fiber, but the Ethernet port is slow + the CPU struggles to decompress the layer archives).

I think the best solution for now is to mix solutions 3 and 4:

- I create the image with cloud-init on my side
- Then I run it once on a Pi 1 so that the pull + the start happens once (the DB initializes this way)

At first boot, the user will have a Gladys instance running almost immediately, which is surely smoother for the end user.. We’re not yet at the complete automation of the image build, but for me the priority #1 is the user experience!

---

<div class="post-metadata">

**Author:** ![Hamtaro](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/hamtaro/32/2373_2.png) [@Hamtaro](https://community.gladysassistant.com/u/Hamtaro)\
**Post date:** [September 11, 2019, 7:41pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/5 "2019-09-11T19:41:01Z")

</div>

What does «&nbsp;plombe&nbsp;» mean to you?

Because personally, I don’t mind letting it run for 30-60 minutes… 😛

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 12, 2019, 6:21am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/6 "2019-09-12T06:21:10Z")

</div>

> [@Hamtaro](#):
>
> What does «&nbsp;une plombe&nbsp;» mean to you?

20 minutes 😃

Actually, it’s not the length that’s unclear for the user, what’s unclear is that there’s no external feedback. You plug in the Pi and wait, and if it doesn’t work, you don’t know what went wrong… And especially if there’s an error, everything is messed up and unless you look in the cloud-init logs, you’ll never really know what went wrong.

Example: I had DNS resolution issues with the docker hub during the docker pull (really stupid issues, it was enough to restart the command), and so nothing worked ^^

If we want the product to be usable without CLI, the installation process must be flawless. The less we do on the client side, the more sure we are that everything will be fine.

Well, as a first step, I took a hybrid approach, built on Raspberry Pi 1 with:

- A Docker container Gladys 4 that listens on port 80, accessible at gladys.local
- A Watchtower container

Both with restart=always, so it should always be fine.

I’m testing the image on a newer Pi to see if everything works!

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 12, 2019, 6:25am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/7 "2019-09-12T06:25:05Z")

</div>

I still think one of the drawbacks of this method is:

When the user starts for the first time, if their version of Gladys is not up to date, Watchtower will automatically update it. However, the user will probably be setting up their Gladys and the server will restart while the user is in the middle of configuration! Not very clean either.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 12, 2019, 6:36am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/8 "2019-09-12T06:36:08Z")

</div>

Tested on Raspberry Pi 4, what a pleasure!

 ![02](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/4/4ee166c4f3a82d8c6c5071554c633dbe4ba40ed7.jpeg)

 ![52](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/7/74365e3d4fd1dec169e0cfc66a6fec719906476d.jpeg)

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 12, 2019, 7:22am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/9 "2019-09-12T07:22:47Z")

</div>

Et hop, a first quite basic image of Raspbian Gladys 4:

[https://mirror-fr-2.gladysassistant.com/releases/gladys-4-alpha-1.img.zip](https://mirror-fr-2.gladysassistant.com/releases/gladys-4-alpha-1.img.zip)

- Tested on Raspberry Pi 1 and 4
- Based on HypriotOS 1.11.1 (Docker 19.03.0 CE + Raspbian Buster)
- USB ports functional (tested with a [Zwave.me](http://Zwave.me) key)
- Automatic update with Watchtower

Let me know if you have any feedback 🙂

---

<div class="post-metadata">

**Author:** ![Reno](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/reno/32/5939_2.png) [@Reno](https://community.gladysassistant.com/u/Reno)\
**Post date:** [September 12, 2019, 10:17am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/10 "2019-09-12T10:17:33Z")

</div>

Hello everyone,

I would like to share my opinion on this topic as I have developed quite a bit on RPi with Docker and on all models.

The issues with the armv6 models (Pi1 and 0) are recurring, but in my opinion, Hypriot’s OS is not the ultimate solution as it can be limiting:

For my part, I like to do several things with the Raspberry. Also, on HypriotOS, it is not possible to work with all hardware interfaces (I have never managed to integrate a simple OneWire temperature sensor). Similarly, it is very complicated to use a screen connected via HDMI on this OS.  
As a result, using HypriotOS, the Pi’s use will be limited to Gladys and it will be necessary to ensure that all USB devices are properly recognized.

In my opinion, it would be better to stick with Raspbian (but this is just my simple opinion and the first I give on the forum 😉).  
Also, given the posts from yesterday, I looked at the Docker issues:  
[docker-ce segmentation fault on Raspbian](https://github.com/moby/moby/issues/38175#issuecomment-498346817)

I was thus able to install Docker 19.03.2 on Raspbian Buster on a RPi0W.  
I can detail if it is useful to you.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 12, 2019, 10:52am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/11 "2019-09-12T10:52:59Z")

</div>

Thanks @Reno for your feedback!

If you can detail the procedure, I’m interested 🙂

I have no experience with HypriotOS, I thought it was just a Raspbian Buster with Docker installed, but indeed it might be better to have a classic Raspbian Buster if we can do it

---

<div class="post-metadata">

**Author:** ![Reno](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/reno/32/5939_2.png) [@Reno](https://community.gladysassistant.com/u/Reno)\
**Post date:** [September 12, 2019, 1:11pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/12 "2019-09-12T13:11:00Z")

</div>

With pleasure, if it can help 👍

Apparently, the problem comes from the binary ‹&nbsp;containerd&nbsp;› (v1.2.6-3) which is not compiled for armv6 and since the [container.io](http://container.io) project is not «&nbsp;yet&nbsp;» free according to what I understood, we cannot compile it ourselves…  
On the other hand, Hypriot offers a slightly lower version (v1.2.6-1) on its servers that works on armv6 but I did not understand how it was made.  
So you just need to retrieve a Debian package and install it manually:  
`curl -s https://packagecloud.io/install/repositories/Hypriot/rpi/script.deb.sh | sudo bash`  
`wget --content-disposition https://packagecloud.io/Hypriot/rpi/packages/raspbian/buster/containerd.io_1.2.6-1_armhf.deb/download.deb`  
`sudo dpkg -i containerd.io_1.2.6-1_armhf.deb`  
I am not sure that the first line is mandatory. To be tested

Then install Docker:  
`curl -sSL https://get.docker.com | sh`

Regarding Hypriot, I had tested it more than a year ago, even two (time flies…) before switching back to Raspbian. According to what I had read, hardware access was not a concern for the project, but maybe that has changed since?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 12, 2019, 2:18pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/13 "2019-09-12T14:18:49Z")

</div>

Got it, I understand the story better! 🙂

I’ll keep this in mind and as soon as I test, I’ll post a message here. It’s clear that it’s probably better to have a classic Raspbian if you want to keep other programs around Gladys.

---

<div class="post-metadata">

**Author:** ![Hamtaro](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/hamtaro/32/2373_2.png) [@Hamtaro](https://community.gladysassistant.com/u/Hamtaro)\
**Post date:** [September 22, 2019, 6:55am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/15 "2019-09-22T06:55:24Z")

</div>

The management would be different, everything will be included from the start. 😉

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 23, 2019, 6:59am UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/17 "2019-09-23T06:59:25Z")

</div>

Exactly 🙂 For now, there’s only Z-Wave, MQTT, RTSP Camera, Telegram & DarkSky.

There are quite a few services in the process of migration (Xiaomi, Philips Hue, Sonos, ..), it’s working!

---

<div class="post-metadata">

**Author:** ![damalgos](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@damalgos](https://community.gladysassistant.com/u/damalgos)\
**Post date:** [September 23, 2019, 2:25pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/19 "2019-09-23T14:25:47Z")

</div>

The goal is to migrate all modules, including sonoff. It is currently in a pull request (a developer is working on the module). It should therefore arrive in due time, depending on the progress of the development.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [September 23, 2019, 3:04pm UTC](https://community.gladysassistant.com/t/developpement-image-raspbian-gladys-4-reflexion/4920/20 "2019-09-23T15:04:01Z")

</div>

@damalgos +1, indeed the Sonoff service is currently being migrated by @AlexTrovato. The PR on MQTT has been migrated recently, so this should be able to unlock this service.

> [@VRatel09](#):
>
> Will we be able to talk to Gladys via a Google Home other than through IFTTT?

For now, direct Google Home integration is not in my short-term development plans (there’s already a lot of work on the service migration!), but in the long term, why not. As always, any PR is welcome 🙂
