Bug#854697: nbd-client: error in nbd@.service systemd unit file

2017-02-16 Thread Wouter Verhelst
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.

Regards,

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



Bug#854697: nbd-client: error in nbd@.service systemd unit file

2017-02-09 Thread Laurent Bonnaud
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)


-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-1-rt-amd64 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages nbd-client depends on:
ii  debconf [debconf-2.0]  1.5.60
ii  libc6  2.24-9
ii  libgnutls303.5.8-3

nbd-client recommends no packages.

nbd-client suggests no packages.

-- Configuration Files:
/etc/nbdtab changed:


-- debconf information:
  nbd-client/killall_set:
  nbd-client/no-auto-config:
  nbd-client/port:
  nbd-client/number: 0
  nbd-client/extra:
  nbd-client/device:
  nbd-client/host:
* nbd-client/killall: false
  nbd-client/type: raw
  nbd-client/port-used:

-- 
Laurent.