Emonhub fails to start - Unit var-log.mount not found

Hi there,

I’ve recently rebuilt my RPI running emonhub, but the service fails to start with the following message:
Failed to restart emonhub.service: Unit var-log.mount not found.

Not something I’ve seen before in my very limited linux experience, I’ve re-run the sudo ./install and copied in the full output below.

Thanks
James

sudo ./install.sh
Apply raspberrypi serial configuration? 1=yes, 0=no:
You entered 1

Get:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]
Get:2 http://archive.raspberrypi.org/debian bullseye InRelease [23.6 kB]
Get:3 http://archive.raspberrypi.org/debian bullseye/main armhf Packages [257 kB]
Fetched 296 kB in 2s (152 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-configobj is already the newest version (5.0.6-4).
python3-pymodbus is already the newest version (2.1.0+dfsg-2).
python3-serial is already the newest version (3.5~b0-1).
bluetooth is already the newest version (5.55-3.1+rpt1).
libbluetooth-dev is already the newest version (5.55-3.1+rpt1).
python3-pip is already the newest version (20.3.4-4+rpt1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.9/dist-packages (1.6.1)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.25.1)
Requirement already satisfied: pybluez in /usr/local/lib/python3.9/dist-packages (0.23)
Requirement already satisfied: py-sds011 in /usr/local/lib/python3.9/dist-packages (0.9)
Requirement already satisfied: sdm_modbus in /usr/local/lib/python3.9/dist-packages (0.5.1)
Requirement already satisfied: minimalmodbus in /usr/local/lib/python3.9/dist-packages (2.0.1)
Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from minimalmodbus) (3.5b0)
Requirement already satisfied: pymodbus<3.0.0,>=2.4.0 in /usr/local/lib/python3.9/dist-packages (from sdm_modbus) (2.5.3)
Requirement already satisfied: six>=1.15.0 in /usr/lib/python3/dist-packages (from pymodbus<3.0.0,>=2.4.0->sdm_modbus) (1.16.0)
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (0.7.0)
The user `emonhub' is already a member of `gpio'.
Unit /etc/systemd/system/[email protected] is masked, ignoring.
useradd: user 'emonhub' already exists
- installing emonhub.service
Failed to restart emonhub.service: Unit var-log.mount not found.
- Service ActiveState=failed

Do you get this output for this command?

[email protected]:~ $ sudo systemctl status var-log.mount
● var-log.mount - /var/log
   Loaded: loaded
   Active: active (mounted) since Sat 2022-02-26 05:17:42 GMT; 5 days ago
    Where: /var/log
     What: log2ram
    Tasks: 0 (limit: 2062)
   CGroup: /system.slice/var-log.mount

You say you rebuilt your RPi: can you outline how? Others may confirm or reject this, but emonhub.service may need its dependencies adjusting for a different setup.

Thanks @mjr,
Output as follows:

[email protected]:~ $ sudo systemctl status var-log.mount
Unit var-log.mount could not be found.

RPI re-build was a vanilla install of PiOS using the official raspberry Pi imager.

Cheers
James

OK, so I think I would do systemctl list-units and pick whatever one makes /var/log available, then systemctl edit emonhub.service and change var-log.mount to that.

The drawback of that will probably be that some future emoncms upgrade will break it the same way again.

Usually, I would add Alias=var-log.mount to some other systemd unit to communicate that /var/log is ready to emoncms in the way it expects, but the filesystem mounts seem to be generated automatically so I doubt that would work.

Just out of interest, why use vanilla PiOS instead of the emonSD distribution?

same issue on Ubuntu 20.04.3 LTS btw

i couldn’t find a systemd unit for /var/log on Ubuntu, so i used the root mount unit instead.

using
sudo systemctl edit emomhub.service --full
i changed:

Requires=-.mount 
After=-.mount network.target

after which emhub started succesfully

sudo systemctl start emonhub.service 
[email protected]:~/emonhub$ sudo systemctl status emonhub.service 
● emonhub.service - emonHub data multiplexer
     Loaded: loaded (/etc/systemd/system/emonhub.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-03-04 07:04:03 UTC; 7s ago
    Process: 61353 ExecStartPre=/bin/mkdir -p -m 0775 /var/log/emonhub/ (code=exited, status=0/SUCCESS)
    Process: 61354 ExecStartPre=/bin/chgrp -R emonhub /var/log/emonhub/ (code=exited, status=0/SUCCESS)
   Main PID: 61355 (python3)
      Tasks: 3 (limit: 4612)
     Memory: 23.1M
     CGroup: /system.slice/emonhub.service
             └─61355 python3 /usr/local/bin/emonhub/emonhub.py --config-file=/etc/emonhub/emonhub.conf --logfile=/var/log/emonhub/emonhub.log

Mar 04 07:04:03 emon systemd[1]: Starting emonHub data multiplexer...
Mar 04 07:04:03 emon systemd[1]: Started emonHub data multiplexer.

side note the install.sh from stable branch fails on ubuntu with
ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.
solution:
sudo apt install python3-testresources

1 Like

I only require the data sent via mqtt to my openhab instance so I’ve stuck with emonhub as opposed to the whole emonCMS stack.

Cheers
James

1 Like

Excellent - that worked!

Thank you!