Devuan bug report logs - #227
nbd-client: At shutdown nbd-client disabled before file-systems could be cleanly unmounted

Package: nbd-client; Reported by: David Kuehling <dvdkhlng@posteo.de>;
Date: Mon, 16 Jul 2018 00:03:01 UTC;
Maintainer for nbd-client is (unknown).

View this report as an mbox folder.


Report forwarded to devuan-bugs@lists.dyne.org, David Kuehling <dvdkhlng@posteo.de>, owner@bugs.devuan.org:
bug#227; Package nbd-client. Full text available.



Acknowledgement sent to David Kuehling <dvdkhlng@posteo.de>:
New bug report received and forwarded. Copy sent to David Kuehling <dvdkhlng@posteo.de>, owner@bugs.devuan.org. Full text available.



Message received at submit@bugs.devuan.org:

From: David Kuehling <dvdkhlng@posteo.de>
To: Devuan Bug Tracking System <submit@bugs.devuan.org>
Subject: nbd-client: At shutdown nbd-client disabled before file-systems could be cleanly unmounted
Date: Mon, 16 Jul 2018 01:52:51 +0200

Package: nbd-client
Version: 1:3.15.2-3
Severity: normal

Dear Maintainer,

I'm currently running a Devuan desktop without local storage using
pxelinux and root located on a network block device provided via
nbd-client (kernel command line "root=/dev/mapper/vg-root
nbdroot=192.168.0.123,devicename,nbd0").

Unfortunately the sysvinit tools and init scripts and the nbd-client
binary do not properly work together causing nbd-client to disconnect at
shutdown before the filesystems can be properly unmounted.

This seems to be a very old problem documented e.g. here [1] and here
[2] and it seems that systemd already got specific patches to prevent
that problem.  With only sysvinit left to exhibit the problem, this sort
of makes the bug devuan-specific (or should I still bother to report it
to debian?).

Short summary of the problem: during shutdown /etc/init.d/sendsigs calls
killall5 binary from sysvinit-utils, killing almost all running
processes.

Of course it never should kill nbd-client, so the /etc/init.d/nbd-client
script is smart enough to register its PID to be exempt from sendsig's
action: by recording it in the /run/sendsigs.omit.d/nbd-cient file.

These PIDs are then collected by /etc/init.d/sendsig and passed as "-o
NNN" options to killall5 which spares those processes from premature
termination.

However, before killall5 goes on to kill all the other processes, it
does a:

	/* Now stop all processes. */
	kill(-1, SIGSTOP);

And when it's done, it does:

	/* And let them continue. */
	kill(-1, SIGCONT);

These SIGSTOP, SIGCONT signals are passed to all processes, including
nbd-client.  Unfortunately nbd-client is written in a way that makes it
unable to handle any signals delivered while it is inside an ioctl call,
and it looses its server connection on SIGSTOP, totally breaking the
block devices it provides.

What would be the right way to prevent this problem?  Fix sysvinit?  Fix
nbd-client?  Note that for nbd-root installations nbd-client is run via
(a copy of) /usr/share/initramfs-tools/scripts/local-top/nbd and not via
/etc/init.d/nbd-client.

Other than that I'm very happy with the stability and maturity of
Devuan.  Running the installer on a diskless system, installing into a
network block device (with cryptsetup and LVM on top), then still being
able to boot the system without problems was sort of surprising :)

cheers,

David

[1] https://github.com/NetworkBlockDevice/nbd/issues/51
[2] https://sourceforge.net/p/nbd/mailman/message/27368126/

-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 2.0 (ascii)
Release:	2.0
Codename:	ascii

Architecture: x86_64

Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages nbd-client depends on:
ii  debconf [debconf-2.0]  1.5.61
ii  libc6                  2.24-11+deb9u3
ii  libgnutls30            3.5.8-5+deb9u3

nbd-client recommends no packages.

nbd-client suggests no packages.

-- debconf information:
  nbd-client/no-auto-config:
  nbd-client/killall_set:





Devuan BTS -- Powered by Debian bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.

Devuan Bugs Owner <owner@bugs.devuan.org>.
Last modified: Mon, 10 Dec 2018 10:41:40 UTC