The unit file, source configuration file or drop-ins of openh ab2.service changed on disk. Run 'systemctl daemon-reload' to reload units

I get the follow error message when stopping openhab2 as a service:

The unit file, source configuration file or drop-ins of openh
ab2.service changed on disk. Run 'systemctl daemon-reload' to reload units

Even if a run this command I receive this message again after each restart. I googled but I just found some database related topics and they don’t really give a hint what caused this and if I need to take care.

Has anybody a clue how this message should be interpreted.

Did you already reboot the system? The service file should not change at all (if not updating openHAB).

Please be aware that systemctl daemon-reload is not sufficient, as this is a super user command, you will have to use

sudo systemctl daemon-reload

instead.

Thanks. Yes, I already rebooted a couple of times and of course executed the command with sudo.
Could it have something to do with using zram @mstormi ? This was the last major change I did based on your suggestion.

I don’t think so as the service file is not on ZRAM.

I am running openhabian 1.5 with 2.5M2. I get the same thing all the time and am not using zram.

I wondered whether this may be due to using the option to delay the rules loading. Is this possible?

I’m not aware what exactly triggers this. So yes, possible it is.

Looking at the symptoms:

  • a file changed that should not have changed
  • running the daemon-reload does not eliminate the error on the next reboot

So, either something is changing your file, and changing it again at every reboot (virus :mask:) or, more likely, your SD card is failing. One of the signs of a failing SD card, one I’ve seen personally) is when you make a change to a file and the change reverts on a reboot. In my case, it was a log file that stopped rotating (another sign of a failing SD card) where I would manually delete the file but on reboot the file would come back.

Anything that would legitimately change that file (i.e. apt) would run the daemon-reload for you.

Good point. Looking at the script it does appear that it monkeys with the service file.

The function in question is

# create systemd config to enforce delaying rules loading
delayed_rules() {
  local targetdir=/etc/systemd/system/openhab2.service.d

  if [ "$1" == "yes" ]; then
    /bin/mkdir -p $targetdir
    /bin/cp "${BASEDIR}"/includes/systemd-override.conf ${targetdir}/override.conf
  else
    /bin/rm ${targetdir}/override.conf
  fi
  cond_redirect systemctl daemon-reload
  cond_redirect systemctl restart openhab2.service
}

The override.conf file just has some commands to rename the .rules files. wait two minutes, then name them back. My manual install of openHABian (which I may not have done properly or fully years ago when I ran it) doesn’t have that /etc/systemd/system/openhab2.service.d folder so I can’t see how this file is loaded and used. The default openhab2.service file I have doesn’t reference any of this stuff. The open question is whether there are Exec lines that causes the .service files to change during an openHAB start or stop.

That would be highly unusual I believe so I doubt that’s the case but I’m at the end of what I can look at on my own without rebuilding a machine.

It’s a fairly recent systemd feature so it depends on the systemd version to run when you installed that.
See link below. I wouldn’t think systemd would alter its own conf files but who knows.
@Lucas you could try verifying this: disable delayed rules (= remove override.conf) and reboot.
Also try if using systemctl edit (should work meanwhile) instead makes a difference.

This is what I also activated a couple of days ago and forgot to mention. Sorry.

Yes, this install has been running for well over a year. That explains it.

I’ll give it a go. It’s one of those things that doesn’t happen reliably, and only when stopping or restarting the service (from memory) so I’ve tended to ignore it (with the occasional curse when it happens again). Since it has been raised and discussed I’ll see if I can reliably replicate it and if removing the delayed rules feature stops it from occurring

Same here: I am asked to run systemctl daemon-reload when restarting openHAB.

$ systemd --version
systemd 241 (241)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid
$ uname -a
Linux openhab 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux

(openHABian Buster on RPi3B+ with openHAB2.5.0, configured to delay loading rules)

1 Like

I wasn’t able to test whether disabling the delayed rule loading stopped this issue. I then unfortunately upgraded to one of the milestones.

I am currently on 2.5M6 and haven’t enabled the delayed rules loading and haven’t experienced the issue at all.

