TransWikia.com

Find the process that is shutting down or killing a program or service in Linux

Ask Ubuntu Asked by Dagelf on December 5, 2021

In my situation, Postfix mysteriously shuts itself down: postfix/postfix-script stopping the Postfix mail system

On a fresh Ubuntu 18.04, when I run

service postfix start

It starts up, but the a few minutes later shuts down.

May 22 09:10:15 coenraad-Latitude-E5550 postfix/postfix-script[12849]: starting the Postfix mail system
May 22 09:10:15 coenraad-Latitude-E5550 postfix/master[12851]: daemon started -- version 3.3.0, configuration /etc/postfix
May 22 09:11:41 coenraad-Latitude-E5550 postfix/postfix-script[12960]: stopping the Postfix mail system
May 22 09:11:41 coenraad-Latitude-E5550 postfix/master[12851]: terminating on signal 15
May 22 09:11:53 coenraad-Latitude-E5550 postfix/postfix-script[13167]: starting the Postfix mail system
May 22 09:11:53 coenraad-Latitude-E5550 postfix/master[13169]: daemon started -- version 3.3.0, configuration /etc/postfix
May 22 09:14:12 coenraad-Latitude-E5550 postfix/postfix-script[14044]: stopping the Postfix mail system
May 22 09:14:12 coenraad-Latitude-E5550 postfix/master[13169]: terminating on signal 15

I’ve enabled the service with:

sudo update-rc.d postfix enable

There is plenty of free memory and nothing else that seems related in any logs.

One Answer

At first I thought that I somehow managed to install postfix without configuring it. The problem seemed to be solved by:

dpkg-reconfigure postfix

I figured this out with the command:

lastcomm --debug

after each shut down, and I found:

CURRENT REC: systemd.postins |v3|     0.00|     0.00|    21.00|     0|     0|  4628.00|     0.00|   13513|   13305|     |       0|pts/11  |Wed May 22 09:13:02 2019
systemd.postins        root     pts/11     0.00 secs Wed May 22 09:13
---------------------------------------------------------------------------
CURRENT REC: systemctl       |v3|     1.00|     0.00|    21.00|     0|     0| 73472.00|     0.00|   13514|   13513|S    |       0|pts/11  |Wed May 22 09:13:02 2019
systemctl        S     root     pts/11     0.01 secs Wed May 22 09:13
---------------------------------------------------------------------------
CURRENT REC: (sd-executor)   |v3|     0.00|     0.00|     1.00|     0|     0|226496.00|     0.00|   13516|       1|SF   |       0|__      |Wed May 22 09:13:02 2019
(sd-executor)    SF    root     __         0.00 secs Wed May 22 09:13
---------------------------------------------------------------------------
CURRENT REC: systemd-sysv-ge |v3|     0.00|     0.00|     1.00|     0|     0| 61832.00|     0.00|   13532|   13516|S    |       0|__      |Wed May 22 09:13:02 2019
systemd-sysv-ge  S     root     __         0.00 secs Wed May 22 09:13
---------------------------------------------------------------------------
CURRENT REC: postfix-instanc |v3|     0.00|     0.00|     1.00|     0|     0|  4628.00|     0.00|   13519|   13516|S    |       0|__      |Wed May 22 09:13:02 2019
postfix-instanc  S     root     __         0.00 secs Wed May 22 09:13
---------------------------------------------------------------------------
CURRENT REC: postconf        |v3|     0.00|     0.00|     0.00|     0|     0| 76928.00|     0.00|   13535|   13519|     |       0|__      |Wed May 22 09:13:02 2019
postconf               root     __         0.00 secs Wed May 22 09:13
---------------------------------------------------------------------------
CURRENT REC: systemd-rc-loca |v3|     0.00|     0.00|     1.00|     0|     0| 61816.00|     0.00|   13529|   13516|S    |       0|__      |Wed May 22 09:13:02 2019
systemd-rc-loca  S     root     __         0.00 secs Wed May 22 09:13

Which made it look like it's trying to do some interactive configuration in the background - which presumably it was programmed to abort if its not in an interactive session. Manual configuration seemed to flip the necessary switches.

The saga continued... I checked cron of different users, auditd log, system logs for OOM killer, I just could not find the culprit.

What eventually saved me from insanity, was Ciro Santilli's answer here: https://superuser.com/questions/222912/how-can-i-log-all-process-launches-in-linux - which I monitored until it stopped, where it logged this:

20119   2102 /etc/init.d/postfix stop

And then

$ ps auxf|grep 2102
root      2102  0.0  0.0  40820  3940 ?        S    May28   2:58 /usr/bin/monit -c /etc/monit/monitrc

There we have it. The culprit is monit.

Answered by Dagelf on December 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP