Bug#991266: postinst: Can't exec systemctl: No such file or directory

2022-10-21 Thread Hilmar Preuße

Am 19.07.2021 um 10:23 teilte Lorenzo Puliti mit:

Hi Francesco,

I had a weird issue when removing proftp recently. I could completely 
remove the package (not purge), i.e. all binaries are gone. I noticed 
that the propftp server process was not stopped and kept running. I'm 
pretty sure this is not intended.


I propose the rewrite our postinst script & debian/rules. I pushed my 
proposal into branch master_start_using_dhinstallsystemd on salsa, 
please be so kind to have a look.


Thanks,
  Hilmar


[...]
Setting up proftpd-core (1.3.7b+dfsg-1) ...
usermod: no changes
Can't exec "systemctl": No such file or directory at 
/usr/bin/deb-systemd-invoke line 110.
sh: 1: systemctl: not found
Can't exec "systemctl": No such file or directory at 
/usr/bin/deb-systemd-invoke line 94.
proftpd.service is a disabled or a static unit not running, not starting it.
insserv: warning: current start runlevel(s) (empty) of script `proftpd' 
overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `proftpd' 
overrides LSB defaults (0 1 6).
insserv: Script `lvm2' has overlapping Default-Start and Default-Stop runlevels 
(S) and (S). This should be fixed.
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
[...]




--
sigfault



OpenPGP_signature
Description: OpenPGP digital signature


Bug#991266: postinst: Can't exec systemctl: No such file or directory

2021-09-03 Thread Hilmar Preuße

Am 19.07.2021 um 10:23 teilte Lorenzo Puliti mit:

Hi Lorenzo, hi Francesco,


[...]
Setting up proftpd-core (1.3.7b+dfsg-1) ...
usermod: no changes
Can't exec "systemctl": No such file or directory at 
/usr/bin/deb-systemd-invoke line 110.
sh: 1: systemctl: not found
Can't exec "systemctl": No such file or directory at 
/usr/bin/deb-systemd-invoke line 94.
proftpd.service is a disabled or a static unit not running, not starting it.
insserv: warning: current start runlevel(s) (empty) of script `proftpd' 
overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `proftpd' 
overrides LSB defaults (0 1 6).
insserv: Script `lvm2' has overlapping Default-Start and Default-Stop runlevels 
(S) and (S). This should be fixed.
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
[...]

Not a tragic issue since it looks that postinst script proceeds anyway with the 
rest
of the configuration, but if you look at snippets from debhelper 
deb-systemd-invoke is always
called only if systemd is PID1. The patch at the bottom should fix the issue.


Thanks for the patch!

On the other hand the dh_installsystemd command adds the following code 
block below to the postinst script.


I'm missing here the "deb-systemd-invoke restart" command here, but I'm 
not sure if it is really needed. I tend to remove completely our hand 
written code and leave the job to debhelper.


Hilmar



# Automatically added by dh_installsystemd/13.5.1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = 
"abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then

if deb-systemd-helper debian-installed 'proftpd.service'; then
# This will only remove masks created by d-s-h on 
package removal.
deb-systemd-helper unmask 'proftpd.service' >/dev/null 
|| true


if deb-systemd-helper --quiet was-enabled 
'proftpd.service'; then

# Create new symlinks, if any.
deb-systemd-helper enable 'proftpd.service' 
>/dev/null || true

fi
fi

# Update the statefile to add new symlinks (if any), which need 
to be cleaned

# up on purge. Also remove old symlinks.
deb-systemd-helper update-state 'proftpd.service' >/dev/null || 
true

fi
# End automatically added section

--
sigfault




OpenPGP_signature
Description: OpenPGP digital signature


Bug#991266: postinst: Can't exec systemctl: No such file or directory

2021-07-19 Thread Lorenzo Puliti
Package: proftpd-core
Version: 1.3.7b+dfsg-1
Severity: normal
Tags: patch
X-Debbugs-Cc: plore...@disroot.org

Dear Maintainer,

during the last upgrade of proftpd i got

[...]
Setting up proftpd-core (1.3.7b+dfsg-1) ...
usermod: no changes
Can't exec "systemctl": No such file or directory at 
/usr/bin/deb-systemd-invoke line 110.
sh: 1: systemctl: not found
Can't exec "systemctl": No such file or directory at 
/usr/bin/deb-systemd-invoke line 94.
proftpd.service is a disabled or a static unit not running, not starting it.
insserv: warning: current start runlevel(s) (empty) of script `proftpd' 
overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `proftpd' 
overrides LSB defaults (0 1 6).
insserv: Script `lvm2' has overlapping Default-Start and Default-Stop runlevels 
(S) and (S). This should be fixed.
Stopping ftp server: proftpd.
Starting ftp server: proftpd.
[...]

Not a tragic issue since it looks that postinst script proceeds anyway with the 
rest
of the configuration, but if you look at snippets from debhelper 
deb-systemd-invoke is always
called only if systemd is PID1. The patch at the bottom should fix the issue.

Regards,
Lorenzo

$ diff -u ./proftpd-core.postinst proftpd-core.postinst-new 
--- ./proftpd-core.postinst 2021-07-15 23:33:15.0 +0200
+++ proftpd-core.postinst-new   2021-07-19 10:02:48.080741451 +0200
@@ -207,8 +207,10 @@
# enable and start proftpd daemon via systemctl
if egrep -qi "^[[:space:]]*ServerType.*standalone" 
/etc/proftpd/proftpd.conf
then
-   deb-systemd-invoke enable proftpd.service
-   deb-systemd-invoke restart proftpd.service
+   if [ -d /run/systemd/system ]; then
+   deb-systemd-invoke enable proftpd.service
+   deb-systemd-invoke restart proftpd.service
+   fi
fi
 fi
 


-- System Information:
Debian Release: 11.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.7.0-1-amd64 (SMP w/4 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: runit (via /run/runit.stopit)

Versions of packages proftpd-core depends on:
ii  adduser  3.118
ii  debianutils  4.11.2
ii  init-system-helpers  1.60
ii  libacl1  2.2.53-10
ii  libc62.31-13
ii  libcap2  1:2.44-1
ii  libcrypt11:4.4.18-4
ii  libhiredis0.14   0.14.1-1
ii  libmemcached11   1.0.18-4.2
ii  libmemcachedutil21.0.18-4.2
ii  libncursesw6 6.2+20201114-2
ii  libpam-runtime   1.4.0-9
ii  libpam0g 1.4.0-9
ii  libpcre3 2:8.39-13
ii  libssl1.11.1.1k-1
ii  libtinfo66.2+20201114-2
ii  lsb-base 11.1.0
ii  netbase  6.3
ii  sed  4.7-1
ii  ucf  3.0043
ii  zlib1g   1:1.2.11.dfsg-2

Versions of packages proftpd-core recommends:
ii  proftpd-doc  1.3.7b+dfsg-1

Versions of packages proftpd-core suggests:
pn  openbsd-inetd | inet-superserver  
ii  openssl   1.1.1k-1
ii  proftpd-mod-crypto1.3.7b+dfsg-1
pn  proftpd-mod-geoip 
pn  proftpd-mod-ldap  
pn  proftpd-mod-mysql 
pn  proftpd-mod-odbc  
pn  proftpd-mod-pgsql 
pn  proftpd-mod-snmp  
pn  proftpd-mod-sqlite
ii  proftpd-mod-wrap  1.3.7b+dfsg-1

-- no debconf information