On my list of things to do is enable the rule loading and see if the issue comes back

I have the same issue. After every restart of the OS I get this message. But I don’t use delay of loading rules. At least I haven’t activated something like delay knowingly.

###############################################################################
###############  openhab  #####################################################
###############################################################################
##        Ip = Unable to parse ip . Please debug.
##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 5.4.51-v7+
##  Platform = Raspberry Pi 3 Model B Rev 1.2
##    Uptime = 0 day(s). 0:2:19
## CPU Usage = 0.25% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.78, 5m: 0.77, 15m: 0.33
##    Memory = Free: 0.42GB (44%), Used: 0.52GB (56%), Total: 0.95GB
##      Swap = Free: 2.39GB (100%), Used: 0.00GB (0%), Total: 2.39GB
##      Root = Free: 19.46GB (70%), Used: 8.31GB (30%), Total: 28.99GB
##   Updates = 9 apt updates available.
##  Sessions = 1 session(s)
## Processes = 128 running processes of 32768 maximum processes
###############################################################################

I just upgraded to 2.5.10 from an older 2.5 version and now i get this message too

##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 4.19.97-v7l+
##  Platform = Raspberry Pi 4 Model B Rev 1.1
##    Uptime = 0 day(s). 0:0:41
## CPU Usage = 51.76% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 1.68, 5m: 0.43, 15m: 0.14
##    Memory = Free: 3.17GB (82%), Used: 0.68GB (18%), Total: 3.86GB
##      Swap = Free: 0.09GB (100%), Used: 0.00GB (0%), Total: 0.09GB
##      Root = Free: 427.18GB (98%), Used: 6.96GB (2%), Total: 457.44GB
##   Updates = 71 apt updates available.
##  Sessions = 1 session(s)
## Processes = 124 running processes of 32768 maximum processes

sudo systemctl restart openhab2.service

and then comes

Warning: The unit file, source configuration file or drop-ins of openhab2.service changed on disk. Run 'systemctl daemon-reload' to reload units.

Same problem here

##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 5.4.51-v7l+
##  Platform = Raspberry Pi 4 Model B Rev 1.2
##    Uptime = 0 day(s). 0:12:25
## CPU Usage = 0.5% avg over 4 cpu(s) (4 core(s) x 1 socket(s))
##  CPU Load = 1m: 0.32, 5m: 0.40, 15m: 0.37
##    Memory = Free: 3.04GB (80%), Used: 0.74GB (20%), Total: 3.78GB
##      Swap = Free: 2.58GB (100%), Used: 0.00GB (0%), Total: 2.58GB
##      Root = Free: 22.79GB (82%), Used: 4.98GB (18%), Total: 28.99GB
##   Updates = 45 apt updates available.
##  Sessions = 1 session(s)
## Processes = 121 running processes of 32768 maximum processes

openhabian 2.5.7-1
openhab 2.5.7 Release Build

Brand new system 6 months ago, including SDHC card.
I am running ZRAM. Previously restarted with

sudo shutdown
and a power cycle once everthing stops.

Hi,

what do you get with

systemctl status --full --line=50 openhab2.service

with my OH 2.5.9 I get this

● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/openhab2.service.d
           └─override.conf
   Active: active (running) since Wed 2020-10-14 14:41:02 CEST; 3 weeks 0 days ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 15176 ExecStartPre=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.rules" -exec /usr/bin/rename.ul .rules .x {} \; (code=exited, status=0/SUCCESS)
  Process: 15205 ExecStartPost=/bin/sleep 120 (code=exited, status=0/SUCCESS)
  Process: 16105 ExecStartPost=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.x" -exec /usr/bin/rename.ul .x .rules {} \; (code=exited, status=0/SUCCESS)
 Main PID: 15204 (java)
    Tasks: 194 (limit: 4915)
   CGroup: /system.slice/openhab2.service
           └─15204 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/

so

  • one service file /usr/lib/systemd/system/openhab2.service
  • one drop-in file /etc/systemd/system/openhab2.service.d
 systemctl status --full --line=50 openhab2.service
