Skip to content

Commit

Permalink
Fix postinst trigger when systemd is not running (Closes: #983563)
Browse files Browse the repository at this point in the history
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:
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983563>

Closes PR #1787
  • Loading branch information
elboulangero authored and an3l committed Apr 6, 2021
1 parent c32edd7 commit 82a2ea6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions debian/mariadb-server-10.2.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down

0 comments on commit 82a2ea6

Please sign in to comment.