:: [devuan-dev] bug#227: marked as don…
Top Page
Delete this message
Reply to this message
Author: Devuan bug Tracking System
Date:  
To: Mark Hindley
Subject: [devuan-dev] bug#227: marked as done (nbd-client: At shutdown nbd-client disabled before file-systems could be cleanly unmounted)
Your message dated Sat, 1 Jul 2023 16:09:29 +0100
with message-id <ZKBBqUiiiW5DsNcg@???>
and subject line Re: bug#227: nbd-client: At shutdown nbd-client disabled before file-systems could be cleanly unmounted
has caused the Devuan bug report #227,
regarding nbd-client: At shutdown nbd-client disabled before file-systems could be cleanly unmounted
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@???
immediately.)


--
227: https://bugs.devuan.org/cgi/bugreport.cgi?bug=227
Devuan Bug Tracking System
Contact owner@??? with problems
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:
Version: 3.07-1

David,

The upstream fix of killall5 to properly observe /run/sendsigs.omit.d/ is
included in this version.

Closing as fixed

Mark
--
Mark Hindley
GPG: 506C 15A4 2B0A F5A0 A854 23EE D28A 45BF 3287 D649