Emoncms on Ubuntu 20.04 with scripts

Or should I stop wasting time and install Ubuntu 18.04?

You could - might be simpler as long as Python is still there.

You need to install pip for python2.

Should work and then you need

pip install redis

or

pip2 install redis

Still don’t understand why it worked when you did it manually. It shouldn’t have!

thanks, that sorted it service-runner is now operational and the backup function is also working.

image

Do I need to worry about the log file that doesn’t exist and update not working via the web interface when using Ubuntu?

Could you post the commands you needed to do to get it working please for reference?

If you

journalctl -f -u service-runner

and then run the update you should see something like this or an error.

Aug 11 17:28:17 emonpi service-runner[596]: Starting service-runner
Aug 11 17:28:17 emonpi service-runner[596]: Connected to redis-server
Aug 12 09:38:53 emonpi service-runner[596]: Got flag: /opt/openenergymonitor/EmonScripts/update/service-runner-update.sh emoncms none ttyAMA0>/var/log/emoncms/emonpiupdate.log

I will post the command up to now to get it working, we probably need to change the topic to Installing Emoncms on Ubuntu 20.04 with scripts.

This is what I get with journalctl -f -u service-runner

pi@emoncms:~$ journalctl -f -u service-runner
-- Logs begin at Tue 2020-08-11 15:23:57 UTC. --
Aug 12 08:08:22 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Aug 12 08:08:28 emoncms service-runner[762]: Starting service-runner
Aug 12 08:08:28 emoncms service-runner[762]: Connected to redis-server
Aug 12 08:12:56 emoncms service-runner[762]: Got Termination signal, exiting
Aug 12 08:12:56 emoncms systemd[1]: Stopping Emoncms service-runner Input Script...
Aug 12 08:12:56 emoncms systemd[1]: service-runner.service: Succeeded.
Aug 12 08:12:56 emoncms systemd[1]: Stopped Emoncms service-runner Input Script.
-- Reboot --
Aug 12 08:13:43 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Aug 12 08:13:49 emoncms service-runner[755]: Starting service-runner
Aug 12 08:13:50 emoncms service-runner[755]: Connected to redis-server

To get it working was to do a fresh install using the scripts as the “pi” username and update the config.ini file to non-pi environment.

Install python2 becuase it was not released with Ubuntu 20.04
sudo apt install python2

Then edited service-runner.py file with #!/usr/bin/python2 ontop
and edited service-runner.service file and changed this line to also reflect python2

[Service]
Type=idle
ExecStart=/usr/bin/python2 /var/www/emoncms/scripts/services/service-runner/service-runner.py
User=pi

next, followed these instructions to install pip

https://linuxize.com/post/how-to-install-pip-on-ubuntu-20.04/#installing-pip-for-python-2

and then installed redis with

pip install redis

reboot the server

If you run the update while doing that, do you see a ‘got flag’ message?

I see no ‘got flag’ message in the terminal after issuning journalctl -f -u service-runner and then update via the web interface.

The web interface log does display invalid serial port type message before it change the message to
/var/log/emoncms/emonpiupdate.log does not exist

You said that that backup worked though? Odd.

Does the log file exist? If not

touch /var/log/emoncms/emonpiupdate.log

might need sudo touch then do

sudo chmod 666 /var/log/emoncms/emonpiupdate.log

which is what this does

Yes, backup is working, just tested it again.

Now the log file /var/log/emoncms/emonpiupdate.log exist after the touch

Update on the web interface now doesn’t complain about the log file, just briefly display invalid serial port type then disapears.

I checked the /var/log/emoncms/emonpiupdate.log file and its empty

Can you try just updating emoncms rather than a full update please?

Same message and issue with
Full update,
UPDATE EMONCMS ONLY
and UPDATE EMONHUB ONLY

all reacting the same with invalid serial port type

In the UI, next to the Update Firmware, what is listed in the dropdown?

image

This is generating the error

which is a very recent update so might be buggy!

Try editing that line and adding an empty string in.

I Have added, hope its correct but its not working.

if (!in_array($serial_port,array("","ttyAMA0","ttyUSB0","ttyUSB1","ttyUSB2"))) return "Invalid >

Difficult for me to debug!

Could you try adding the $serial_port variable to the error message to see what is actually set?

I’d quite like to be able to get to the root of the issue.

The $serial_port variable translates to null in the error message

@TrystanLea or @emrys - can you chip in please. If it is null I’d have expected the isset to return false and not hit this code.

@Berten_Du_Bruyn - I’ve got to the limit of my PHP I’m afraid!

@Berten_Du_Bruyn what do you see in the serial port list? Are there any serial ports listed?

1 Like