Raspberry Pi 4

With a few minor changes Im glad to report that the EmonSD build script (alpha release) works on the Pi4 with Buster! :slight_smile:

I’ve created a specific branch of the build script for buster which can be found here:
https://github.com/openenergymonitor/EmonScripts/tree/buster

The main changes are:

Full details of the build script - including the current state of development can be found here:
EmonSD build script progress update and beta release

See installation readme here for full steps on how to use the build script on RPI4 Buster: https://github.com/openenergymonitor/EmonScripts/tree/buster/install

1 Like

Yes, correct. We’ll be making a revision to the faceplate. Well noticed!

We will keep this Pi4 up and running here to test its stability, to see if there are any issues with the php mosquitto client or any other component. Obviously only a quick test so far.

Interesting article. It’s really great how their manufacturing in the UK (Wales even!). We have always manufactured all OEM hardware in the UK, and for the past few years in Wales. The factory is a 10min drive from our office which is very handy.

In general, it should be possible to detect the OS / RPi version so keeping a single script.

I’d thought about the PHP version problem before as you could move to 7.2 on Stretch.I’m sure I found a really neat way to get the version but cannot find it now :frowning: but you could use

php -v | sed -e '/^PHP/!d' -e 's/.* \([0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/'

Doh. Chicken and egg. Need to get the version to be installed from apt first.

Or else make it a variable to be set by the user.

Also, can you not just use the generic ‘php’ for the apt-get commands with the distribution picking up the default version?

Be good to keep a single set of scripts that auto adjusted as necessary IMHO.

Good to know it looks like it works.

1 Like

I agree!

The main “apt-get install” line could use all non-version specific package names like so

sudo apt-get install -y php-gd php-opcache php-curl php-pear php-dev php-mcrypt php-common php-mbstring

They all (except mcrypt?) have virtual or dependency packages to facilitate this

php-gd
php-opcache
php-curl php-dev
php-common
php-mbstring

as does php-mysql and php. It seems only php-mcrypt doesn’t have a package for php7.3/Buster.

(all the links above are to the Stretch packages, use the release selector at the top right to view Buster versions)

Also there isn’t any need for the

sudo apt-get install -y libapache2-mod-php

as that is a dependency of php, so whether apache2 is installed or not, the libapache2-mod-php package will get installed with php.

The mariadb-client package is the default for either Buster or Stretch, since the “mysql-client” package in Stretch installs the " default-mysql-client" which is mariadb, so again both can use “mariadb-client

So the only place the installers would differ then is in the paths for the extensions to be installed to, and once the package installer has been used to install “php” it is easy to query what has been installed and use that in the path eg

PHP_VER=$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d"." )

then

printf "extension=mosquitto.so" | sudo tee /etc/php/${PHP_VER}/mods-available/mosquitto.ini 1>&2

or

printf "extension=redis.so" | sudo tee /etc/php/${PHP_VER}/mods-available/redis.ini 1>&2

I have a 4GB Pi4 here but I haven’t tried emoncms or emonSD etc yet.

2 Likes

I did wonder whether to use the non version specific package names, I actually did it that way the first time but got a couple of warnings when installing the mods-available extensions. So I thought I would just stick to the way it was done before. Happy to change it to non version specific package names as it does work and the warnings are just warnings at the end of the day.

What warnings were they? At the end of the day if the modules installed are the same, the extensions should be none the wiser, so perhaps there is a subtle difference that isn’t so obvious?

I haven’t got it here now, it was warning that I had only installed the extension in php/7.3 and not php/7.2 and php/7.1 as well as I think it seems to install all those version folders if you don’t specify the php version.

I’ve created a development branch with your proposed changes @pb66 I havent tested it yet, I will get a chance on wednesday I think https://github.com/openenergymonitor/EmonScripts/compare/development?expand=1 the version seems to be required for php-opcache

That’s annoying!

Apparently mcrypt has been deprecated in PHP 7.2 and that’s why there is no php7.2-mcrypt package is available. instead apt-get selects php7.1-mcrypt. Should we review using mcrypt in emoncms? What is it used for specifically?

