2015 emonPi upgrade fatal error

Perhaps naively - I clicked the ‘upgrade’ button on my Nov 2015 (pi 2) emonPi, then had to install the default settings.php file and re-enter the original username & password to access sql.

I’m now getting the following error messsage:

Emon Pi
Fatal error: Can’t use function return value in write context in /var/www/emoncms/Modules/user/user_controller.php on line 122.

  1. What else is required to allow emonPi to complete booting?

  2. I have ordered a replacement SD card - apart from the couple of lines of editing referred to in the installation instructions - is this card likely to boot successfully in such and old emonPi?

Thanks

Hello @wmcausland. I havent seen the error “Fatal error: Can’t use function return value in write context in /var/www/emoncms/Modules/user/user_controller.php on line 122.” before, but searching google I think its caused by a php compatibility issue.

The error is being triggered by this line in the code:
https://github.com/emoncms/emoncms/blob/master/Modules/user/user_controller.php#L122

you could if you feel adventurous, SSH into the emonPi and comment out lines 117 through to 152 to see if it works again. If that’s the only issue I can rewrite those lines to support php 5.4 which might be a good idea to do anyway.

I would double check the SD card compatibility for you.

What emonSD build version are you running?

See output of

$ ls /boot | grep emonSD

Please could you post your update log file so we can see what’s gone wrong, it’s located in:

/home/pi/data/emonpiupdate.log

Hi guys!
I’m in the same position …I have an unused EmonPi since 2015 …
yesterday, I connect it and began to use I prefer to update it, and click on update button in admin section, replace settings.php by default.setting.php in var/www/emoncms/ and re-enter some data (usr, passw, mqtt_enabled = false …etc) :
Fatal error : Can’t use function return value in write context in /var/www/emoncms/Modules/user/user_controller.php on line 122

ls /boot | grep emonSD don’t return nothing…
/home/pi/data /emonpiupdate.log does not exist…

image

thanks!

Hi again!! I commented lines from 117 to 152 like say Tristan …
it seems that work one step more…but :

image

thanks!

OK -my emonSD is 17jun2015, But couldn’t find an update log in the location suggested.

As Xavi is still having issues after amending the suggested lines, I decided to try inserting my newly pre-built SD card which arrived this morning (great service!).

As per the install instructions, I attempted to edit /boot/config.txt using Paragon ExtFS under windows, but there were no files visible in the boot directory to edit.
I put the new SD card into the emonPi anyway - but couldn’t access it using ssh through putty, or using a browser on either ethernet or wifi.

I have ordered a replacement complete EmonPi as I have limited time now to get this current project working.

Is it possible to return the old emonPi for refurbishment, and to update it to Pi3?

The ‘boot’ location mention by Glyn is the boot partition, it should mount fine under windows as its a FAT partition. You will also need to add a file called ‘ssh’ to the boot partition to enable ssh.

Yes sure, if you email us at [email protected] we can sort that for you.

Hello @Xavi_Gorriz

There is an authentication bypass to run the updater in this case.

Add the following line to the bottom of settings.php in /var/www/emoncms/settings.php to enable a special database update only session, be sure to remove this line from settings.php once complete:

$updatelogin = true;

In your internet browser open directly the admin/db page to launch the database update script.

http://localhost/emoncms/admin/db

You should now see a list of changes to be performed on your existing emoncms database.


Alternatively you can run the database updater from terminal with:

php emonpi/emoncmsdbupdate.php

Hi !! Finally it seems works ok… at the moment, I can log by web browser and try to send some feeds/inputs from a script runnig in other raspberry…

In fact this 2015 EmonPi, is a gift from my brother that has bought in 2015, never used but very manipulated ( I see the last commands in terminal, and he edited a lot of files …)
I have some issues that I’m not sure that are normal or maybe something was misconfigured…

I think that I should to do a factory restore or better download the newest EmonSD?

thanks!

If there is no specific data you want to retain on it, the simplest solution is definitely to start with the newest SD image.

Take note of the handful of specific changes required if you do not have a Pi3 though.

I got hit by exactly the same issue. So far I’ve :slight_smile:

  • commented out the lines in user_controller.php
  • Re-set the database

But I see in various pages errors like :

I’ve tried to re-flash with “emonSD-30Oct18 (Stable)” but that failed - the shipped SD card is 4G and the image is 8G.

I’ve re-used a 64G SD card but so far the emonpi is stuck on “Raspberry Pi booting” and doesn’t appear to boot.

Also this image mentions removing arm_freq and arm_freq_min but they didn’t exist.

The image " emonSD-07Nov16" does fit on the original card and boots.

Any advice ? Sort of regret hitting the upgrade button now …

OK - all working now!
I ordered a pre-build SD card, and it arrived the next day - cost £9 plus postage.
I inserted the card into a Usb card reader into my Windows 10 PC. The boot partition is readable in windows and came up as the first drive letter. Downloaded notepad ++, and edited config.txt to comment out the lines relating to a Pi3 ( arm_freq=1200 arm_freq_min=600) and saved the file. Inserted card into my old Pi2 emonPi, and powered it up.
SSH’d in using putty. Did a factory reset to be sure. Waited until all updated, and wifi access point showing on LCD screen. Removed ethernet cable and connected to wifi access point and configured wifi. All looks good! recommended route for old emonPi.

+1
good morning to all and thanks in advice …

the downloaded image is fresh (I download 14 nov ) and works more or less good …at least, boots ok.
The file config is in the boot partition visible in Win. if its connected in any USB…

I flash a new 16 Gb SD, edit arm_frecs in config file and boot raspberry pi2 …
and the same issue in some pages …

what can we do??

Hi @Greebo !!

Certainly I don’t have any data to backup in a 2015 version, then I reflash the last image, and I began to make some test and …like @plord I have some issues :
Uncaught TypeError: Cannot read property ‘push’ of undefined

I open a new topic (I undertand is another and diferent problem …)

Thanks!

@Xavi_Gorriz @plord, as mentioned here We’re having trouble replicating this here. We have added improved logging of JavaScript errors to give a line number in the latest update (v9.9.5). Would you mind running emonpi update to pull in the latest and see if the error appears again, hopefully this time with a line number.

Great to see annotated tags tags being used, but…

Not to labour a point (:face_with_raised_eyebrow:) but https://github.com/emoncms/emoncms/releases/latest

Change log have been added for 9.9.5 https://github.com/emoncms/emoncms/releases/tag/9.9.5

I would recomend if possible downloading the latest emonSD-13Oct18 SD card image and flashing to a fresh SD card. We also sell pre-loaded 16GB SD cards in the shop:

https://openenergymonitor.com/emonsd-pre-loaded-raspberry-pi-sd-card/

A 2015 emonPi will probable be running emonSD-17Jun15 which will be running a very old and potentially now insecure version of Debian. The new image has got all the latest security patches.