diff options
authorDermot Bradley <dermot_bradley@yahoo.com>2023-03-23 17:08:39 +0000
committeralice <alice@ayaya.dev>2023-03-23 20:52:47 +0000
commit53faabaf0f0a3076cf3053de65bed3035aafcdd4 (patch)
parent181b6ec0967291f8637cb210439917d3fce30c10 (diff)
main/lvm2: prevent LVM error during shutdown
Whenever a machine using LVM is shutdown then the "/etc/init.d/lvm2 stop", run as part of an orderly shutdown will output an error: * Shutting down the Logical Volume Manager * ERROR: lvm failed to stop If the vgchange command in the init.d script is modified to not hide its output then instead the following is observed: * Shutting down the Logical Volume Manager Logical volume vg0/root contains a filesystem in use. Can't deactivate volume group "vg0" with 1 open logical volume(s) * ERROR: lvm failed to stop At this point in shutdown the majority of filesystems have already been unmounted. However, obviously, / is not yet unmounted. The above error occurs because the LV containing the rootfs cannot be deactivated as the rootfs is still mounted. Therefore this is a "normal" error when the rootfs is using LVM and should be ignored.
2 files changed, 8 insertions, 4 deletions
diff --git a/main/lvm2/APKBUILD b/main/lvm2/APKBUILD
index 738017bfe58..19439d6feaf 100644
--- a/main/lvm2/APKBUILD
+++ b/main/lvm2/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgdesc="Logical Volume Manager 2 utilities"
@@ -149,7 +149,7 @@ c65ef16840321d8a58373e872713eeccbc315a84bb35beebccb6bc6063295b0f54b7c0726c799efd
b790cfcb55aa0362c7046c26a8e050708edecaf0233946adbb34d9c1d967d3614bc19e0c91695da4fd12d7b18adb74041ae11239cd635310cc44b8a7079ccbec library_dir-default-config.patch
07f77491cffa0d9dcda86004e2df428d5d52652a3bda8037a4b09c9c786146253314a11bae42512231c664a8fae110fec815bd12135fc3c6152b94e2101f8213 mlockall-default-config.patch
3cec0a44e44b15dcfc0bb22f8a4318e76bf719fe9a550b6cf99160ea4181707f81ba6a50c8dafedc942638b1ae8bfde901eeff83ba0d6cb8383a178274ba54a5 0001-lvresize-use-POSIX-shell.patch
-28fac98f7bc8199b1bd0aaccdab9fb11464c8e38fa070267093eaffb10fd4de30c7f178d48a718f2e89169a34cb41cf3134680e70d5cd008a1731798f1ba548a lvm.initd
+714e6aaba3437b43af38b0b559d0f983b2cea023e2bc64e0c3763e9c78ae4ca125fb75839fda52128e7044a4add81940fd69e92439d30d232cf20a4204f0e321 lvm.initd
07caf8fa942290f3c953cc2463aaf55bac01d0bcb9351daf3880fa4d0eefb67fe00761c46a7a4da91cd2f8e492a12fed35853a15dc939cd80d19d3303bc3951d lvm.confd
ca06220065525e93347efb7a5746a367cf55cb03574e50eed29bd7c4eae036bdd199b52c42d81811b6e742649e73ab8e66525f663bed66f9d1d82d0efde50332 dmeventd.initd
diff --git a/main/lvm2/lvm.initd b/main/lvm2/lvm.initd
index f0db38752cb..c5b4163de1a 100644
--- a/main/lvm2/lvm.initd
+++ b/main/lvm2/lvm.initd
@@ -32,7 +32,11 @@ start() {
stop() {
ebegin "Shutting down the Logical Volume Manager"
- vgchange --ignorelockingfailure -a n
- eend $?
+ vgchange --ignorelockingfailure -a n >/dev/null 2>&1
+ # At this stage all filesystems except rootfs have been
+ # unmounted. A "standard" error here is failure to deactivate
+ # the VG containing the rootfs (as it is still obviously in use)
+ # so why bother giving a non-zero error code?
+ eend 0