Disabling emonhub, releasing serial port

Hia, looks like really great work.
A note here, I’ve been having to stop emonhub to free up the UART on the pi for other things, including oem dev. But there’s a problem.
The issue has been that after entering these bash commands:

sudo systemctl stop emonhub
sudo systemctl disable emonhub
sudo reboot

Upon reboot emonhub is back! I don’t know why. There must be some kind of script running on boot which installs the service file and enables it.

I think this has been discussed before but couldn’t quickly find the reference (pretty sure it was @borpin that mentioned it previously though?)

Use

sudo systemctl mask emonhub

Check the man page for the differences between disable and mask:
https://manpages.debian.org/jessie/systemd/systemctl.1.en.html

Also note unmask is required instead of enable

What version of Raspbian/EmonCMS are you running? It is probably the .rclocal that is triggering it.

Yes mask prevents a unit from running until it is unmasked.

Thanks guys.
I was using Oct18 image with updates.

1 Like

So this image will (probably) pick up this rc.local

Another option could be to disable the RFM2Pi interfacer here:

I tried disabling the interfacer.
Perhaps there’s a deeper issue with Raspbian. It seems like any activity on the Serial line while the rPi was booting was slowing down the boot process significantly. At the moment, I can only think that emonhub is trying to parse the equivalent of noise. There might be another process before emonhub trying to do something with incoming signals.

Are you saying a boot with emonhub masked is quicker than with it enabled?

Might be worth experimenting and adding a delay into the service file to delay startup. To do that you need to enable the timer file instead of a service file and edit rc.local so it does not kick it off early. There used to be a delay in rc.local IIRC.

An ‘enabled’ service is just one that starts at boot. If it is installed (and not masked), it can still be started at anytime.