Raspberry Pi 4 released

I’ll setup the docker oh tomorrow and take a look for comparison.

Given the way Docker works, I would no expect you to see a significant speed up running outside of Docker.

I think I just bricked my RPi 4, playing around with the firmware. Since RPi 4’s firmware is onboard, I think I am SOL with it.

At any rate, I restored my setup to the VM that running on my main PC, which is one of benefit of running docker. The speed difference is night and day.

System boots up in 30s, rule changes loaded in 2s.

If it turns out that I can’t revive the pi, I think I will seek some old desktop and run OH+docker on it.

Hi,

I significantly reduced issued with adding a piece of code which - at start - moves all rule files into a folder rules.offatstart and moves them back like a view minutes after start.

You might want to try that.

Regards
Ralf

Hi @rak,

Can you please elaborate on your solution? Did you put all rules in a different folder, then use shell script to move the rules back into rule folder after few minutes?

Did you use cron to do so? Did it improve boot up time? How bout rule reloading time after changes?

Thanks,
Joe

It’s implemented in openHABian, option 44 “Delay rules load”.

Good to know.

I have an additional startup script under cont-init.d/70-delay-rules

#!/bin/bash
if [[ "$STAGE" == "production" ]]
then
    echo "Renaming rules folder for delayed     loading ..."
    mkdir --parents /openhab/conf/rules.startl8r
    mv /openhab/conf/rules/* /openhab/conf/rules.startl8r/ || true
    (sleep 300; mv /openhab/conf/rules.startl8r/* /openhab/conf/rules/ || true ) &
fi

Does this makes sense to you?

Not sure whom to praise this for. I probably found this here somewhere.

Regards
Ralf

Thanks! Yes it makes sense to me.

Do you run your setup under docker and RPi?

Thanks,
Joe

Absolutely. Docker with Grafana, persistence db and OpenHAB in three dockers. RPi 3 runs hypriot. A Debian Derivate which has docker included already. It runs super stable.

Good to know. I brought my RPi 4 back to life, and need to start with a new image. I will give your delay method a try.

Now searching a 64bit image for my pi 4. Ubuntu’s image won’t boot or can’t login, debian is not supported on pi 4 yet. :frowning:

Ok, I loaded Raspbian again, and did some more testing, found something that’s very interesting.

I did a docker compose up test between alpine based and debian based docker image, with NO rules. The debian based image have the UI ready in around a minute, while the alpine based image have the UI ready in around 3 minutes!

This is interesting find. I will try again later, with debian based and my full setup to see if I can get better results.

Thanks,
Joe

There’s absolutely no point in going 64bit.
On a RPi, this just massively hurts performance because data and programs are way larger, occupying a far greater part of memory which is precious even on a 4GB Pi 4.
Leading to more paging (=> SD wearout !), possibly also explaining your different load times.

Why don’t you use openHABian? It’s Raspbian lite.
No point in running Docker on Pi either but that’s a different discussion.
Yes of course you can still install Docker on top of openHABian.

I would disagree, there are benchmarks showing performance improvements on 64bit over 32bit. Albeit minimal improvements. I am not saying that we should all go to 64bit now, but in the future, CPU design will more and more optimize for 64bit os/app, thus it always good to get ready.

I would disagree as well. Docker shouldn’t have too much overhead. I think the issue that I am facing is not due to docker but alpine on RPi. Docker really have advantages on some scenarios, such migrating your applications from host to host, and running multiple instances of same applications on the same host.

To close the loop, I think I found out what is causing the issues I was facing. As I said earlier, Alpine seems to be issue. I ran my setup on debian, with rules in, here are some results for comparison:

  • System boots in 2 minutes
  • rule parsed and loaded in around a minute
  • console, not tested in debian image

If I had to guess, I think it’s the musl lib is hindering JVM performance in ARM architecture.

I hope this finding would help someone who’s facing similar issues.

Thanks,
Joe

i

Has anyone migrate an RPI3 System with more software to the RPI4?

Actually i run:

Openhab
Grafana
Influxdb
piVCCU
ConBee

I hoped i can only switch the Raspberry and everything is fine, but i have to backup and restore every system manually, right?

1 Like

You can’t just switch the SD card to the new pi since RPi3 and RPi4 are based on different architectures.

You have to flash OpenHAB to a separate sd card and then do a manual backup of the old system and import that on the new system.

I did this process while also upgrading from OH 2.4 to 2.5 and it worked fine.

Damn. Ok. So i have a lot of work now. Thanks for your reply. Now i have to search all my files and scripts :stuck_out_tongue:

I found this instructions in https://seven1m.sdf.org/tutorials/upgrade_raspberry_pi_3_to_4_with_same_sd_card.html.
I hope they can help you:

# Upgrade (Swap) Your Raspberry Pi 3 to a Raspberry Pi 4 Using the Same SD Card

*written October 2019*

I recently upgraded my home Raspberry Pi server hardware from the Raspberry Pi model 3 to model 4. I was not interested in reinstalling Raspbian and all my home server software, so I went searching for a way to swap the SD card over to the new hardware.

Raspberry Pi 4, for a reason I'm not familiar with, requires a larger  `boot`  partition. You cannot just insert your existing SD card into the new Raspberry Pi 4, because the code necessary to boot it won't be there.

In short, the fix for this is:

1. Upgrade Raspbian
2. Enlarge the boot partition
3. Update the bootloader
4. Swap the card

Read on for the specifics...

1. **Make a backup!**  Pop the card in your laptop or desktop computer and image the SD card to a file. [Here is a guide for that.]([https://thepihut.com/blogs/raspberry-pi-tutorials/17789160-backing-up-and-restoring-your-raspberry-pis-sd-card](https://thepihut.com/blogs/raspberry-pi-tutorials/17789160-backing-up-and-restoring-your-raspberry-pis-sd-card))
2. While your SD card is still in your old Raspberry Pi, upgrade your version of Raspbian to Raspbian Buster. Basically, do this:
  1. `sudo apt update && sudo apt dist-upgrade`
  2. reboot
  3. edit the file  `/etc/apt/sources.list.d/raspi.list`  and change the word "stretch" to "buster". Save the file.
  4. `sudo apt update && sudo apt dist-upgrade`
  5. reboot
3. If that went well, then you need to shut down your Pi and take out the SD card. Pop it in your laptop or desktop with a special program running: [GParted]([https://gparted.org/](https://gparted.org/)). If your computer isn't running Linux, you can download a Live CD version of GParted and boot from a CD or USB. There are guides for helping you with that.
4. Point GParted at your SD card and do these two things, then apply changes:
  1. Move the second partition to the right by about 200MB.
  2. Enlarge the first partition to fill the available space. Be sure not to change the start position of the first partition, or your Pi won't boot. Also make sure your first partition is at least 250 MB.Once the changes are applied, unmount the SD card and put it back in your Raspberry Pi 3.
5. Run the following command:  `sudo apt install --reinstall raspberrypi-bootloader raspberrypi-kernel`
6. Swap the SD card over to the new Raspberry Pi and boot it up!
1 Like

I have almost the same stack running on my Pi4, though running as docker containers.
It is true that the learning curve is steep. Once things are running you can in no time move applications between nodes. Before Pi4 docker was on limit regarding memory, so just Oh was able to run more or less stable as standalone app.
I used before Pi4, rock64 as my production server. Moving from rock64 to rpi4 was less then 1 hour job.

1 Like

I read the instructions and I think it’s even easier to do the method I described. Plus: you have a new and clean copy of OpenHAB. Just use

openhab-cli backup --full

However I think you should do whatever you feel more comfortable with. But always do a backup upfront!

What does --full do differently than just openhab-cli backup ?