Bug#789532: openssh-server: is not starting using ifup
Package: openssh-server
Version: 1:6.7p1-6
Severity: important
Tags: patch
Dear Maintainer,
openssh-server is not starting at boot if the iface is not up.
Nowadays, the if-up.d/openssh-server script is reloading or restarting but not
starting the service.
Attached is a patch that can make openssh-server try to start when any iface
(except loopback) is raised.
I've already tested this patch on my system.
Hope you'll find it useful.
Regards,
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable')
Architecture: i386 (i686)
Kernel: Linux 4.0.0-2-686-pae (SMP w/1 CPU core)
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 openssh-server depends on:
ii adduser 3.113+nmu3
ii debconf [debconf-2.0] 1.5.56
ii dpkg 1.18.0
ii init-system-helpers 1.23
ii libc6 2.19-18
ii libcomerr2 1.42.13-1
ii libgssapi-krb5-2 1.12.1+dfsg-20
ii libkrb5-3 1.12.1+dfsg-20
ii libpam-modules 1.1.8-3.1
ii libpam-runtime 1.1.8-3.1
ii libpam0g 1.1.8-3.1
ii libselinux1 2.3-2
ii libssl1.0.0 1.0.2a-1
ii libwrap0 7.6.q-25
ii lsb-base 4.1+Debian13+nmu1
ii openssh-client 1:6.7p1-6
ii openssh-sftp-server 1:6.7p1-6
ii procps 2:3.3.9-9
ii zlib1g 1:1.2.8.dfsg-2+b1
Versions of packages openssh-server recommends:
ii ncurses-term 5.9+20150516-2
ii xauth 1:1.0.9-1
Versions of packages openssh-server suggests:
pn molly-guard <none>
pn monkeysphere <none>
pn rssh <none>
pn ssh-askpass <none>
pn ufw <none>
-- Configuration Files:
/etc/network/if-up.d/openssh-server changed:
set -e
if [ "$IFACE" = lo ]; then
exit 0
fi
if [ "$MODE" != start ]; then
exit 0
fi
if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then
exit 0
fi
if [ ! -e /usr/sbin/sshd ]; then
exit 0
fi
if [ -f /var/run/sshd.pid ] && \
[ "$(ps -p "$(cat /var/run/sshd.pid)" -o comm=)" == sshd ]; then
# We'd like to use 'reload' here, but it has some problems; see #502444. On
# the other hand, repeated restarts of ssh make systemd unhappy
# (#756547/#757822), so use reload in that case.
if [ -d /run/systemd/system ]; then
action=reload
else
action=restart
fi
else
action=start
fi
invoke-rc.d ssh $action >/dev/null 2>&1 || true
exit 0
-- debconf information excluded
diff --git a/debian/openssh-server.if-up b/debian/openssh-server.if-up
index dd05ea5..cd6aca0 100644
--- a/debian/openssh-server.if-up
+++ b/debian/openssh-server.if-up
@@ -25,19 +25,25 @@ if [ ! -e /usr/sbin/sshd ]; then
exit 0
fi
-if [ ! -f /var/run/sshd.pid ] || \
- [ "$(ps -p "$(cat /var/run/sshd.pid)" -o comm=)" != sshd ]; then
- exit 0
-fi
-# We'd like to use 'reload' here, but it has some problems; see #502444. On
-# the other hand, repeated restarts of ssh make systemd unhappy
-# (#756547/#757822), so use reload in that case.
-if [ -d /run/systemd/system ]; then
+# Choose the proper action
+if [ -f /var/run/sshd.pid ] && \
+ [ "$(ps -p "$(cat /var/run/sshd.pid)" -o comm=)" == sshd ]; then
+
+ # We'd like to use 'reload' here, but it has some problems; see #502444. On
+ # the other hand, repeated restarts of ssh make systemd unhappy
+ # (#756547/#757822), so use reload in that case.
+
+ if [ -d /run/systemd/system ]; then
action=reload
-else
+ else
action=restart
+ fi
+
+else
+ action=start
fi
+
invoke-rc.d ssh $action >/dev/null 2>&1 || true
exit 0
Reply to: