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
Closed

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

DarkWav opened this issue Apr 8, 2019 · 7 comments

Comments

@DarkWav
Copy link

DarkWav 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
Copy link

It seems that we encounter the same problem.
#16

@prajnoha
Copy link
Member

prajnoha commented Apr 9, 2019

Thanks for reporting the issue, it should be fixed now with:

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

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

@prajnoha prajnoha closed this as completed Apr 9, 2019
@DarkWav
Copy link
Author

DarkWav commented Apr 9, 2019

Thanks a lot, you're awesome!

@intelfx
Copy link

intelfx 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
Copy link

kouros17 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
Copy link
Member

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
Copy link

kouros17 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
…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
…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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants