[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: jessie systemd shutdown sequence


On Tue, Apr 26, 2016 at 05:21:25PM +0200, Vladislav Kurz wrote:
> ...
> In my eyes it seems that systemd shuts down everything in parallel, including 
> networking. So it can stop network quite early, before other services. Thus 
> SSH connection just hangs, instead of proper disconnect. That can be solved by 
> installling libpam-systemd - SSH session closes immediately after issuing 
> reboot.
> However I would prefer, that SSH is not stopped until all other services shut 
> down properly, so that if something goes wrong I can still connect and 
> investigate or fix it. 
> As an example - a virtual machine in libvirt/KVM/Qemu, that for whatever 
> reason ignores the ACPI button, and does not shut down. Yeah systemd will kill 
> it eventually (5 minutes or so), but I would prefer to log into such machine 
> and issue correct shutdown. Unfortunately the neworking was gone at that 
> moment.

nice description! This irritates me too. We have physical machines with
KVM with many VM (including ones without ACPI complient OS) and stopping
all takes even 20 minutes or so. Since Jessie, this machines are
inaccessible during shutdown :(. Fortunately there is Dell Remote Access
(DRAC), but it is annoying of course.

> So what I would like to achieve is to set somehow the dependencies in systemd, 
> so that networking is deconfigured only after all services are stopped, and 
> that SSH is the last service to stop.
> Perhaps this should be a bug report against systemd, but I wanted first to 
> know if I'm not missing something that is obvious for those who know systemd 
> better.

Yes. I didn't analyze the problem in depth and not very systemd savvy
yet too. I'm looking and dependencies a bit now. I tried to run on one
virtualisation machine:

  systemd-analyze dot --order libvirt-guests.service ssh.service networking.service >/tmp/liber-order.dot

then I removed from liber-order.dot all machine-qemu.*scope nodes (VM's
itself - too complicated graph). libvirt-guests.service depends on all
VM's on this host simply.

  dot -Tps liber-order.dot >liber-order.ps

There is uploaded image: http://postimg.org/image/5vpw54jjl/full/

So maybe to add dependency libvirt-guests.service After ssh.service?
This is probably not acceptable as general case anywhere :(, so not for
bug-report. Generally there can be libvirt-guests.service host without
ssh.service... I'll play with it yet.

Have a nice day

Reply to: