Can't connect to emoncms local

@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.

@pearsonhenry2 thats strange could you print the output of the following here:

cd /var/www/emoncms
git status

@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 $

Hmm, that all looks fine… could you copy the contents of /var/log/emoncms/emonpiupdate.log here?

You could also try running the updater again manually:

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh all emonpi

@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)

pi@emonpi:~ $ /var/log/emoncms/emonpiupdate.log
-bash: /var/log/emoncms/emonpiupdate.log: Permission denied
pi@emonpi:~ $ 

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.

What is strange is that the set_emoncms_lang function that it cant find, is … or should be in /var/www/emoncms/locale.php (towards the bottom emoncms/locale.php at master · emoncms/emoncms · GitHub) which is always loaded by the index.php script (towards the top emoncms/index.php at master · emoncms/emoncms · GitHub). Git is saying that you dont have any local changes and its all up to date so I cant quite make sense of that.

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.

Sorry about this hassle

@TrystanLea Thank you.
Got a new 16GN microSD on order for tomorrow, will give a new install a go.

From last time a new install is actually pretty quick - the longest part is getting the pi casing open and closed again!

1 Like

Is the card full?

@borpin
Is there an easy way to check, (perhaps via SSH) to see if the card is full?

Yes :slight_smile:

df -h

Thanks!

I don’t think it is full:

pi@emonpi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       4.1G  2.0G  2.0G  51% /
devtmpfs        431M     0  431M   0% /dev
tmpfs           463M     0  463M   0% /dev/shm
tmpfs           463M   18M  446M   4% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           463M     0  463M   0% /sys/fs/cgroup
tmpfs           1.0M     0  1.0M   0% /var/lib/php/sessions
tmpfs            30M     0   30M   0% /tmp
tmpfs           1.0M     0  1.0M   0% /var/tmp
/dev/mmcblk0p3  9.9G   17M  9.4G   1% /var/opt/emoncms
/dev/mmcblk0p1  253M   54M  199M  22% /boot
log2ram          50M   11M   40M  21% /var/log
tmpfs            93M     0   93M   0% /run/user/1000
pi@emonpi:~ $

Will rebuild at some point in the next few days.

What does running

sudo apt-get update

from the command line do? Do you still see the errors?

Google the error you do see.
[edit]

The most common solution is to remove the lists. I have seen 2 different removal suggestions;

  1. Remove the file sources.list
    sudo rm -fr /etc/apt/sources.list
    and
    sudo rm /var/lib/apt/lists/*

  2. Run the update process. It will create the file again
    sudo apt-get update

@borpin I removed the various list files and re-ran an update, which went OK.
Re-ran a whole emonpi update and went with no errors, but alas didn’t work.

Did a fresh image today onto a new 16GB card so should be good for a bit. Slightly odd that etcher went through the whole thing and at the end of validation said failed, but all is working fine. Even went into emoncms local and did an “update all” and was fine.
Put in my emoncms.org API, re-synced feeds and all is working fine again now.

Don’t want to jump off topic too much but quick question - before this problem my pi dropped off the Wi-Fi and thus online feeds stopped updating. What is the best option for setting up some kind of alert for this?
I assume the email alert feature is decrepit/retired? (New emoncms features part 2 - Email notifier - Blog | OpenEnergyMonitor)

If the Pi drops off the WiFi it can’t then tell you is isn’t on the network :frowning:

Any way for emoncms.org to alert that the API feed is static? Or any other way (IFTT etc.) that works well to alert that the feed isn’t updating?

@pearsonhenry2
Yes – “If the Pi drops off the WiFi it can’t then tell you is isn’t on the network”.

An alternative (which I use) could be to run a script (daily?) that sends you an email with the message eg: “ALL OK – I’m online”. Then if you don’t receive the daily email you know something is amiss.

It appears that you are concerned about feeds to emoncms.org not happening.
If emoncms.org is used solely for backup reasons then having a local backup would side step the loss of WiFi issue.

The local backup would be to the SDHC but it could also be copied to a USB flash drive as an added protection:

Going further (as I do) it is possible to have a second Raspberry Pi on the local network (hardwired) that receives the data from the first RPi. This adds a further level of backup protection.

Also I can envisage a script (using nmap?) running on the second RPi that periodically checks for the WiFi connected first RPi and sends an email if it’s not found on the network.

By sheer coincidence, I’ve recently posted to a thread re: sending emails:

Hope some of this may help

@johnbanks
I use emoncms.org as the main data store/feed (I manage it kind of remotely, not always present).

I know that, in theory, if the pi loses connection, when it regains internet connection it should upload the missing data, but some kind of alert that the pi has dropped off the Wi-Fi is useful to know something is up.

A local pi, hardwired, running a little script that checks for a live feed every 1h would be good. Would be great if emoncms.org could identify and alert of frozen feeds.

For now I’ve gone with using my Unifi Cloud Key email alerts. Turned on email alerts for client disconnects and setup an email filter to filter out everything except for the emonpi ones (based on mac address).

@pearsonhenry2

The system I “manage” is at my son’s place so I do so remotely.

I use:

It enables me to work with every RPi as if I was on- site.

And for Fair Use (up to 10 devices) it’s free to use.

@johnbanks thanks for the info on that, I’ll give it a go installing tomorrow, but looks ideal.