Emonhub process cannot open /var/log/emonhub/emonhub.log after update


@Warren_McDonald - can you raise an issue on GitHub, please?

Trystan has changed the emonhub usersetup, and this is a byproduct.

Thanks for raising, I think I know what’s happening here, I think we need to update the permissions on the log within the update process, will sort that now. This relates to a change I made yesterday.

1 Like

I’ve pushed up the fix for this and updated stable to include as well.

1 Like


I think I’m having the same sort of problem and have attached info on my system.
Emonhub keeps trying to run but won’t and emonhub.log remains empty. I changed permissions on the log file to 775 but that didn’t help.
My server is an RPI4 with 8GB of memory. It’s receiving data from MQTT clients so that part is working correctly. The system has been working fine for several years so I’m not sure what happened.
I have a basic knowledge of Linux but am not a programmer. I have received lots of help from members of this forum. Please let me know if you need additional information.
Thanks in advance

emonhub_error.txt (13.5 KB)

I changed permissions on emonhub.log to 777 and everything took off.
Not sure this was the correct thing to do but at least it’s working. Thanks

Hello @bgrattan can you try running emonhub install again, just to make sure it’s all correctly configured:

cd /opt/openenergymonitor/emonhub

I would recommend doing that even if it’s working now as I think you might still have the incorrect service file

Thanks, I did that and it’s still running ok. Saw it made the change in emonhub.log:
-rw-r–r-- 1 pi pi 549 Nov 12 16:12 emonhub.log


Perfect thanks!

Thanks @TrystanLea,

I have updated the emonhub component on stable and it has changed the log file owner and group to pi.
I assume this would have also replaced the service file.



Yes it sounds like that’s correct for you now, cheers!

Is this the error in question? If so, it still persists today even after full update, reboots and trying Start Emonhub

[Possibly related to EmonTH v2 and pulsecount stoppet working - #2 by Robert.Wall - Moderator (RW) ]

If you can SSH in and view the systemlog then that will help solve it.

What user should this be run under? I have logged in as “pi”, but as a total n00b on these things, I wouldn’t know…

I tried chmod 777 on the emonhub.log file but only got this:

sudo chmod … helps

Under the pi user

Its about…17 years since I used UNIX, and I have never used Linux. At the time I was just about able to use “su” in controlled environments, I tried here and gave up, didn’t think of “sudo”. Thanks!

I ran emonhub/install.sh first. A lot happened, but did not appear to fix the problem I reported in the related thread:

But changing the permissions on emonhub.log to 777 did the trick and solved both the problem with the two emonth units and the pulse counter.

It might be worth trying the following:

sudo rm -rf /var/log/emonhub
sudo systemctl restart emonhub

that will delete the log and log directory, when you then restart emonhub it should create both again, all with the correct permissions.

Hello all, I booted up a new image this morning and replicated the issue. I realise I made a mistake in the update script and did not pass a parameter the emonhub update script was expecting. I’ve now fixed this and pushed up the fix as an available update.

I would recommend running a full update as the update script was exiting early before I fixed this, running an update again will make sure all the packages get installed in the right places so that emonhub runs as the pi user.

1 Like