#1069096 mrtg: MRTG installation hangs with SysV-rc

Package:
mrtg
Source:
mrtg
Description:
Multi Router Traffic Grapher
Submitter:
Patrik Schindler
Date:
2024-04-16 11:12:07 UTC
Severity:
normal
#1069096#5
Date:
2024-04-16 11:02:51 UTC
From:
To:
Installing MRRTG with SysV-rc yields:

Selecting previously unselected package mrtg.
(Reading database ... 101360 files and directories currently installed.)
Preparing to unpack .../mrtg_2.17.10-5+deb12u2_amd64.deb ...
Unpacking mrtg (2.17.10-5+deb12u2) ...
Setting up mrtg (2.17.10-5+deb12u2) ...
Starting MRTG
Daemonizing MRTG ...
Created symlink /etc/systemd/system/multi-user.target.wants/mrtg.service → /lib/systemd/system/mrtg.service.

Then, the installation process hangs.

ps tree:

apt-get install mrtg
 \_ /usr/bin/dpkg --status-fd 51 --configure --pending
     \_ sh -c (test -x /usr/lib/needrestart/dpkg-status && /usr/lib/needrestart/dpkg-status || cat > /dev/null)
     |   \_ sh -c (test -x /usr/lib/needrestart/dpkg-status && /usr/lib/needrestart/dpkg-status || cat > /dev/null)
     |       \_ /bin/sh /usr/lib/needrestart/dpkg-status
     \_ /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/mrtg.postinst configure
         \_ [mrtg.postinst] <defunct>

Killing debconf fronted leaves package in iF state. Mrtg is started and runs in background, though.

Looking into where the hang occurs:

~ # bash -x /var/lib/dpkg/info/mrtg.postinst configure
+ set -e
+ getent group
+ grep -q mrtg
+ getent passwd
+ grep -q mrtg
+ chmod 2750 /etc/mrtg
+ chmod 0640 /etc/mrtg/mrtg.cfg
+ chown mrtg:mrtg /etc/mrtg
+ chown mrtg:mrtg /etc/mrtg/mrtg.cfg
+ . /usr/share/debconf/confmodule
++ '[' '!' '' ']'
++ PERL_DL_NONLAZY=1
++ export PERL_DL_NONLAZY
++ '[' '' ']'
++ exec /usr/share/debconf/frontend /var/lib/dpkg/info/mrtg.postinst configure
Starting MRTG
Daemonizing MRTG ...
/usr/bin/deb-systemd-helper was not called from dpkg. Exiting.
/usr/bin/deb-systemd-helper was not called from dpkg. Exiting.
/usr/bin/deb-systemd-helper was not called from dpkg. Exiting.
=> And hangs here.

Adding an "exit 0" in line 56 (before the dh_installinit/13.11.4 block) allow the package configuration to succeed and the package state set to ii. Adding exit 0 later in the script does not solve the hang, I have no explanation for that.