From 82a2ea64b47ba7d4f10019418f84a0f3131d1c11 Mon Sep 17 00:00:00 2001 From: Arnaud Rebillout Date: Fri, 19 Mar 2021 17:11:04 +0700 Subject: Fix postinst trigger when systemd is not running (Closes: #983563) Checking for the existence of the systemctl command only tells us that systemd is installed, however it does not tell us if systemd is running. What we really want to do here is reload systemd if it's installed AND if it's running. The usual way to check if systemd is running is to check for the existence of '/run/systemd/system'. Why would systemd be installed but not running? This is something that happens when one sets up or upgrade a system in a chroot or container. For more details refer to the bug report: Closes PR #1787 --- debian/mariadb-server-10.2.postinst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/mariadb-server-10.2.postinst b/debian/mariadb-server-10.2.postinst index 063f0d8c58b..057b1bf540e 100644 --- a/debian/mariadb-server-10.2.postinst +++ b/debian/mariadb-server-10.2.postinst @@ -247,8 +247,8 @@ EOF ;; triggered) - if [ -x "$(command -v systemctl)" ]; then - systemctl daemon-reload + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload fi invoke restart ;; -- cgit v1.2.1