Cant update EmonCMS via GUI

Hi folks, hope you’re all doing well.

I’m having some issues updating using the GUI - “Full Update”, “Update Emoncms” etc buttons don’t seem to do anything.

I’ve installed via the EmonScripts onto a Proxmox LXC of Ubuntu 22.04.

From the CLI, if I run …

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

… then it runs just fine and updates correctly.

If I echo to /var/log/emoncms/update.log, then its shows in the GUI “Update Log” output.

Does anyone happen to know what’s triggered when you hit the “Full Update” button please? Assuming its a bash script, am hoping to next check that it’s in the correct folder location and has correct permissions etc.

Thanks in advance!

Hello James! good to see you at Everything Electric!

The full update button calls the admin/update-start api: emoncms/Modules/admin/admin_controller.php at master · emoncms/emoncms · GitHub which in turn runs:

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh all $firmware_key $serial_port

Could it be the firmware and serial port options that are causing it to fail?

Hey @TrystanLea - thanks for your help as always! :grinning:

OK, so running as pi …

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

… I’m first given the choice of branch …

Screenshot 2024-10-21 at 7.51.56 am

… seems the only way past this is to hit ‘q’ and it then moves on.

I think this is normal, but assume nothing! haha.

From that point off it goes. It doesn’t seem to have too many issues.

WARNING local changes in /opt/openenergymonitor/emonhub - Module not updated

EmonHub doesn’t update due to local changes - my EmonHub update file is different due to the Sontex and Eastern meters.

In general, it seems to run and complete ok.

If I try running …

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh all $firmware_key $serial_port

… its the same. :cry:

Are the firmeware_key and serial_port global variables, or should I be replacing these with something specific for testing?

I’ve diff’d the two outputs - nothing different other than time stamps and download speeds.

I’ve uploaded the complete output in case something is odd.

Output.txt (7.9 KB)

Here are my permissions in that update folder

and here are the permissions in the log folder

Home something here helps?

Having the same problem here, last update run on 19th October worked fine. “Full update” and “Update EmonCMS” buttons now just open a blank log window, the log file is precisely 0 bytes long !

I’ve been running the standard Emon system on an RPi3b for several years, nothing unusual so I assume it’s a problem introduced by the last software update ?

Any thoughts before I resort to using the CLI to run the update ?

PaulM

Is the service service_runner running? Check the log with journalctl. (might not be an underscore in the name).

Oh and is redis running as well?

Hey @borpin Brian, thanks for your help.

Oct 21 07:56:28 emoncms service-runner[88092]: Connected to redis server
Oct 24 19:11:00 emoncms systemd[1]: redis-server.service: Deactivated successfully.
Oct 24 19:11:00 emoncms systemd[1]: redis-server.service: Consumed 19min 38.552s CPU time.
Oct 24 19:11:04 emoncms service-runner[185]: Connected to redis server
Oct 24 19:42:15 emoncms systemd[1]: redis-server.service: Deactivated successfully.
Oct 24 19:42:15 emoncms systemd[1]: redis-server.service: Consumed 2.160s CPU time.
Oct 24 19:44:10 emoncms service-runner[232]: Connected to redis server
Oct 24 19:51:45 emoncms systemd[1]: redis-server.service: Deactivated successfully.
Oct 24 20:03:07 emoncms service-runner[235]: Connected to redis server
Oct 25 23:19:54 emoncms systemd[1]: redis-server.service: Deactivated successfully.
Oct 25 23:19:54 emoncms systemd[1]: redis-server.service: Consumed 2min 4.621s CPU time.
Oct 25 23:21:27 emoncms service-runner[256]: Connected to redis server

I believe so, please see above?
Also ran the below …

➜  ~ sudo systemctl status redis-server
* redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2024-10-25 23:21:26 BST; 1 week 2 days ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 118 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 115460)
     Memory: 4.0M
        CPU: 13min 31.335s
     CGroup: /system.slice/redis-server.service
             `-118 "/usr/bin/redis-server 127.0.0.1:6379" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""

Oct 25 23:21:26 emoncms systemd[1]: Starting Advanced key-value store...
Oct 25 23:21:26 emoncms systemd[1]: Started Advanced key-value store.
➜  ~ sudo systemctl status service-runner
* service-runner.service - Emoncms service-runner Input Script
     Loaded: loaded (/etc/systemd/system/service-runner.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/service-runner.service.d
             `-override.conf
             /usr/lib/systemd/system/service-runner.service.d
             `-service-runner.conf
     Active: active (running) since Fri 2024-10-25 23:21:26 BST; 1 week 2 days ago
       Docs: https://github.com/emoncms/emoncms/blob/master/scripts/services/install-service-runner-update.md
   Main PID: 256 (python3)
      Tasks: 1 (limit: 115460)
     Memory: 14.4M
        CPU: 81ms
     CGroup: /system.slice/service-runner.service
             `-256 /usr/bin/python3 /var/www/emoncms/scripts/services/service-runner/service-runner.py

