Skip to contentSkip to conversation

watchdog: fix service PIDFile in do_install_append

PATCH In review Trevor Gamblin 2 participants 4 messages Oct 2, 2019 – Oct 4, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: fix service PIDFile in do_install_append

From: Trevor Gamblin <[email protected]>

systemd requests an update to the unit file for watchdog.service due to the contents of PIDFile:

systemd[1]: /usr/lib/systemd/system/watchdog.service:11: PIDFile=
references a path below legacy directory /var/run/, updating /var/run/watchdog.pid → /run/watchdog.pid; please update the unit file accordingly.

Use sed in do_install_append to fix the path from /var/run/watchdog.pid to /run/watchdog.pid. This change is recommended in services with the "forking" type (see commit a9353a5c5b in systemd source).

---
 meta/recipes-extended/watchdog/watchdog_5.15.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-extended/watchdog/watchdog_5.15.bb +5 -1
index 1acab2e9e7..83a4ef27cf 100644
@@ -51,8 +51,12 @@ do_install_append() {
 
 	install -Dm 0755 ${WORKDIR}/watchdog.init ${D}/${sysconfdir}/init.d/watchdog
 	install -Dm 0755 ${WORKDIR}/wd_keepalive.init ${D}${sysconfdir}/init.d/wd_keepalive
+    
+    # watchdog is of type "forking", so fix PIDFile to avoid warnings from
+    # systemd
+    sed -i 's@/var/run@/run@g' ${D}${systemd_system_unitdir}/watchdog.service
 
-	# watchdog.conf is provided by the watchdog-config recipe
+    # watchdog.conf is provided by the watchdog-config recipe
 	rm ${D}${sysconfdir}/watchdog.conf
 }
 
Signature · 1 line
2.21.0
#1 lore raw
Quoted 28 lines · Trevor Gamblin

From: Trevor Gamblin <[email protected]>

systemd requests an update to the unit file for watchdog.service due to the contents of PIDFile:

systemd[1]: /usr/lib/systemd/system/watchdog.service:11: PIDFile=
references a path below legacy directory /var/run/, updating /var/run/watchdog.pid → /run/watchdog.pid; please update the unit file accordingly.

Use sed in do_install_append to fix the path from /var/run/watchdog.pid to /run/watchdog.pid. This change is recommended in services with the "forking" type (see commit a9353a5c5b in systemd source).

---
  meta/recipes-extended/watchdog/watchdog_5.15.bb | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-extended/watchdog/watchdog_5.15.bb +0 -0
index 1acab2e9e7..83a4ef27cf 100644
@@ -51,8 +51,12 @@ do_install_append() {
 
  	install -Dm 0755 ${WORKDIR}/watchdog.init ${D}/${sysconfdir}/init.d/watchdog
  	install -Dm 0755 ${WORKDIR}/wd_keepalive.init ${D}${sysconfdir}/init.d/wd_keepalive

meta/recipes-extended/watchdog/watchdog_5.15.bb do_install_append() { · line 62

Quoted 10 lines
meta/recipes-extended/watchdog/watchdog_5.15.bb +5 -1
+
+    # watchdog is of type "forking", so fix PIDFile to avoid warnings from
+    # systemd
+    sed -i 's@/var/run@/run@g' ${D}${systemd_system_unitdir}/watchdog.service
 
-	# watchdog.conf is provided by the watchdog-config recipe
+    # watchdog.conf is provided by the watchdog-config recipe
  	rm ${D}${sysconfdir}/watchdog.conf
  }
 

There are other instances of this warning regarding unit files. For example, during core-image-minimal boot for qemux86-64:

|[    3.845927] systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket|

#2 lore raw
In reply to Trevor Gamblin

meta/recipes-extended/watchdog/watchdog_5.15.bb do_install_append() { · line 57

Quoted 3 lines · Trevor Gamblin
meta/recipes-extended/watchdog/watchdog_5.15.bb +3 -0
+    # watchdog is of type "forking", so fix PIDFile to avoid warnings from
+    # systemd
+    sed -i 's@/var/run@/run@g' ${D}${systemd_system_unitdir}/watchdog.service

I dislike seds in the recipe because it's impossible to tell if they stop working or are not needed anymore. A patch (sent upstream) would be preferable.

Ross

#3 lore raw
Quoted 10 lines · Ross Burton
Quoted 5 lines · Trevor Gamblin

+    # watchdog is of type "forking", so fix PIDFile to avoid warnings from
+    # systemd
+    sed -i 's@/var/run@/run@g' ${D}${systemd_system_unitdir}/watchdog.service

I dislike seds in the recipe because it's impossible to tell if they stop working or are not needed anymore.   A patch (sent upstream) would be preferable.

Ross

Alright, I'll make a patch and get it submitted.