lvm2: fix start lvm2-monitor.service failed

While systemd based, start lvm2-monitor.service failed.
...
|Sep 21 05:37:34 qemux86-64 lvm[389]:   /var/lock: stat failed: No such
file or directory
|Sep 21 05:37:34 qemux86-64 systemd[1]: lvm2-monitor.service: Main
process exited, code=exited, status=5/NOTINSTALLED
...
The failure of lvm2-monitor.service caused reboot hung when disk
partion is lvm thin provision.

While starting lvm2-monitor.service, it reqires the existence of
locking dir "/var/lock" which is a symlink to "../run/lock" in oe-core,
and "/run" is created in "/etc/fstab" which have to be be after the
start of lvm2-monitor.service.

So tweak the locking dir to "/tmp/lock" and make sure the dir existence
(after tmp.mount).

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Hongxu Jia 2017-09-21 04:04:42 -04:00 committed by Martin Jansa
parent 1a1595cbe4
commit 82dc6280f4
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 24a2c47fd01dde1710f1fa66f5c30ce7010c5956 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Thu, 21 Sep 2017 15:28:10 +0800
Subject: [PATCH] start lvm2-monitor.service after tmp.mount
The lvm2-monitor.service reqires the existence of locking_dir
("/tmp/lock/lvm"), and unit tmp.mount is to mount /tmp.
So start lvm2-monitor.service after tmp.mount
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
scripts/lvm2_monitoring_systemd_red_hat.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 22238b7..93b2bee 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -2,7 +2,7 @@
Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket lvm2-lvmetad.socket
-After=dm-event.socket dm-event.service lvm2-lvmetad.socket lvm2-activation.service lvm2-lvmetad.service
+After=dm-event.socket dm-event.service lvm2-lvmetad.socket lvm2-activation.service lvm2-lvmetad.service tmp.mount
Before=local-fs-pre.target
DefaultDependencies=no
Conflicts=shutdown.target
--
1.8.3.1

View File

@ -214,7 +214,7 @@ global {
# Local non-LV directory that holds file-based locks while commands are
# in progress. A directory like /tmp that may get wiped on reboot is OK.
locking_dir = "/var/lock/lvm"
locking_dir = "/tmp/lock/lvm"
# Other entries can go here to allow you to load shared libraries
# e.g. if support for LVM1 metadata was compiled as a shared library use

View File

@ -15,6 +15,7 @@ SRC_URI = "ftp://sources.redhat.com/pub/lvm2/old/LVM2.${PV}.tgz \
file://0004-tweak-MODPROBE_CMD-for-cross-compile.patch \
file://0001-Avoid-bashisms-in-init-scripts.patch \
file://0005-do-not-build-manual.patch \
file://0006-start-lvm2-monitor.service-after-tmp.mount.patch \
"
S = "${WORKDIR}/LVM2.${PV}"