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

**URL:** <https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963>\
**Category:** Emoncms\
**Tags:** emonpi\
**Created:** [18 May 2019 12:51 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963 "2019-05-18T12:51:59Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![Juerg1](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@Juerg1](https://community.openenergymonitor.org/u/Juerg1)\
**Post date:** [29 May 2019 22:32 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/21 "2019-05-29T22:32:48Z")

</div>

Great, Thank you so much @TrystanLea.

---

<div class="post-metadata">

**Author:** ![Juerg1](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@Juerg1](https://community.openenergymonitor.org/u/Juerg1)\
**Post date:** [8 June 2019 03:52 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/22 "2019-06-08T03:52:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [8 June 2019 13:22 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/23 "2019-06-08T13:22:25Z")

</div>

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](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.

> <https://github.com/emoncms/backup/blob/2.0.0/default.config.cfg>

[edit] PR submitted

> <https://github.com/emoncms/backup/pull/37>
>
> ref https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-aft…er-failed-emonpi-update/10963/22?u=pb66 and https://www.php.net/manual/en/function.parse-ini-file.php

---

<div class="post-metadata">

**Author:** ![Juerg1](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@Juerg1](https://community.openenergymonitor.org/u/Juerg1)\
**Post date:** [9 June 2019 02:32 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/24 "2019-06-09T02:32:47Z")

</div>

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:

```auto
=== 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](http://openenergymonitor.org)** **| [low-write 10.0.2](https://github.com/emoncms/emoncms/releases)**

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.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [9 June 2019 09:12 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/25 "2019-06-09T09:12:41Z")

</div>

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](https://community.openenergymonitor.org/t/emonsd-issues-created-using-new-scripts-emonhub-environment-file/10918) thread about using environment files.

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

> [@Juerg1](#):
>
> What should I do next to get the backup working again?

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

> <https://github.com/emoncms/backup/issues/38>
>
> ref https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-aft…er-failed-emonpi-update/10963/22?u=pb66 and https://www.php.net/manual/en/function.parse-ini-file.php
> 
> Originally I submitted PR #37 to swap out the hashes for semi-colons but that caused and issue for the bash script so I closed it again.
> 
> Note that reading the parse\_ini\_file() changelog the use of hashes should effect php7.0 users, but as it turns out, the linked case is a php5.6 setup ????

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [9 June 2019 10:16 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/26 "2019-06-09T10:16:46Z")

</div>

> [@pb66](#):
>
> 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?

This was only added recently ([Commit](https://github.com/emoncms/backup/commit/906392240194e20d1aa1cedc42865cca046a6494#diff-18872fcf7588b8622aaf94fd9303c188)) @TrystanLea.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [9 June 2019 11:19 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/27 "2019-06-09T11:19:15Z")

</div>

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

> <https://github.com/emoncms/backup/commit/340b384bc302d693cf79c24d7d50a362324d4e12>

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

> <https://github.com/emoncms/backup/pull/12>
>
> The task is to make the backup module work on non pi systems.
> 
> I have modified… this so that the config file now resides in the php folder and is read by both the php side and the bash side. I am not sure if this is a security issue or not.
> 
> I have also added in some file exist checks for non EmonPi setups.
> 
> Phpfiwa was not backed up.
> 
> This now needs more development in identifying different base systems and reacting accordingly.
> 
> feedwriter is not stopped currently (commented out) as I don't have it installed. The service could be checked for existing & running.
> 
> As I say, just a start on this.

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)

> <https://github.com/emoncms/backup/blob/master/install.sh#L17-L25>

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](https://askubuntu.com/questions/849748/correct-way-to-modify-php-ini-for-apache-and-or-cli) and [PHP: How to change configuration settings - Manual](https://www.php.net/manual/en/configuration.changes.php)

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.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [9 June 2019 11:49 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/28 "2019-06-09T11:49:10Z")

</div>

> [@pb66](#):
>
> but was actually originally submitted by your good self in a PR back in February 2018

Ha, so I did 🙂.

---

<div class="post-metadata">

**Author:** ![Juerg1](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@Juerg1](https://community.openenergymonitor.org/u/Juerg1)\
**Post date:** [9 June 2019 21:01 UTC](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963/29 "2019-06-09T21:01:25Z")

</div>

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.

[Previous page](https://community.openenergymonitor.org/t/permanent-raspberry-pi-booting-after-failed-emonpi-update/10963.md?page=1)
