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

Package: nbd-client; Maintainer for nbd-client is (unknown);

Reported by: David Kuehling <dvdkhlng@posteo.de>

Date: Mon, 16 Jul 2018 00:03:01 UTC

Severity: normal

Full log


🔗 View this message in rfc822 format

X-Loop: owner@bugs.devuan.org
Subject: bug#227: nbd-client: At shutdown nbd-client disabled before file-systems could be cleanly unmounted
Reply-To: David Kuehling <dvdkhlng@posteo.de>, 227@bugs.devuan.org
Resent-From: David Kuehling <dvdkhlng@posteo.de>
Resent-To: devuan-bugs@lists.dyne.org
Resent-CC: David Kuehling <dvdkhlng@posteo.de>, owner@bugs.devuan.org
Resent-Date: Mon, 16 Jul 2018 00:03:01 UTC
Resent-Message-ID: <handler.227.B.15316992035102@bugs.devuan.org>
Resent-Sender: owner@bugs.devuan.org
X-Devuan-PR-Message: report 227
X-Devuan-PR-Package: nbd-client
X-Devuan-PR-Keywords: 
Received: via spool by submit@bugs.devuan.org id=B.15316992035102
          (code B ref -1); Mon, 16 Jul 2018 00:03:01 UTC
Received: (at submit) by bugs.devuan.org; 16 Jul 2018 00:00:03 +0000
Delivered-To: devuanbugs@dyne.org
Received: from tupac3.dyne.org [195.169.149.119]
	by fulcanelli with IMAP (fetchmail-6.3.26)
	for <debbugs@localhost> (single-drop); Mon, 16 Jul 2018 02:00:03 +0200 (CEST)
Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by vm6.ganeti.dyne.org (Postfix) with ESMTPS id 01470F60ABC
	for <submit@bugs.devuan.org>; Mon, 16 Jul 2018 01:55:30 +0200 (CEST)
Authentication-Results: vm6.ganeti.dyne.org;
	dkim=pass (2048-bit key; secure) header.d=posteo.de header.i=@posteo.de header.b="k5aWO0Lp";
	dkim-atps=neutral
Received: from submission (posteo.de [89.146.220.130]) 
	by mout01.posteo.de (Postfix) with ESMTPS id CA8202111A
	for <submit@bugs.devuan.org>; Mon, 16 Jul 2018 01:52:52 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017;
	t=1531698772; bh=MbqyJhXJhX1pwz1o3aOJUCmWrKAIs+Es4rodC5gw7Tw=;
	h=From:To:Subject:Date:From;
	b=k5aWO0Lp2+UdrCgX+OLGxeS3O/Ydigjp1nisZ2GGXObJJquM/kjTNXh3iDY8GaQI3
	 IjwkXe7XRHyIy9sz2tx+KcI6Wsz/Xui/YSqXq9whQkeBOAQtrZZjhgy01iUUgTeSrX
	 NbRFPg+7PrgOrx6OeXHMr0zlYwZsP4YAMbTuBzToPkgkL047Nh7uk8/hYQwmwiRGw0
	 82uXEuh0ZFDF/OSfpe2Ybg/YDPpjTI/YLG99g0EOGqHMUrnl8h+aPd6Sky9ZBVa6Ct
	 wQjVDZ7JeirPjdiiHu+Qne++mRiAU9546MZVg/6m3psU3NgGfiLHisd17uCyiLyxyN
	 W+A4F6qXb2Q0w==
Received: from customer (localhost [127.0.0.1])
	by submission (posteo.de) with ESMTPSA id 41TNdb5yPyz9rxD
	for <submit@bugs.devuan.org>; Mon, 16 Jul 2018 01:52:51 +0200 (CEST)
From: David Kuehling <dvdkhlng@posteo.de>
To: Devuan Bug Tracking System <submit@bugs.devuan.org>
Date: Mon, 16 Jul 2018 01:52:51 +0200
Message-ID: <87r2k4njjg.fsf@snail.snail.pool>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID,
	DKIM_VALID_AU,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,SPF_PASS autolearn=disabled
	version=3.4.1
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tupac3.dyne.org
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:


Send a report that this bug log contains spam.


Devuan BTS -- Powered by Debian bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.

Devuan Bugs Owner <owner@bugs.devuan.org>.
Last modified: Fri Jul 3 23:36:31 2020;