Permanent "Raspberry Pi Booting..." after failed emonPi Update

Great, Thank you so much @TrystanLea.

Hi @TristanLea,
Finally, I ran the update to 10.0.2, and it completed with no glitches on EMONSD-07nov16.
Great, and thank you for supporting that SD image again.

After the update, I rebooted the EmonPi. When I go to the Backup page (thought a backup of the new version is a good thing to do), I get a lot of similar errors where the backup buttons and log window should be. The errors read:
Deprecated: Comments starting with ‘#’ are deprecated in /home/pi/backup/config.cfg on line 3 in /home/pi/backup/backup-module/backup_controller.php on line 25

The error repeats 12 times, with varying line numbers in the middle of the message, but always on line 25 at the end of the message.

How can I get the backup back to working order?

This is interesting! I’m not sure how that has gone undetected for so long!

Apparently the # symbol is no longer recognised as a comment line in php7.

https://www.php.net/manual/en/function.parse-ini-file.php

So the comments in backup/default.config.cfg (why it has a .cfg extn when it’s actually an .ini file I know not!) all need changing to use a semi-colon.

[edit] PR submitted

Very helpful @pb66, replacing the # with the semi-colons ; fixed it, - at least step 1 -, and the backup page is now displaying fine on the Emoncms page. Thank you!

However, when I try and start a backup, it seems not to like the new semi-colons at all. The following errors show in the backup/export log:

=== Emoncms export start ===
Sun  9 Jun 14:20:05 NZST 2019
Backup module version:
"version"      : "2.0.0"
EUID: 1000
Reading /home/pi/backup/config.cfg....
/home/pi/backup/config.cfg: line 1: syntax error near unexpected token `;'
/home/pi/backup/config.cfg: line 1: `; Emoncms Export and Import scripts config file'
Location of databases:
Location of emonhub.conf:
Location of Emoncms:
Backup destination:
emoncms backup module location /Modules/backup
Image version: emonSD-07Nov16
PHP Warning:  chdir(): No such file or directory (errno 2) in /home/pi/backup/get_emoncms_mysql_auth.php on line 27
PHP Warning:  require(process_settings.php): failed to open stream: No such file or directory in /home/pi/backup/get_emoncms_mysql_auth.php on line 30
PHP Fatal error:  require(): Failed opening required 'process_settings.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/pi/backup/get_emoncms_mysql_auth.php on line 30
Error: Cannot read MYSQL authentication details from Emoncms settings.php

Powered by OpenEnergyMonitor.org | low-write 10.0.2

I notice that my PHP is Version: 5.6.27-0+deb8u1 (Zend Version 2.6.0), but I would have no idea whether I should nor how to update PHP.

What should I do next to get the backup working again? Many thanks for your help.

Ah ok! Looking closer at it, it seems the config.cfg file is used by both the PHP code in emoncms and also the bash script that is run outside of emoncms via the service-runner.

What seemed like a simple deprecated comment symbol isn’t as straightforward as it would seem now.

Firstly why is this being thrown as an error on php5.6 if it only affects php7.x?

And secondly why is the file being read into emoncms as a ini using parse_ini_file() if it’s not strictly an ini file?

It is quite possible that this will get addressed as part of the new installer changes in the pipeline, otherwise, I think it’s probably the parse_ini_file() function that will need swapping out for something more compatible.

There’s a related discussion going on in the emonSD issues created using new scripts + emonhub environment file thread about using environment files.

I’m going to close my PR and raise an issue for this pending further discussion.

As a quick fix you mighty find that deleting all the comments works as it seems to be that the actual key value pairs weren’t considered an issue by either end.

[edit] Issue raised

This was only added recently (Commit) @TrystanLea.

That commit shows it being changed, but using the parse_ini_file() function pre-dates that commit.

In fact if you trace it back further it was introduced to the master repo in January

but was actually originally submitted by your good self in a PR back in February 2018

But we were still using Jessie (php5.6) back then, less so in January this year though.

Oh! And I just spotted the “tinkering” with php.ini using sed in the install script (and the hardcoded path for php7)

perhaps this could/should be done either in a drop-in to /etc/php/7.0/apache2/conf.d or maybe we could include the php directives in the new apache2 vhost?

ref 16.04 - Correct way to modify php.ini for Apache and/or CLI - Ask Ubuntu and PHP: How to change configuration settings - Manual

all 3 of those edited directives are available to set in either location, unfortunately AFAICT only one of the 3 can be set in .htaccess which might have been the ideal location.

1 Like

Ha, so I did :slight_smile:.

Thanks @pb66 for the explanations. It seems something much bigger now.

It raises the question of how many other ini/cfg files will be affected by this? I don’t know much about EmonPi, but I guess the Import feature and maybe many other functions are affected too? Crontab?

Is there a need or easy way to return to the previous version of 9.9.2?

Many thanks for the always helpful replies.