EmonPi problem after update

Hi,
My emonPi has been running stable since installation nearly a year ago. Today I updated the emonPi for the first time and it has now stopped working properly.

I updated using the “update emonPi” button in the Pi’s local web page http://192.168.0.92/emoncms/admin/view

Now, the LCD screen on the emonPi shows
“Raspberry Pi
Booting…”

Before it locks up at this point, it shows v2.82

I ran the Update emonPi button a second time after a couple of hours to see if that would help.

I can still use the WiFi to PuTTY into the emonPi and move around the filesystem, but no data is being sent to emonCMS.org

I’ve read some previous similar posts on these forums without luck and here is some info which I see has been requested before

Here is the output of the update logfile

Filesystem is unlocked - Write access
type ' rpi-ro ' to lock
Stopping system emonPiLCD daemon:start-stop-daemon: warning: failed to kill 2493: No such process
No process in pidfile '/var/run/emonPiLCD.pid' found running; none killed.
failed!
I2C LCD DETECTED Ox27
Starting emonPi Update >

Sun Jan 8 18:01:03 UTC 2017

EUID: 1000

emonSD-17Jun2015_2updated

git pull /home/pi/emonpi
* master
Already up-to-date.
git pull /home/pi/RFM2Pi
* master
Already up-to-date.
git pull /home/pi/emonhub
* emon-pi
Already up-to-date.

Start emonPi Atmega328 firmware update:

=================================
EmonPi update started
=================================

EUID: 1000

Requirement already up-to-date: paho-mqtt in /usr/local/lib/python2.7/dist-packages
Cleaning up...
Stopping OpenEnergyMonitor emonHub: emonhub has been stopped ok.
Start ATmega328 serial upload using avrdude with latest.hex
Discrete Sampling
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/home/pi/emonpi/firmware/compiled/latest.hex
avrdude-original: Using autoreset DTR on GPIO Pin 7

avrdude-original: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude-original: Device signature = 0x1e950f
avrdude-original: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude-original: erasing chip
avrdude-original: reading input file "/home/pi/emonpi/firmware/compiled/latest.hex"
avrdude-original: input file /home/pi/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: writing flash (17898 bytes):

Writing | ################################################## | 100% 2.54s

avrdude-original: 17898 bytes of flash written
avrdude-original: verifying flash memory against /home/pi/emonpi/firmware/compiled/latest.hex:
avrdude-original: load data flash data from input file /home/pi/emonpi/firmware/compiled/latest.hex:
avrdude-original: input file /home/pi/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: input file /home/pi/emonpi/firmware/compiled/latest.hex contains 17898 bytes
avrdude-original: reading on-chip flash data:

Reading | ################################################## | 100% 1.92s

avrdude-original: verifying ...
avrdude-original: 17898 bytes of flash verified
Starting OpenEnergyMonitor emonHub: emonhub has been started ok.

Start emonhub update script:

=================================
EmonPi update started
=================================
Running emonhub automatic node addition script
EUID: 1000
EUID: 1000
[[5]]
Node 5 already present
[[6]]
Node 6 already present
[[7]]
Node 7 already present
[[8]]
Node 8 already present
[[9]]
Node 9 already present
[[10]]
Node 10 already present
[[11]]
Node 11 already present
[[19]]
Node 19 already present
[[20]]
Node 20 already present
[[21]]
Node 21 already present
[[22]]
Node 22 already present
[[23]]
Node 23 already present
[[24]]
Node 24 already present
[[25]]
Node 25 already present
[[26]]
Node 26 already present

Start emoncms update:

=================================
Emoncms update started

Sun Jan 8 18:01:21 UTC 2017

EUID: 1000
Checking cron tab for service runner entry...
service runner crontab entry already installed

git pull /var/www/emoncms
* low-write
Already up-to-date.

git pull /var/www/emoncms/Modules/nodes
* master
Already up-to-date.

git pull /var/www/emoncms/Modules/app
* master
Already up-to-date.

git pull /var/www/emoncms/Modules/config
* master
Your configuration specifies to merge with the ref 'master'
from the remote, but no such ref was fetched.

git pull /var/www/emoncms/Modules/wifi
* master
Already up-to-date.
git pull /var/www/emoncms/Modules/dashboard
* low-write
Already up-to-date.

