Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force systemd to stop lvm2-lvmetad.service before shutting down. #17

Closed
DarkWav opened this issue Apr 8, 2019 · 7 comments

Comments

Projects
None yet
5 participants
@DarkWav
Copy link

commented Apr 8, 2019

I noticed that systemd sometimes reaches shutdown.target before lvm2-lvmetad.service has been stopped. Since lvm2-lvmetad.service (a.k.a. lvm2_lvmetad_systemd_red_hat.service.in in the "scripts" folder) has

[Unit]
Conflicts=shutdown.target

but no

[Unit]
Before=shutdown.target

in it, this problem can easily occur if the service doesn't react to SIGTERM fast enough.
In case it does happen, with kernels 5.0.0 and up the shutdown/reboot procedure can be interrupted.
If we would add

[Unit]
Before=shutdown.target

to the service file we could avoid the issue. I heared a some Arch Linux users are suffering from this occasional problem, as described in this bug report.
This issue at systemd is also related to the problem, as @patrakov describes.
Thanks for your efforts in advance.

@wangwang3210

This comment has been minimized.

Copy link

commented Apr 9, 2019

It seems that we encounter the same problem.
#16

@prajnoha

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2019

@prajnoha prajnoha closed this Apr 9, 2019

@DarkWav

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

Thanks a lot, you're awesome!

@intelfx

This comment has been minimized.

Copy link

commented Apr 11, 2019

I think something went wrong with the backport in 0a726a7e268b31856615491809af73bda5d4d6f9.

diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
index 2663c72..3201537 100644 (file)
--- a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in
@@ -1,8 +1,6 @@
 [Unit]
 Description=LVM2 metadata daemon socket
 Documentation=man:lvmetad(8)
-DefaultDependencies=no
-Conflicts=shutdown.target
 
 [Socket]
 ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket

Is it actually correct to do stuff like this? Doesn't look like it, cherry-picking this commit breaks boot in Arch (FS#62302).

@kouros17

This comment has been minimized.

Copy link

commented Apr 11, 2019

I'm using manjaro and after the last update of of lvm2 ( 2.02.184-2) which include the fix commit the "long shutdown" issue solved but now from journalctl I get:

manjaro systemd[1]: boot-efi.mount: Job lvm2-lvmetad.socket/start deleted to break ordering cycle starting with boot-efi.mount/start
manjaro systemd[1]: boot-efi.mount: Job lvm2-monitor.service/start deleted to break ordering cycle starting with boot-efi.mount/start
@prajnoha

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2019

My mistake, sorry for that. I expected the sockets.target to be reached sooner during boot, but it's even after sysinit.target (https://www.freedesktop.org/software/systemd/man/bootup.html). So yes, we still need the DefaultDependencies=no there.

(master tree)
https://sourceware.org/git/?p=lvm2.git;a=commit;h=25f231cf06c3938838a64f5b88834d831f45c1c2

(stable-2.02 tree)
https://sourceware.org/git/?p=lvm2.git;a=commit;h=03d6cfdd99fb1c2fd85721ab6faebbb1b6658873

@kouros17

This comment has been minimized.

Copy link

commented Apr 11, 2019

It's fixed for me with lvm2 2.02.184-4 in arch.
@prajnoha thanks a lot!

tasleson pushed a commit to tasleson/lvm2 that referenced this issue Apr 18, 2019

systemd: add missing Before=shutdown.target to LVM2 services to fix s…
…hutdown ordering

We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.

Reported here: lvmteam/lvm2#17

csonto pushed a commit that referenced this issue May 13, 2019

systemd: add missing Before=shutdown.target to LVM2 services to fix s…
…hutdown ordering

We already used Conflicts=shutdown target to stop LVM2 services on shutdown.
But we still missed the ordering - the shutdown.target should be reached
only after all the services are really stopped.

Reported here: #17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.