pi@raspberrypi:~ $ sudo apt-get install --dry-run php php-mysql php-gd php-opcache php-curl php-pear php-dev php-mcrypt php-common php-mbstring
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php7.1-mcrypt' instead of 'php-mcrypt'
Package php-opcache is a virtual package provided by:
  php7.3-opcache 7.3.4-2
  php7.2-opcache 7.2.9-1+b2
  php7.1-opcache 7.1.20-1+b2
You should explicitly select one to install.

E: Package 'php-opcache' has no installation candidate

In fact is opcache still used / essential?

There are variations on the package lists, this one from the LinuxInstall docs

sudo apt-get install apache2 mysql-server mysql-client php libapache2-mod-php php-mysql php-curl php-pear php-dev php-json git-core redis-server build-essential php7.2-mbstring -y

doesn’t list either the mcrypt or opcache extensions, but it does list json which doesn’t appear in the latest list.

Oddly, it uses mainly version-less package names except for the mbstring (which is available via “php-mbstring”) and mcrypt is present in the “PHP7” but absent from the “PHP7.2” package lists which is in-keeping with it being deprecated and raises a question about whether it is still needed.

Are we sure we still need all these additional packages?

1 Like

I think we may already be using a different method, (not that I am sure in shape or form) as we save a separate “salt” in the user db.

When you search the repo for mcrypt, it only appears in the docs, not in the code and (very) quick look at the module functions suggests all functions start with “mcrypt”.

This issue (User salt too short · Issue #351 · emoncms/emoncms · GitHub) suggests it was used in the events module which was dropped in v8.4.

it looks like it was used for a “phpmailer” in the events module. we use swiftmailer (via PECL) in the current emoncms and afaik there is no mcrypt depependency there.

1 Like

Sorry for the late response but i have been away due to family health problems.

Yes, i will test but i can’t do it at least, for now (family first). i would like to swap the rpi on the emonpi in favor of the new rpi 4 4GB.
I have a few projects in mind for the emonpi and the rpi 4 with 4GB Ram and the use of SSD on the usb3 are what was missing. If you design new faceplates for rpi4 on Emonpi, could you send some for me? Not for free, of course.
I want to put a 10" screen on my wall with all the details about energy consumption, temperatures, weather,home presence, water and gas consumption,etc.

Thanks
Celso

Thanks @pb66 @borpin I will review your points, test the dependencies next time I test this, likely sometime next week.

Now that Buster has reached “stable” release you may get this warning when you update

pi@emonBase:~ $ sudo apt-get update
Get:1 http://archive.raspberrypi.org/debian buster InRelease [25.1 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Get:3 http://archive.raspberrypi.org/debian buster/main armhf Packages [205 kB]
Reading package lists... Done
E: Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'testing' to 'stable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

to update you need to run

sudo apt-get update --allow-releaseinfo-change

[ref [SOLVED] Buster 'apt-get update' issue - Raspberry Pi Forums]

I guess this command will be needed on all fresh images until the next buster raspbian image is released.

In case this affects anyone, there’s a design flaw in the USB-C port:

1 Like

There is one bug:
At the admin page, is missing the equipment information and the shutdown/reboot buttons.
There is no RPi equipment information. It would be good to add a disable/enable button for ssh. It did not work adding a SSH file on root folder.
For my 5 min testing, is what i found.
I used a newly downloaded Raspbian Buster with desktop, used the script to install emoncms and others and was working good.

1 Like

The SSH file needs to be in the boot folder not the root folder.

There was a PR to update the model information file. This may still be on master branch so you would need to switch to that. The scripts pull the stable branches I think.

This might be the reason.

Can you post the server information from the admin page (just select copy as markdown and paste into a message).

Great to hear that it worked for you @CelsoHenriques.

The scripts do currently pull the master branches https://github.com/openenergymonitor/EmonScripts/blob/master/install/config.ini#L31 as its all still in testing, I thought it easier just to be on the master branch.

Thanks for the issues in the EmonScripts repo @borpin,

@CelsoHenriques if you can also add any issues you see there that would be great, I wont get a chance to work on this for a month or so, but when I do get back to it it would be good to keep track of the issues.

1 Like