git pull /var/www/emoncms/Modules/graph
* master
Already up-to-date.

git pull /home/pi/postprocess
Already on 'emonpi'
Already up-to-date.
git pull /home/pi/backup
* master
Already up-to-date.

update mqtt_input systemd unit file
cp: cannot stat `/var/www/emoncms/scripts/mqtt_input.service': No such file or directory
sudo: systemctl: command not found

Update Emoncms database
[]

Restarting Services...
Restarting OpenEnergyMonitor emonHub: emonhub has been restarted ok.
Log is turned off
Restarting feedwriter
Log is turned off
Restarting emoncms-nodes

sudo: systemctl: command not found

set log rotate config owner to root
Restarting Services...

Job is already running!
Start emonPi LCD service
Starting system emonPiLCD daemon:.

...................
emonPi update done
Sun Jan 8 18:02:29 UTC 2017

Filesystem is locked - Read Only access
type ' rpi-rw ' to unlock

And here is a screen grab following a few commands requested of previous posters.

Many thanks for any help on what to do.

Cheers, David.

i think the latest emonpi updates may have deleted your mqtt_input init.d service and replaced it with a systemctl unit, if you are running the june 2015 image it will be Raspbian Wheezy and not Jessie so systemctl isn’t installed and cannot be used.

This update will need some sort of test adding before it runs.

You will need to reinstate the init.d service and not use the update until it’s fixed. Something like

rpi-rw
sudo ln -s /var/www/emoncms/scripts/mqtt_input /etc/init.d/mqtt_input
sudo update-rc.d mqtt_input defaults
sudo service mqtt_input restart

should get you running again.

You might want to concider an update to the latest emonSD card build as that has Raspbian Jessie and lots of other improvements. To do that you would need to backup your data, upload a new image to your SD card and then import your data.

1 Like

Thank you Paul,

I’m very much a user and not a coder/developer. Are you saying that if I just run those three sudo commands on my Pi PuTTY console now then they will restore my installation?

Is there any way that I could have deduced that pressing the “Update” button would brick my emonPi?

Many thanks, David.

Fingers crossed, that was the intention, but more as a point in the right direction than an absolute, definitely will fix it no matter what!

Can you first confirm your OS by typing this into the terminal

cat /etc/os-release

Hopefully it’s not quite “bricked” but no, there was no way for you to know and I have submitted a “quick fix” PR to hopefully avoid anyone else getting caught out, but it would not undo what’s been done I’m afraid.

Thanks again Paul

Cheers, David.

That is Wheezy so yes try running those 4 lines (just added rpi-rw in case) one at a time and if anything screams error then report back before continuing, I should be about for the next 1/2hr or so but I’m cooking too, so replies may not be instant.

Hi Paul,
I got an error on the 2nd sudo line…?

Cheers, David.

okay, so what is the response to

ls -la /etc/init.d/mqtt_input

and

ls -la /var/www/emoncms/scripts/mqtt_input

?

Cheers, David.

that’s odd, we are looking for the file named mqtt_input that should be in scripts in emoncms, what do you get for

ls -la /www/var/emoncms/*
``

ooops! my bad that last ls command was wrong

ls -la /var/www/emoncms/*

okay, I cannot see the mqtt_script anywhere there and I do not know this build well enough to recall how or where is was originally located. So we will have to try another approach

rpi-rw
sudo rm /etc/init.d/mqtt_input
sudo wget  https://raw.githubusercontent.com/emoncms/emoncms/master/scripts/mqtt_input -O /etc/init.d/mqtt_input
sudo chmod +x /etc/init.d/mqtt_input
sudo chown root:root /etc/init.d/mqtt_input

then if all went well

sudo update-rc.d mqtt_input defaults
sudo service mqtt_input restart

Hi Paul,

I’m sorry that this is taking up so much of your time. I’ve hit another snag :frowning:

Cheers, David.

Not a problem, should probably use sudo in front of the wget (previous post edited)

Sorry, My bad this time. I ran those commands and got to “Restarting Deamon” and then I had some finger trouble when blocking text in PuTTY and seem to have run the commands again inadvertently. Does it look like anything was damaged?

Cheers, David

Not that I can see, it should be running. what do you get for the following?

sudo service mqtt_input status