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

**URL:** <https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912>\
**Category:** emonHub\
**Tags:** emonhub\
**Created:** [3 March 2022 08:55 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912 "2022-03-03T08:55:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Roberts](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/james_roberts/32/17112_2.png) [@James\_Roberts](https://community.openenergymonitor.org/u/James_Roberts)\
**Post date:** [3 March 2022 08:55 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/1 "2022-03-03T08:55:07Z")

</div>

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

```auto
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/serial-getty@ttyAMA0.service 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

```

---

<div class="post-metadata">

**Author:** ![mjr](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/mjr/32/19990_2.png) [@mjr](https://community.openenergymonitor.org/u/mjr)\
**Post date:** [3 March 2022 10:31 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/2 "2022-03-03T10:31:30Z")

</div>

Do you get this output for this command?

```auto
pi@emonpi:~ $ 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.

---

<div class="post-metadata">

**Author:** ![James\_Roberts](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/james_roberts/32/17112_2.png) [@James\_Roberts](https://community.openenergymonitor.org/u/James_Roberts)\
**Post date:** [3 March 2022 13:57 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/3 "2022-03-03T13:57:20Z")

</div>

Thanks @mjr,  
Output as follows:

```auto
pi@emonhub:~ $ 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

---

<div class="post-metadata">

**Author:** ![mjr](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/mjr/32/19990_2.png) [@mjr](https://community.openenergymonitor.org/u/mjr)\
**Post date:** [3 March 2022 14:06 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/4 "2022-03-03T14:06:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gerombo](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/g/13edae/32.png) [@gerombo](https://community.openenergymonitor.org/u/gerombo)\
**Post date:** [4 March 2022 06:48 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/5 "2022-03-04T06:48:11Z")

</div>

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`  
   
_should read_  
`sudo systemctl edit emonhub.service --full`  
_[Edited as per correction below. Moderator (RW)]_

i changed:

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

```

after which emhub started succesfully

```auto
sudo systemctl start emonhub.service 
-@emon:~/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`

---

<div class="post-metadata">

**Author:** ![James\_Roberts](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/james_roberts/32/17112_2.png) [@James\_Roberts](https://community.openenergymonitor.org/u/James_Roberts)\
**Post date:** [4 March 2022 17:48 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/6 "2022-03-04T17:48:56Z")

</div>

> [@mjr](#):
>
> Just out of interest, why use vanilla PiOS instead of the emonSD distribution?

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

---

<div class="post-metadata">

**Author:** ![James\_Roberts](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/james_roberts/32/17112_2.png) [@James\_Roberts](https://community.openenergymonitor.org/u/James_Roberts)\
**Post date:** [4 March 2022 17:49 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/7 "2022-03-04T17:49:14Z")

</div>

Excellent - that worked!

Thank you!

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [14 September 2023 16:18 UTC](https://community.openenergymonitor.org/t/emonhub-fails-to-start-unit-var-log-mount-not-found/19912/8 "2023-09-14T16:18:25Z")

</div>

4 posts were split to a new topic: [Emonhub will not start on Ubuntu install](https://community.openenergymonitor.org/t/emonhub-will-not-start-on-ubuntu-install/24381)