Warning: The unit file, source configuration file or drop-ins of openhab2.service changed on disk. Run 'systemctl daemon-reload' to reload units.
● openhab2.service - openHAB2 instance, reachable at http://openhab:8080
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/openhab2.service.d
           └─override.conf
   Active: active (running) since Wed 2020-11-04 16:09:26 CET; 3h 20min ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 4374 ExecStartPre=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.rules" -exec /usr/bin/rename.ul .rules .x {} \; (code=exited, status=0/SUCCESS)
  Process: 4398 ExecStartPost=/bin/sleep 120 (code=exited, status=0/SUCCESS)
  Process: 5393 ExecStartPost=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.x" -exec /usr/bin/rename.ul .x .rules {} \; (code=exited, status=0/SUCCESS)
 Main PID: 4397 (java)
    Tasks: 311 (limit: 4915)
   Memory: 468.8M
   CGroup: /system.slice/openhab2.service
           ├─ 407 arping -w 5 -C 1 -i eth0 192.168.0.1
           └─4397 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/li

Nov 04 16:07:25 openhab systemd[1]: Starting openHAB2 instance, reachable at http://openhab:8080...
Nov 04 16:09:26 openhab systemd[1]: Started openHAB2 instance, reachable at http://openhab:8080.
lines 1-20/20 (END)

Despite the error message sudo systemctl restart openhab2.service does work

Hi @m4rk,

I tried on my VM test environment, running also OH 2.5.10. But there a restart did not create this warning.

OK.
As mentioned above the warning points to a change in one of the config files.
Let’s try to find out which.
Can you run these commands?

ll /usr/lib/systemd/system/openhab2.service
ll /etc/systemd/system/openhab2.service.d/override.conf
systemctl --version
sudo systemctl daemon-reload
sudo systemctl restart openhab2.service
ll /usr/lib/systemd/system/openhab2.service
ll /etc/systemd/system/openhab2.service.d/override.conf
systemctl status openhab2.service
[20:17:05] openhabian@openhab:~$ ll /usr/lib/systemd/system/openhab2.service
-rw-r--r-- 1 root root 841 Oct 26 08:38 /usr/lib/systemd/system/openhab2.service
[20:17:53] openhabian@openhab:~$ ll /etc/systemd/system/openhab2.service.d/override.conf
-rw-r--r-- 1 root root 401 Nov  4 15:06 /etc/systemd/system/openhab2.service.d/override.conf
[20:16:34] openhabian@openhab:~$ systemctl --version
systemd 241 (241)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid
sudo systemctl daemon-reload

sudo systemctl restart openhab2.service

 ll /etc/systemd/system/openhab2.service.d/override.conf
-rw-r--r-- 1 root root 401 Nov  4 15:06 /etc/systemd/system/openhab2.service.d/override.con

systemctl status openhab2.service
● openhab2.service - openHAB2 instance, reachable at http://openhab:8080
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/openhab2.service.d
           └─override.conf
   Active: active (running) since Wed 2020-11-04 20:28:25 CET; 2min 22s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 9218 ExecStartPre=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.rules" -exec /usr/bin/rename.ul .rules .x {} \; (code=exited, status=0/SUCCESS)
  Process: 9242 ExecStartPost=/bin/sleep 120 (code=exited, status=0/SUCCESS)
  Process: 10242 ExecStartPost=/bin/bash -c /usr/bin/find ${OPENHAB_CONF} -name "*.x" -exec /usr/bin/rename.ul .x .rules {} \; (code=exited, status=0/SUCCESS)
 Main PID: 9241 (java)
    Tasks: 195 (limit: 4915)
   Memory: 295.8M
   CGroup: /system.slice/openhab2.service
           ├─ 9241 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/l
           ├─10594 arping -w 5 -C 1 -i eth0 192.168.0.1
           └─10598 arping -w 5 -C 1 -i eth0 192.168.1.66

Nov 04 20:26:24 openhab systemd[1]: Starting openHAB2 instance, reachable at http://openhab:8080...
Nov 04 20:28:25 openhab systemd[1]: Started openHAB2 instance, reachable at http://openhab:8080.
lines 1-20/20 (END)