control: reassign -1 systemd
control: retitle -1 systemd-analyze incorrectly claims that Before= on devices 
has no effect

On Thu, Feb 09, 2017 at 04:31:12PM +0100, Laurent Bonnaud wrote:
> Package: nbd-client
> Version: 1:3.15.1-2
> Severity: normal
> Dear Maintainer,
> here is the problem:
> # systemd-analyze verify /usr/lib/systemd/system/nbd@.service
> nbd@i.service: Dependency Before=dev-i.device ignored (.device units cannot 
> be delayed)

The nbd device units are special.

They are created, but they do require some userspace setup; this is what
the nbd@.service unit takes care of.

Removing this dependency indeed has no effect at boot time (since the
.service unit is just started at some point during boot, which causes
the device to be active and the magic detection stuff to kick in so that
things get mounted). However, it *does* have effect at shutdown time, in
that without the Before= dependency, systemd will not realize that there
is a need for the .service unit to run, and will kill it early in the
shutdown process.

Adding a Before= dependency has two effects:
- It causes the unit with the Before= to be ordered before the
  "Before'd" unit at boot time;
- It causes the unit with the Before= to be ordered *after* the
  "Before'd" unit at shutdown time.

It is indeed correct that the first cannot happen with nbd@nbdX.service
and dev-nbdX.device units. However, the second can happen, does happen,
and is absolutely necessary in the case of NBD; removing this Before=
declaration from the nbd@.service file will cause systemd to stop the
nbd-client process, which will cause the device to become inactive while
it may still be mounted or needed in another way.


< ron> I mean, the main *practical* problem with C++, is there's like a dozen
       people in the world who think they really understand all of its rules,
       and pretty much all of them are just lying to themselves too.
 -- #debian-devel, OFTC, 2016-02-12

Reply via email to