Oct 25 23:21:26 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Oct 25 23:21:27 emoncms service-runner[256]: Starting service-runner
Oct 25 23:21:27 emoncms service-runner[256]: Connected to redis server
➜  ~

So try (from memory)

journatctl -f -u service-runner

And then press the button to see what happens.

(related thread Emoncms on Ubuntu 20.04 with scripts - #30 by borpin)

➜  ~ sudo journalctl -f -u service-runner
Oct 24 19:51:45 emoncms systemd[1]: Stopped Emoncms service-runner Input Script.
-- Boot 0f30a61123034356923685ed5825435a --
Oct 24 20:03:06 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Oct 25 23:19:54 emoncms systemd[1]: Stopping Emoncms service-runner Input Script...
Oct 25 23:19:54 emoncms systemd[1]: service-runner.service: Deactivated successfully.
Oct 25 23:19:54 emoncms systemd[1]: Stopped Emoncms service-runner Input Script.
-- Boot d2f1c9309e484f668a60fa3c3626e7ae --
Oct 25 23:21:26 emoncms systemd[1]: Started Emoncms service-runner Input Script.




Thanks … having a good read of that thread now.

The output for

journalctl -f -u service-runner

doesnt change at all when hitting the “Full Update” button (or any other update buttons.)

I tried the instructions on that thread to change over to python2 in the service-runner.py and service-runner.service.

It didn’t seem to like it that much … so have changed it back.

➜  ~ journalctl -f -u service-runner
Nov 04 09:14:19 emoncms systemd[1]: service-runner.service: Failed with result 'exit-code'.
Nov 04 09:14:49 emoncms systemd[1]: service-runner.service: Scheduled restart job, restart counter is at 5.
Nov 04 09:14:49 emoncms systemd[1]: Stopped Emoncms service-runner Input Script.
Nov 04 09:14:49 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Nov 04 09:14:49 emoncms service-runner[569]:   File "/var/www/emoncms/scripts/services/service-runner/service-runner.py", line 23
Nov 04 09:14:49 emoncms service-runner[569]:     print("Connected to redis server", flush=True)
Nov 04 09:14:49 emoncms service-runner[569]:                                             ^
Nov 04 09:14:49 emoncms service-runner[569]: SyntaxError: invalid syntax
Nov 04 09:14:49 emoncms systemd[1]: service-runner.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:14:49 emoncms systemd[1]: service-runner.service: Failed with result 'exit-code'.
Nov 04 09:15:19 emoncms systemd[1]: service-runner.service: Scheduled restart job, restart counter is at 6.
Nov 04 09:15:19 emoncms systemd[1]: Stopped Emoncms service-runner Input Script.
Nov 04 09:15:19 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Nov 04 09:15:19 emoncms service-runner[615]:   File "/var/www/emoncms/scripts/services/service-runner/service-runner.py", line 23
Nov 04 09:15:19 emoncms service-runner[615]:     print("Connected to redis server", flush=True)
Nov 04 09:15:19 emoncms service-runner[615]:                                             ^
Nov 04 09:15:19 emoncms service-runner[615]: SyntaxError: invalid syntax
Nov 04 09:15:19 emoncms systemd[1]: service-runner.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 09:15:19 emoncms systemd[1]: service-runner.service: Failed with result 'exit-code'.
^C```

Ok, so there is a way to check the command is hitting REDIS, but I can’t remember what it is!

There are 2 parts to REDIS as well (though again it is a while since I played with that) @TrystanLea

IIRC, the button sends a command into a redis buffer which service-runner picks up and actions. We have had issues with this before :frowning:

It is an old thread!

Yeah, figured it was worth a shot … it wasn’t! haha :laughing:
Thanks for all your help here though … very much appreciated.

@Greebo - you did some work on this previously.

I know there is a way to see what is going into Redis, but can’t remember how!

I found this thread:

1 Like

There’s also L21 and L36 from the service-runner Python script:

So you could easily put a quick Python script together to check Redis based on that

1 Like

Yes I had too, but there were some commands I was shown as to how to watch the redis buffer and see what was being added.

And this Development Roadmap 2019 - Robust Backup Process - #32 by borpin

Ah, found this Multi-instance service-runner - #26 by pb66

There are a couple of redis-cli commands there (you may need to install the cli package).

1 Like

Wow, I’d forgotten that whole discussion!

1 Like

OK, this is way cleverer than I am - I surrender! haha

Just to check, I appreciate it should be run on a Pi, but is there any Linux distro / version that’s known to work on a VM / Proxmox LXC without issue? I’ve seen a few threads each with what seems like their own lists of things that either work or not.

Thanks for all the help on this thread.

1 Like

I’ll have look at some point.

I have a 22.4 install running happily :slight_smile:

Thanks Brian - appreciate the help. :grinning:
I’ll spin up a new 22.4 LXC and see how I get on. :+1:t2: