I’m running an emonpi on latest software. Yesterday I went in locally and did an “update all”. All seemed to be working OK and has been logging to emoncms web just fine for the last 24h etc.
However, something else happened with the Wi-Fi today (another problem for later) and I tried connecting to the emonpi locally again.
Unfortunately I’ve come up with 2 errors which I don’t know the fix for.
First was:
Can’t connect to database, please verify credentials/configuration in settings.ini
Error message: Connection refused
I tried restarting the pi and now get the following error:
Fatal error: Uncaught Error: Call to undefined function set_emoncms_lang() in /var/www/emoncms/index.php:152 Stack trace: #0 {main} thrown in /var/www/emoncms/index.php on line 152
Even now it is still logging to emoncms web app just fine, but any advice on how to fix this?
I did read some bits about updating the settings.ini file - but to be honest I’ve not idea how to do that!
@TrystanLea
I just used the built in updater through the web interface (just going to IP and logging in locally), just clicked “update all” and left it to run.
It was rebuilt in October time so is on July 20 image version.
To copy into the settings.ini do I need to physically remove the SD card from the emonpi and do it on a PC or is there a better way to do it?
Or I worry that there’s a larger problem underlying it, perhaps a card fault. It might be worth restoring onto a new card Import / Backup - Guide | OpenEnergyMonitor cant think why the errors would have otherwise happened on a July 20 image…
It was also a new card back in October when it go rebuilt, so hoping it isn’t a card fault!
I did read through the SSH guide earlier, I’m on Win10, all connected with Putty. I know some basic python but honestly no idea how to get that stuff above onto a pi.
pi@emonpi:/var/www/emoncms $ ls -lh /var/www/emoncms/settings.php
ls: cannot access '/var/www/emoncms/settings.php': No such file or directory
Local emoncms still gives the same error
Fatal error : Uncaught Error: Call to undefined function set_emoncms_lang() in /var/www/emoncms/index.php:152 Stack trace: #0 {main} thrown in /var/www/emoncms/index.php on line 152
@TrystanLea Short of a total rebuild any other suggestions for a fix?
It’s all still feeding just fine through to emoncms.org but getting the same error for local login.
A rebuild wouldn’t be a disaster as it’s a pretty standard solar setup, but a bit of a pain.
@TrystanLea - my thoughts exactly! At least it means there’s no great rush, over Christmas, to get it fixed, but would be nice.
Output here:
pi@emonpi:~ $ cd /var/www/emoncms
pi@emonpi:/var/www/emoncms $ git status
On branch stable
Your branch is up to date with 'origin/stable'.
nothing to commit, working tree clean
pi@emonpi:/var/www/emoncms $
@TrystanLea I seems to get a permission denied error to read the log. Newbie to putty/ssh so I’m probably doing something wrong (logged in with pi/emonpi2016)
I also just did a manual update, seemed to run OK, but alas still get the same error when connecting directly through web browser.
Here’s the full update script in case it’s helpful
pi@emonpi:~ $ /opt/openenergymonitor/EmonScripts/update/service-runner-update.sh all emonpi
Starting update via service-runner-update.sh (v3.0) >
- emonSD version: emonSD-24Jul20
- supported images: emonSD-24Jul20 emonSD-02Oct19 emonSD-17Oct19
- emonSD base image check passed...continue update
git pull /opt/openenergymonitor/EmonScripts
master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.
nothing to commit, working tree clean
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Mon 21 Dec 22:16:51 GMT 2020
EUID: 1000
openenergymonitor_dir: /opt/openenergymonitor
type: all
firmware: emonpi
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (18.1-5+rpt1).
The following package was automatically installed and is no longer required:
rpi-eeprom-images
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 75 not upgraded.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: redis in /home/pi/.local/lib/python3.7/site-packages (3.5.3)
Hardware detected: EmonPi
Stopping emonPiLCD service
Display update message on LCD
Running apt-get update
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Err:1 http://archive.raspberrypi.org/debian buster InRelease
Splitting up /var/lib/apt/lists/archive.raspberrypi.org_debian_dists_buster_InRelease into data and signature failed
Get:3 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Hit:4 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages
Hit:5 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages
Hit:6 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Packages
Ign:4 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages
Ign:5 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages
Ign:6 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Packages
Hit:4 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages
Hit:5 http://raspbian.raspberrypi.org/raspbian buster/non-free armhf Packages
Hit:6 http://raspbian.raspberrypi.org/raspbian buster/rpi armhf Packages
Fetched 13.0 MB in 21s (618 kB/s)
Reading package lists... Error!
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://archive.raspberrypi.org/debian buster InRelease: Splitting up /var/lib/apt/lists/archive.raspberrypi.org_debian_dists_buster_InRelease into data and signature failed
W: Failed to fetch http://archive.raspberrypi.org/debian/dists/buster/InRelease Splitting up /var/lib/apt/lists/archive.raspberrypi.org_debian_dists_buster_InRelease into data and signature failed
W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Splitting of clearsigned file /var/lib/apt/lists/archive.raspberrypi.org_debian_dists_buster_InRelease failed as it doesn't contain all expected parts
E: The package lists or status file could not be parsed or opened.
git pull /opt/openenergymonitor/emonpi
* master
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Fetching origin
Already up to date.
git pull /opt/openenergymonitor/RFM2Pi
* master
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Fetching origin
Already up to date.
Start emonhub update script:
-------------------------------------------------------------
emonHub update
-------------------------------------------------------------
git fetch --all --prune -v
Fetching origin
From https://github.com/openenergymonitor/emonhub
= [up to date] stable -> origin/stable
= [up to date] MQTTSubscriberInterfacer -> origin/MQTTSubscriberInterfacer
= [up to date] emon-pi -> origin/emon-pi
= [up to date] env_example -> origin/env_example
= [up to date] include_serial_number -> origin/include_serial_number
= [up to date] lanip-status -> origin/lanip-status
= [up to date] master -> origin/master
= [up to date] redis_config_interface -> origin/redis_config_interface
= [up to date] unitless_decoder -> origin/unitless_decoder
git status
On branch stable
Your branch is up to date with 'origin/stable'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/src
nothing added to commit but untracked files present (use "git add" to track)
git pull origin stable
From https://github.com/openenergymonitor/emonhub
* branch stable -> FETCH_HEAD
Already up to date.
Running emonhub install & update script emonSD_pi_env:1
--------------------------------------------------------------------
Reading package lists... Error!
E: Splitting of clearsigned file /var/lib/apt/lists/archive.raspberrypi.org_debian_dists_buster_InRelease failed as it doesn't contain all expected parts
E: The package lists or status file could not be parsed or opened.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.7/dist-packages (1.5.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.21.0)
Requirement already satisfied: pybluez in /usr/local/lib/python3.7/dist-packages (0.23)
Requirement already satisfied: py-sds011 in /usr/local/lib/python3.7/dist-packages (0.9)
Requirement already satisfied: sdm_modbus in /usr/local/lib/python3.7/dist-packages (0.4.4)
Requirement already satisfied: pyserial in /usr/lib/python3/dist-packages (from py-sds011) (3.4)
Requirement already satisfied: pymodbus>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from sdm_modbus) (2.4.0)
Requirement already satisfied: six>=1.15.0 in /usr/local/lib/python3.7/dist-packages (from pymodbus>=2.3.0->sdm_modbus) (1.15.0)
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (0.7.0)
The user `emonhub' is already a member of `gpio'.
Unit /etc/systemd/system/[email protected] is masked, ignoring.
useradd: user 'emonhub' already exists
- installing emonhub.service
- Service ActiveState=active
--------------------------------------------------------------------
Running emonhub automatic node addition script
[[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
[[12]]
Node 12 already present
[[13]]
Node 13 already present
[[14]]
Node 14 already present
[[15]]
Node 15 already present
[[16]]
Node 16 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:
-------------------------------------------------------------
Update Emoncms Core
-------------------------------------------------------------
Checking status of /var/www/emoncms git repository
- git branch: stable
- no local changes
- running: git pull origin stable
Fetching origin
From https://github.com/emoncms/emoncms
* branch stable -> FETCH_HEAD
Already up to date.
Update Emoncms database
[]
-------------------------------------------------------------
Update Emoncms Services
-------------------------------------------------------------
emoncms_mqtt.service already installed
feedwriter.service already installed
service-runner.service already installed
Reloading systemctl deamon
Restarting Services...
- sudo systemctl restart feedwriter.service
--- ActiveState=active ---
- sudo systemctl restart emoncms_mqtt.service
--- ActiveState=active ---
- sudo systemctl restart emonhub.service
--- ActiveState=active ---
/opt/openenergymonitor/EmonScripts/sudoers.d/emoncms-rebootbutton: parsed OK
emonPi emoncms admin reboot button sudoers updated
-------------------------------------------------------------
Update Emoncms Modules
-------------------------------------------------------------
------------------------------------------
Updating /var/www/emoncms/Modules/app module
------------------------------------------
- git branch: stable
- git tags: 2.2.2-2-gd345c22
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
------------------------------------------
Updating /var/www/emoncms/Modules/config module
------------------------------------------
- git branch: stable
- git tags: 2.0.5-6-gd28ff1e
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
------------------------------------------
Updating /var/www/emoncms/Modules/dashboard module
------------------------------------------
- git branch: stable
- git tags: 2.0.8-9-gdc07d12
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
------------------------------------------
Updating /var/www/emoncms/Modules/device module
------------------------------------------
- git branch: stable
- git tags: 2.0.7
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
------------------------------------------
Updating /var/www/emoncms/Modules/graph module
------------------------------------------
- git branch: stable
- git tags: 2.0.9-3-g6c18b0c
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
------------------------------------------
Updating /var/www/emoncms/Modules/setup module
------------------------------------------
- git branch: stable
fatal: No names found, cannot describe anything.
- git tags:
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
------------------------------------------
Updating /var/www/emoncms/Modules/wifi module
------------------------------------------
- git branch: stable
- git tags: 2.0.3
- no local changes
- running: git pull origin stable
Fetching origin
Already on 'stable'
Your branch is up to date with 'origin/stable'.
Already up to date.
/opt/openenergymonitor/EmonScripts/sudoers.d/wifi-sudoers: parsed OK
wifi sudoers entry updated
------------------------------------------
Updating /opt/emoncms/modules/backup module
------------------------------------------
- git branch: stable
- git tags: 2.2.6
- no local changes
- running: git pull origin stable
Already up to date.
Already on 'stable'
Your branch is up to date with 'origin/stable'.
------------------------------------------
Updating /opt/emoncms/modules/demandshaper module
------------------------------------------
- git branch: stable
- git tags: 2.1.2
- no local changes
- running: git pull origin stable
Already up to date.
Already on 'stable'
Your branch is up to date with 'origin/stable'.
------------------------------------------
Updating /opt/emoncms/modules/postprocess module
------------------------------------------
- git branch: stable
- git tags: 2.1.4
- no local changes
- running: git pull origin stable
Already up to date.
Already on 'stable'
Your branch is up to date with 'origin/stable'.
------------------------------------------
Updating /opt/emoncms/modules/sync module
------------------------------------------
- git branch: stable
- git tags: 2.0.5-3-g109816f
- no local changes
- running: git pull origin stable
Already up to date.
Already on 'stable'
Your branch is up to date with 'origin/stable'.
------------------------------------------
Updating /opt/emoncms/modules/usefulscripts module
------------------------------------------
- git branch: stable
fatal: No names found, cannot describe anything.
- git tags:
- no local changes
- running: git pull origin stable
Already up to date.
Already on 'stable'
Your branch is up to date with 'origin/stable'.
--------------------------------------------
Backup module installation and update script
--------------------------------------------
- Loading EmonScripts config.ini
- Copying default.config.cfg to config.cfg
- Setting config.cfg settings
- Backup module symlink already exists
- PHP Version: 7.3
- Creating /etc/php/7.3/mods-available/emoncmsbackup.ini
post_max_size = 3G
upload_max_filesize = 3G
upload_tmp_dir = /var/opt/emoncms/backup/uploads
- phpenmod emoncmsbackup
- /var/opt/emoncms/backup already exists
- /var/opt/emoncms/backup/uploads already exists
- restarting apache
Update Emoncms database
[]
-------------------------------------------------------------
EmonPi LCD Update
-------------------------------------------------------------
Reading package lists... Error!
E: Splitting of clearsigned file /var/lib/apt/lists/archive.raspberrypi.org_debian_dists_buster_InRelease failed as it doesn't contain all expected parts
E: The package lists or status file could not be parsed or opened.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: redis in /home/pi/.local/lib/python3.7/site-packages (3.5.3)
Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.7/dist-packages (1.5.0)
Requirement already satisfied: xmltodict in /home/pi/.local/lib/python3.7/site-packages (0.12.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.21.0)
- reinstalling emonPiLCD.service
Removed /etc/systemd/system/emonPiLCD.service.
Removed /etc/systemd/system/multi-user.target.wants/emonPiLCD.service.
- installing emonPiLCD.service
Created symlink /etc/systemd/system/multi-user.target.wants/emonPiLCD.service → /opt/openenergymonitor/emonpi/lcd/emonPiLCD.service.
Created symlink /etc/systemd/system/emonPiLCD.service → /opt/openenergymonitor/emonpi/lcd/emonPiLCD.service.
- Service ActiveState=active
Stopping emonPiLCD service
Display update message on LCD
-------------------------------------------------------------
EmonPi Firmware Update (Discrete Sampling)
-------------------------------------------------------------
Start ATmega328 serial upload using avrdude with latest.hex
Attempt: 1
avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex
Note: progress written to logfile /var/log/emoncms/firmware.log
avrdude-original: Using autoreset DTR on GPIO Pin 7
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
avrdude-original: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude-original: Device signature = 0x1e950f (probably m328p)
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 "/opt/openenergymonitor/emonpi/firmware/compiled/latest.hex"
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: writing flash (18526 bytes):
Writing | ################################################## | 100% 2.63s
avrdude-original: 18526 bytes of flash written
avrdude-original: verifying flash memory against /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: load data flash data from input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex:
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex auto detected as Intel Hex
avrdude-original: input file /opt/openenergymonitor/emonpi/firmware/compiled/latest.hex contains 18526 bytes
avrdude-original: reading on-chip flash data:
Reading | ################################################## | 100% 1.99s
avrdude-original: verifying ...
avrdude-original: 18526 bytes of flash verified
avrdude-original: safemode: Fuses OK (E:00, H:00, L:00)
avrdude-original done. Thank you.
SUCCESS: flash verifed
waiting for emonpi to stop controlling LCD
Starting emonPi LCD service..
-------------------------------------------------------------
emonPi update done: Mon 21 Dec 22:20:22 GMT 2020
-------------------------------------------------------------
restarting service-runner
Thanks @pearsonhenry2 there are some package list errors in there, but otherwise the emoncms update goes fine, so Im still not sure what’s causing the issue.
It may be that there is some filesystem corruption that is causing locale.php to only partially load perhaps…
I think it would be best to burn the latest image again to a new SD card. If your only using it to post data to emoncms.org, you could just enter the emonhub config on the new image rather than using the import tool.