emonPiLCD Service keeps restarting on non-emonpi

Splitting a topic with difficulty! [MOD]

I’m afraid that I really don’t understand how it is “unable to resolve” emonTxPiZero1 when that is what is shown at the prompt. What address is not associated with that hostname? Or is it saying that it doesn’t understand the sudo bit? :cold_face:

Last login: Sat Nov  7 16:47:21 on ttys000
jjb@MacBook-Pro ~ % ssh [email protected]
[email protected]'s password: 
Linux emonTxPiZero1 5.4.51+ #1333 Mon Aug 10 16:38:02 BST 2020 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Nov  7 16:47:44 2020 from 192.168.2.33
pi@emonTxPiZero1:~ $ sudo systemctl stop emonPiLCD.service
sudo: unable to resolve host emonTxPiZero1: No address associated with hostname
pi@emonTxPiZero1:~ $ 

Interesting error. No idea! what does

sudo systemctl status emonPiLCD.service

This (& it then continues to “loop”).

Last login: Sat Nov  7 16:50:00 on ttys000
jjb@MacBook-Pro ~ % ssh [email protected]
[email protected]'s password: 
Linux emonTxPiZero1 5.4.51+ #1333 Mon Aug 10 16:38:02 BST 2020 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Nov  7 16:50:15 2020 from 192.168.2.33
pi@emonTxPiZero1:~ $ sudo systemctl status emonPiLCD.service
sudo: unable to resolve host emonTxPiZero1: No address associated with hostname
● emonPiLCD.service - emonPi LCD driver
   Loaded: loaded (/opt/openenergymonitor/emonpi/lcd/emonPiLCD.service; enabled;
   Active: inactive (dead) since Sat 2020-11-07 16:48:31 GMT; 15h ago
  Process: 9429 ExecStartPre=/bin/mkdir -p ${LOG_PATH}/ (code=exited, status=0/S
  Process: 9430 ExecStartPre=/bin/chgrp -R pi ${LOG_PATH}/ (code=exited, status=
  Process: 9431 ExecStartPre=/bin/chmod 775 ${LOG_PATH}/ (code=exited, status=0/
  Process: 9432 ExecStart=/usr/bin/python3 /opt/openenergymonitor/emonpi/lcd/emo
 Main PID: 9432 (code=killed, signal=TERM)

Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopping emonPi LCD driver...
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Main process exited
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
lines 1-15/15 (END)...skipping...
● emonPiLCD.service - emonPi LCD driver
   Loaded: loaded (/opt/openenergymonitor/emonpi/lcd/emonPiLCD.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sat 2020-11-07 16:48:31 GMT; 15h ago
  Process: 9429 ExecStartPre=/bin/mkdir -p ${LOG_PATH}/ (code=exited, status=0/SUCCESS)
  Process: 9430 ExecStartPre=/bin/chgrp -R pi ${LOG_PATH}/ (code=exited, status=0/SUCCESS)
  Process: 9431 ExecStartPre=/bin/chmod 775 ${LOG_PATH}/ (code=exited, status=0/SUCCESS)
  Process: 9432 ExecStart=/usr/bin/python3 /opt/openenergymonitor/emonpi/lcd/emonPiLCD.py --logfile=${LOG_PATH}/
 Main PID: 9432 (code=killed, signal=TERM)

Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopping emonPi LCD driver...
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Main process exited, code=killed, status=15/TERM
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-15/15 (END)...skipping...
● emonPiLCD.service - emonPi LCD driver
   Loaded: loaded (/opt/openenergymonitor/emonpi/lcd/emonPiLCD.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Sat 2020-11-07 16:48:31 GMT; 15h ago
  Process: 9429 ExecStartPre=/bin/mkdir -p ${LOG_PATH}/ (code=exited, status=0/SUCCESS)
  Process: 9430 ExecStartPre=/bin/chgrp -R pi ${LOG_PATH}/ (code=exited, status=0/SUCCESS)
  Process: 9431 ExecStartPre=/bin/chmod 775 ${LOG_PATH}/ (code=exited, status=0/SUCCESS)
  Process: 9432 ExecStart=/usr/bin/python3 /opt/openenergymonitor/emonpi/lcd/emonPiLCD.py --logfile=${LOG_PATH}/e
 Main PID: 9432 (code=killed, signal=TERM)

Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopping emonPi LCD driver...
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Main process exited, code=killed, status=15/TERM
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~

I’ve split this as it is unrelated and just polluting the other thread.

1 Like

I can’t replicate this.

Try without the sudo just the status command.

systemctl status emonPiLCD.service

Looks the same (with looping).

Last login: Sun Nov  8 09:06:21 on ttys000
jjb@MacBook-Pro ~ % ssh [email protected]
[email protected]'s password: 
Linux emonTxPiZero1 5.4.51+ #1333 Mon Aug 10 16:38:02 BST 2020 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Nov  8 09:06:37 2020 from 192.168.2.33
pi@emonTxPiZero1:~ $ systemctl status emonPiLCD.service
● emonPiLCD.service - emonPi LCD driver
   Loaded: loaded (/opt/openenergymonitor/emonpi/lcd/emonPiLCD.service; enabled;
   Active: inactive (dead) since Sat 2020-11-07 16:48:31 GMT; 16h ago
  Process: 9429 ExecStartPre=/bin/mkdir -p ${LOG_PATH}/ (code=exited, status=0/S
  Process: 9430 ExecStartPre=/bin/chgrp -R pi ${LOG_PATH}/ (code=exited, status=
  Process: 9431 ExecStartPre=/bin/chmod 775 ${LOG_PATH}/ (code=exited, status=0/
  Process: 9432 ExecStart=/usr/bin/python3 /opt/openenergymonitor/emonpi/lcd/emo
 Main PID: 9432 (code=killed, signal=TERM)

Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopping emonPi LCD driver...
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Main process exited
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
lines 1-15/15 (END)...skipping...
● emonPiLCD.service - emonPi LCD driver
   Loaded: loaded (/opt/openenergymonitor/emonpi/lcd/emonPiLCD.service; enabled; ve
   Active: inactive (dead) since Sat 2020-11-07 16:48:31 GMT; 16h ago
  Process: 9429 ExecStartPre=/bin/mkdir -p ${LOG_PATH}/ (code=exited, status=0/SUCC
  Process: 9430 ExecStartPre=/bin/chgrp -R pi ${LOG_PATH}/ (code=exited, status=0/S
  Process: 9431 ExecStartPre=/bin/chmod 775 ${LOG_PATH}/ (code=exited, status=0/SUC
  Process: 9432 ExecStart=/usr/bin/python3 /opt/openenergymonitor/emonpi/lcd/emonPi
 Main PID: 9432 (code=killed, signal=TERM)

Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Starting emonPi LCD driver...
Nov 07 16:48:26 emonTxPiZero1 systemd[1]: Started emonPi LCD driver.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopping emonPi LCD driver...
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Main process exited, c
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: emonPiLCD.service: Succeeded.
Nov 07 16:48:31 emonTxPiZero1 systemd[1]: Stopped emonPi LCD driver.
~
~
~
~
~

But you don’t get the sudo: unable to resolve host emonTxPiZero1: No address associated with hostname error.

So try

sudo su

Then (without sudo)

systemctl stop emonPiLCD.service
systemctl disable emonPiLCD.service
systemctl mask emonPiLCD.service

Then

exit
Last login: Sun Nov  8 09:50:25 on ttys000
Julians-42-iMac:~ jjb$ ssh [email protected]
[email protected]'s password: 
Linux emonTxPiZero1 5.4.51+ #1333 Mon Aug 10 16:38:02 BST 2020 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Nov  8 09:08:28 2020 from 192.168.2.33
pi@emonTxPiZero1:~ $ sudo su
sudo: unable to resolve host emonTxPiZero1: No address associated with hostname
root@emonTxPiZero1:/home/pi# systemctl stop emonPiLCD.service
root@emonTxPiZero1:/home/pi# systemctl disable emonPiLCD.service
Removed /etc/systemd/system/emonPiLCD.service.
Removed /etc/systemd/system/multi-user.target.wants/emonPiLCD.service.
systeroot@emonTxPiZero1:/home/pi# systemctl mask emonPiLCD.service
Created symlink /etc/systemd/system/emonPiLCD.service → /dev/null.
root@emonTxPiZero1:/home/pi# exit
exit
pi@emonTxPiZero1:~ $ 

I then Restarted emonHub

2020-11-08 09:53:13,295 DEBUG    MainThread Signal 15 received.
2020-11-08 09:53:13,361 INFO     MainThread Exiting hub...
2020-11-08 09:53:13,660 INFO     MainThread Exit completed
2020-11-08 09:53:20,049 INFO     MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2020-11-08 09:53:20,052 INFO     MainThread Opening hub...
2020-11-08 09:53:20,054 INFO     MainThread Logging level set to DEBUG
2020-11-08 09:53:20,057 INFO     MainThread Creating EmonHubTx3eInterfacer 'SerialTx'
2020-11-08 09:53:20,062 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 115200 bits/s
2020-11-08 09:53:20,068 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2020-11-08 09:53:20,075 DEBUG    MainThread Setting MQTT timestamped: True
2020-11-08 09:53:20,077 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-11-08 09:53:20,079 INFO     MainThread Setting MQTT node_JSON_enable: 1
2020-11-08 09:53:20,082 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2020-11-08 09:53:20,086 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2020-11-08 09:53:20,088 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2020-11-08 09:53:20,090 WARNING  MainThread Setting emoncmsorg apikey: obscured
2020-11-08 09:53:20,091 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2020-11-08 09:53:20,094 INFO     MainThread Setting emoncmsorg senddata: 1
2020-11-08 09:53:20,096 INFO     MainThread Setting emoncmsorg sendstatus: 1

LOG LEVEL: DEBUG 

And then rebooted the Pi (through emonCMS / Admin page. After rebooting, emonHub added

2020-11-08 09:54:48,247 INFO     MainThread Exit completed
2020-11-08 09:56:10,991 INFO     MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2020-11-08 09:56:10,994 INFO     MainThread Opening hub...
2020-11-08 09:56:10,996 INFO     MainThread Logging level set to DEBUG
2020-11-08 09:56:10,999 INFO     MainThread Creating EmonHubTx3eInterfacer 'SerialTx'
2020-11-08 09:56:11,034 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 115200 bits/s
2020-11-08 09:56:11,060 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2020-11-08 09:56:11,067 DEBUG    MainThread Setting MQTT timestamped: True
2020-11-08 09:56:11,069 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-11-08 09:56:11,116 INFO     MainThread Setting MQTT node_JSON_enable: 1
2020-11-08 09:56:11,137 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2020-11-08 09:56:11,161 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2020-11-08 09:56:11,163 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2020-11-08 09:56:11,164 WARNING  MainThread Setting emoncmsorg apikey: obscured
2020-11-08 09:56:11,166 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2020-11-08 09:56:11,168 INFO     MainThread Setting emoncmsorg senddata: 1
2020-11-08 09:56:11,170 INFO     MainThread Setting emoncmsorg sendstatus: 1

LOG LEVEL: DEBUG 

In emonCMS / Admin / Services, emonPiLCD is showing as Inactive / Dead (red blob)

No data is arriving at the emonPi’s emonCMS. I powered it all down gain and checked the wiring - all looks good, with no strain on any wires etc.

Try stopping the service (just to ensure it isn’t trying to restart) and run

sudo /usr/bin/python3 /opt/openenergymonitor/emonpi/lcd/emonPiLCD.py --logfile=/var/log/emonpilcd/emonpilcd.log

by running the python code outside of the service you might get a better debugging info, you will at least prove if it’s the script or the service at fault.

The hostname error is sometimes an issue with conflicting/incomplete info in either /etc/hosts and /etc/hostname so check (and post?) the content of those 2 files. How did you set the hostname? During setup of the image or editing manually or via raspi-config (or another way) ?

The OP didn’t state specifically that he has no LCD, but the thread title refers to a non-emonpi,
so if he doesn’t have the display, wouldn’t the emonPiLCD error be an expected one?

1 Like

We are trying to stop the service permanently as it isn’t an emonPi!!!

This is completely unrelated to the emonhub error which needs to be discussed in the other thread.

Good as it isn’t an EmonPi!

You need to discuss this on the other thread else everyone gets extremely confused when you mix errors.

Yeh, I’m familiar with Julian’s setup, this is specifically on a pi zero emonbase (with no rfm!!!).

The error doesn’t appear to be related to the absence of an LCD, the hostname issue I assume to be related to the IP lookup in the same script, for the display to show IP address, but that’s just a hunch.

The script should handle ALL errors internally and not crash out, even when not an emonpi, any fault that an non-emonpi emonbase can raise can also occur on an emonpi.

Ideally the script should be optional on a non-emonpi emonbase so that the push button could be used to shutdown the pi should the user choose to fit a button. It has been done before!

That isn’t the impression I get got from all the debating what it might be caused by.

Fair enough this issue is impeding debugging the other issue, I get that, but surely by seperating this out into another thread you have created another issue to reslove, if you only want to disable it for the purpose of debugging the other issue, it should be done in that thread!!

Yes, Julian can just stop the faulty service that no one else is able to recreate and move on as HE doesn’t need it, that is something that this project does well - just brush it under the carpet. There is still an issue there that someone may hit at a later date, but why do something today that can be put off till tomorrow ay?

So back to other thread then I guess, problem fixed!

How did you set the hostname?
What is in /etc/hostname and /etc/hosts?

Careful Dave, touchy subject apparently! I already asked those same 2 questions :grin: .