Community
OpenEnergyMonitor

Community

Raspbian Stretch

Tags: #<Tag:0x00007f6e0f9851f0> #<Tag:0x00007f6e0f985010> #<Tag:0x00007f6e0f984ef8>

I’ve just rebuilt emoncms on a Raspberry Pi v3 using the current standard operating system - Raspbian Stretch, and taken the opportunity to update many of the modules in the process.

This build uses the Mariadb database instead of MYSQL for two main reasons;
Firstly, Mariadb is now the default Raspberry Pi database, and replaces MYSQL in the Raspbian source list.
Secondly, Mariadb is open-source, which fits nicely into the ethos of emoncms.

Other notable changes are that it uses PHP v7.0, and php-redis v3.1.1 and many other updated modules.

I would be grateful for comments, including if Mariadb is to be the preferred database for emoncms/raspberry pi, also it would be good if beta testers could give feedback.

Paul

Ref: Installing emoncms on Raspbian Stretch

3 Likes

This is very timely, my jessie “dev” Emoncms RPi (installed completely to HDD) suffered a HDD crash and needs rebuilding .
I’ll get Stretch onto it in preparation :smiley:

Hi Paul

About a week ago I needed to build a new Node-Red installation without realising the latest OS was stretch.

NodeRed was fine but I could not install mosquitto due to dependency issues so I reverted to Jessie.

Did you install mosquitto without issues?

Ian

Yes, mosquitto v3.1.1 is running fine.
I haven’t had chance to implement it into emoncms yet, but as far as mosquitto is concerned, it’s running together with mosquitto_client, on my stretch installation OK.
I had no unmet dependencies or errors in the install logs.

The best way to install appears to be …

sudo apt update; sudo apt upgrade -y
sudo apt install -y mosquitto mosquitto-clients

Paul

Hi Paul, what sort of feedback are you after on your guide?
I’m about to start running through it on my Pi and on first read through picked this:

Which probably should say php7. Its purely a cosmetc thing, did you want to know about small things like that as I go through it?

I want the guide to be clear and not open to mis-interpritation, so any typos, in fact anything that can be worded better would be welcome, as well as any technical difficulties.

Paul

Ok, can do. Just post it here?
I’ll put it all together in one post if there is anything else…

1 Like

I’ve also just updated the MQTT guide - https://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
The path to PHP7.0 is different to PHP5!

Paul

With the change in database, can the existing system backup processes/scripts be used? Can existing backups be restored ?

I’ve not used the emonpi script, but I’ve backed up from my old MYSQL databases and restored them successfully to Mariadb without a glitch (using dropbox_uploader).

The only stumbling block I found was that you need to use sudo to log in as root, but once you know about it… and won’t have any impact once the emoncms database has been created, as per the build guide.

I can’t imagine the emonpi script having any problems whatsoever as the export/import commands are identical, but I’m sure that before any new emonpi images are made, Glyn will check it.

Also, nothings set in stone at this stage, it may be that @glyn.hudson would prefer MYSQL?

Paul

From the MariaDB web page:

For all practical purposes, MariaDB is a binary drop in replacement of the same MySQL version (for example MySQL 5.1 -> MariaDB 5.1, MariaDB 5.2 & MariaDB 5.3 are compatible. MySQL 5.5 is compatible with MariaDB 5.5 and also in practice with MariaDB 10.0).

Which makes sense as it’s made by the original developers of MySQL.

We’ve got no particular preference for MYSQL, happy to entertain other options if there is an advantage. Nice work testing Stretch :+1:

1 Like

Hi Paul,
I’ve just run through the guide with very few problems, so great work on a draft.
This line didn’t work:

there is a missing “.0-” after php7-curl, php7-dev, php7-mcrypt and php7-common
The corrected line is:

The next correction is a few lines later (already mentioned this in my post above but to keep it all together I’ll repeat it here):

should be:

A little further down, this probably should be changed to the equivalent systemctl command

While that technically works, two commands above: sudo a2enmod rewrite provides the following output:

So I suggest the Apache restart is updated to:

Further down still you’ve got this line:

How do I know if redis support is needed? Is it worth pointing to a link on why I would want it?

The next suggestion is a little further down again:

Any reason you don’t use command chaining as you’ve been doing before this step? Suggest it becomes:

This next section doesn’t explain why we need to disable serial console boot or what changes need to be made to the /boot/cmdline.txt.
My /boot/cmdline.txt was already different because I’d moved everything to a USB HDD.
I think it would be better if you explained what part to remove rather than provide the replacement line.

I had already disabled serial console using raspi-config as part of my “standard” build, so none of the above commands were relevant.
FWIW, sudo raspi-config, choose item 5, then item P6, then No, then Yes, essentially does the same thing without the fear of stuffing up /boot/cmdline.txt
There’s a redundant console=tty1 in your /boot/cmdline.txt too.

Everything went pretty smoothly, with the exception of the apt-get command up the top, every command worked exactly as expected (and I tried very hard to ensure I just copied and pasted them directly)

One last thought, it might be worth adding the step to fix /etc/sudoers as the Administration Web page has “Shutdown Unsupported” where the Shutdown/Reboot buttons should be and when you click on “Shutdown Unsupported”, you get:

2 Likes

Thanks for testing @Greebo, I didn’t think of documenting the install process until it was half done, so it’s great that you’ve picked up on these issues.
I’m back home tomorrow night, so I’ll update the guide when I get to my laptop again.

Paul

@pb66 Paul you’re the expert when it comes to serial ports! what is your view pls?
As I understand, disabling serial via raspi-config disables both serial & kernel messages.

Paul

I’m not sure if you understand that it disables serial completely, or disables serial login (& kernel messages).
Assuming you were concerned about the former, the raspi-config settings I mentioned (and sorry for the shorthand before) were:
From the main menu, choose:
5. Interfacing Options
Then choose:
P6 Serial
You will then be prompted with the following two questions:
Would you like the shell to be accessible over serial?
Select <No>
Would you like the serial port hardware to be enabled
Select <Yes>

Which results in :
The serial login shell is disabled
The serial interface is enabled

EDIT: I’ve been doing a lot of searching in the Pi forums since I posted this and there does seem to have been a bug in raspi-config that did not correctly remove entries from boot/cmdline.txt when following the above steps.
It appears to have been fixed now, but it would certainly be worth others testing this!

Yes, that’s my understanding too.
…but … @pb66 is the emonhub lead, which deals with the serial input process.

So out of etiquette, I would welcome Paul’s comments before implementing.

Paul

Yes of course. I wasn’t trying to suggest otherwise, simply clarifying my statements :slight_smile:

The other feedback has been implemented here prior to being merged.,

Does that look OK?

Paul

1 Like

I’ve had a (quickish) read through and it looks good, great clarification on redis too BTW.

I need to head to work now, but when I get home tonight I will start again from scratch with a Stretch-Lite image and run through it all again step by step to check it all one more time.

1 Like