[Pkg-samba-maint] Bug#1002637: samba: System doesn't start up without keypress -> Let nmbd sysvinit helpers depend on haveged?

Jonas Bechtel post at jbechtel.de
Sun Dec 26 10:02:19 GMT 2021


Package: samba
Version: 2:4.13.13+dfsg-1~deb11u2
Severity: critical
Tags: newcomer
Justification: breaks the whole system
X-Debbugs-Cc: post at jbechtel.de


Dear Maintainers,

recently I updated something of my system (not pure debian, using sysvinit) and it wouldn't start up. It turned out to be a "Heisenbug": when I looked for the reason, the system did boot properly.

I then found out that pressing a key (left ctrl, hold down for > 0.5 s or press in combination with other keys) made the boot successful and that the nmbd startup hangs at getrandom() syscall before daemonizing. (first call: getrandom(*, 1, GRAND_NONBLICK), second call: getrandom(*, 64, 0))

After short research I found that enabling haveged could help - see https://bbs.archlinux.org/viewtopic.php?id=249430 , last post. It actually did, but I needed to make sure that update-rc.d tool sorted nmbd /after/ haveged. This could be achieved by adding "haveged" (no $dollar sign) to the list of "Required-Start:"


So I don't need anything from you, just wanted to give you a hint what could be improved: one of these possibilities would help:

* add haveged to the requirements of init.d script (and to the package requirements if systemd is not active.)
* removing need for getrandom syscall /before/ daemonizing (affecting samba codebase)


Best Regards
 Jonas (Bechtel)

P.S.: I did not check out the testing version as this requires another libc. I don't want to touch my libc because in the past I have burnt lots of time resolving dependencies then. Updating libc requires another gcc and via some relation perl and python want to be updated. Via pythonqt this affects qt and kde, so somehow I would end up reinstalling/updating most packages of the system. (Which is ironic because libc takes measures to be actually fully backward compatible)



-- Package-specific info:
* /etc/samba/smb.conf present, and attached
* /var/lib/samba/dhcp.conf present, and attached

-- System Information:
Debian Release: 10.7
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'stable'), (500, 'oldstable'), (200, 'testing')
Architecture: i386 (x86_64)
Foreign Architectures: amd64

Kernel: Linux 4.19.0-6-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_FORCED_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages samba depends on:
ii  adduser              3.118
ii  dpkg                 1.20.9
ii  init-system-helpers  1.56+nmu1
ii  libbsd0              0.9.1-2
ii  libc6                2.31-13+deb11u2
ii  libgnutls30          3.7.1-5
ii  libldb2              2:2.2.3-2~deb11u1
ii  libpam-modules       1.3.1-5
ii  libpam-runtime       1.3.1-5
ii  libpopt0             1.16-12
ii  libpython3.9         3.9.2-1
ii  libtalloc2           2.3.1-2+b1
ii  libtasn1-6           4.16.0-2
ii  libtdb1              1.4.3-1+b1
ii  libtevent0           0.10.2-1
ii  libwbclient0         2:4.13.13+dfsg-1~deb11u2
ii  lsb-base             11.1.0
ii  procps               2:3.3.15-2
ii  python3              3.9.2-3
ii  python3-dnspython    2.0.0-1
ii  python3-samba        2:4.13.13+dfsg-1~deb11u2
ii  samba-common         2:4.13.13+dfsg-1~deb11u2
ii  samba-common-bin     2:4.13.13+dfsg-1~deb11u2
ii  samba-libs           2:4.13.13+dfsg-1~deb11u2
ii  tdb-tools            1.3.16-2+b1

Versions of packages samba recommends:
pn  attr                <none>
ii  logrotate           3.14.0-4
pn  python3-markdown    <none>
pn  samba-dsdb-modules  <none>
pn  samba-vfs-modules   <none>

Versions of packages samba suggests:
pn  bind9          <none>
pn  bind9utils     <none>
pn  ctdb           <none>
pn  ldb-tools      <none>
ii  ntp            1:4.2.8p12+dfsg-4
pn  smbldap-tools  <none>
ii  ufw            0.36-1
pn  winbind        <none>

-- Configuration Files:
/etc/init.d/nmbd changed:
PIDDIR=/run/samba
NMBDPID=$PIDDIR/nmbd.pid
unset TMPDIR
test -x /usr/sbin/nmbd || exit 0
. /lib/lsb/init-functions
exec  9>/home/myaccount/BOOT.nmbd
(echo -n A; date; echo) >&9
case $1 in
	start)
(echo -n B; date; echo) >&9
		SERVER_ROLE=`samba-tool testparm --parameter-name="server role"  2>/dev/null | tail -1`
(echo -n C; date; echo) >&9
		if [ "$SERVER_ROLE" = "active directory domain controller" ]; then
		    exit 0
		fi
(echo -n D; date; echo) >&9
		if [ -n `which testparm` ]
		then
(echo -n E; date; echo) >&9
			NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
		fi
(echo -n F; date; echo) >&9
		if [ "$NMBD_DISABLED" != Yes ]; then
			log_daemon_msg "Starting NetBIOS name server" nmbd
			# Make sure we have our PIDDIR, even if it's on a tmpfs
(echo -n G; date; echo) >&9
			install -o root -g root -m 755 -d $PIDDIR
file=/sys/devices/virtual/misc/hw_random/rng_current
echo -n "$file: "; cat $file
(echo -n H; date; echo) >&9
			if ! start-stop-daemon.wrapper --start --quiet --oknodo --exec /usr/sbin/nmbd --pidfile $NMBDPID -- -D
			then
(echo -n I; date; echo) >&9
				log_end_msg 1
				exit 1
			fi
(echo -n J; date; echo) >&9
			log_end_msg 0
		fi
(echo -n K; date; echo) >&9
		;;
	stop)
		log_daemon_msg "Stopping NetBIOS name server" nmbd
		start-stop-daemon --stop --quiet --pidfile $NMBDPID
		# Wait a little and remove stale PID file
		sleep 1
		if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
		then
			# Stale PID file (nmbd was succesfully stopped),
			# remove it (should be removed by nmbd itself IMHO.)
			rm -f $NMBDPID
		fi
		log_end_msg 0
		;;
	restart|force-reload)
		$0 stop
		sleep 1
		$0 start
		;;
        status)
		status_of_proc -p $NMBDPID /usr/sbin/nmbd nmbd
		exit $?
		;;
	*)
		echo "Usage: /etc/init.d/nmbd {start|stop|restart|force-reload|status}"
		exit 1
		;;
esac
exit 0


-- no debconf information
-------------- next part --------------
# This file [smb.conf] is empty but it must exist to trigger the bug


More information about the Pkg-samba-maint mailing list