Skip to main content

Postfix can not start via systemd (simple fix)

Solving problem related to systemd process

I like postfix.   This is really smart and secure mail server. I'm helping above  dozen clients around the world and  tunning  postfix is really fun task. This morning I was downgrading postfix  to the stable version for one of the my friends and come across interesting issue. 

root@newserver:/etc/init.d# systemctl  status  postfix 
● postfix.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead) since вт 2017-06-13 14:35:41 EEST; 1h 48min ago
 Main PID: 25145 (code=exited, status=0/SUCCESS)

чер 13 14:47:09 newserver systemd[1]: Stopped postfix.service.
чер 13 14:47:29 newserver systemd[1]: Stopped postfix.service.
чер 13 14:58:22 newserver systemd[1]: Stopped postfix.service.
чер 13 14:58:23 newserver systemd[1]: Stopped postfix.service.
чер 13 15:05:20 newserver systemd[1]: Stopped postfix.service.
чер 13 15:29:06 newserver systemd[1]: Stopped postfix.service.
чер 13 15:29:06 newserver systemd[1]: Stopped postfix.service.
чер 13 15:32:06 newserver systemd[1]: Stopped postfix.service.
чер 13 15:32:07 newserver systemd[1]: Stopped postfix.service.
чер 13 15:35:54 newserver systemd[1]: Stopped postfix.service.
Warning: postfix.service changed on disk. Run 'systemctl daemon-reload' to reload units.

 I don't like systemd.  This service takes so much responsibility IMHO.  I'm preferring  init.d  scripts  (looks like I'm old fashion guy). If service can not start then checking startup files is correct way.
I have not seen it in default  systemd directory and  check  that other files are present  and are correct. finally detect it under /etc/default:
root@newserver:/lib/systemd/system# ls pos*
postgresql.service  postgresql@.service
root@newserver:/lib/systemd/system# cat postgresql.service 
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.

[Unit]
Description=PostgreSQL RDBMS

[Service]
Type=oneshot
ExecStart=/bin/true
ExecReload=/bin/true
RemainAfterExit=on

[Install]
WantedBy=multi-user.target

root@newserver:/lib/systemd/system# ls /etc/systemd/system/
clamav-daemon.socket.d/      network-online.target.wants/ sockets.target.wants/        syslog.service               
getty.target.wants/          paths.target.wants/          sshd.service                 timers.target.wants/         
multi-user.target.wants/     postfix.service              sysinit.target.wants/        


But  this file is  softlink   to /dev/null only:

root@newserver:/lib/systemd/system# ls /etc/systemd/system/postfix.service  -la
lrwxrwxrwx 1 root root 9 чер 13 14:35 /etc/systemd/system/postfix.service -> /dev/null

I've  deleted this only and reinstalled postfix for generating new one. After this postfix  is going to be green.
root@newserver:/lib/systemd/system# systemctl  daemon-reload
root@newserver:/lib/systemd/system# systemctl   status postfix
● postfix.service - LSB: Postfix Mail Transport Agent
   Loaded: loaded (/etc/init.d/postfix; bad; vendor preset: enabled)
  Drop-In: /run/systemd/generator/postfix.service.d
           └─50-postfix-$mail-transport-agent.conf
   Active: inactive (dead) since вт 2017-06-13 14:35:41 EEST; 1h 57min ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 25145 (code=exited, status=0/SUCCESS)

чер 13 14:47:09 newserver systemd[1]: Stopped postfix.service.
чер 13 14:47:29 newserver systemd[1]: Stopped postfix.service.
чер 13 14:58:22 newserver systemd[1]: Stopped postfix.service.
чер 13 14:58:23 newserver systemd[1]: Stopped postfix.service.
чер 13 15:05:20 newserver systemd[1]: Stopped postfix.service.
чер 13 15:29:06 newserver systemd[1]: Stopped postfix.service.
чер 13 15:29:06 newserver systemd[1]: Stopped postfix.service.
чер 13 15:32:06 newserver systemd[1]: Stopped postfix.service.
чер 13 15:32:07 newserver systemd[1]: Stopped postfix.service.
чер 13 15:35:54 newserver systemd[1]: Stopped postfix.service.
root@newserver:/lib/systemd/system# apt-get install  --reinstall  postfix
Зчитування переліків пакунків... Виконано
Побудова дерева залежностей                        
Зчитування інформації про стан... Виконано
оновлено 0, встановлено 0 нових, 1 перевстановлено, 0 відмічено для видалення і 8 не оновлено.
Необхідно завантажити 0 B/1 374 kB архівів.
Після цієї операції об'єм зайнятого дискового простору зросте на 0 B.
Передналаштування пакунків...
(Reading database ... 73453 files and directories currently installed.)
Preparing to unpack .../postfix_2.11.3-1+deb8u2_amd64.deb ...
Unpacking postfix (2.11.3-1+deb8u2) over (2.11.3-1+deb8u2) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for ufw (0.33-2) ...
Processing triggers for systemd (229-2) ...
Setting up postfix (2.11.3-1+deb8u2) ...

Postfix configuration was not changed.  If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
root@newserver:/lib/systemd/system# systemctl  daemon-reload
root@newserver:/lib/systemd/system# systemctl   status postfix
● postfix.service - LSB: Postfix Mail Transport Agent
   Loaded: loaded (/etc/init.d/postfix; bad; vendor preset: enabled)
  Drop-In: /run/systemd/generator/postfix.service.d
           └─50-postfix-$mail-transport-agent.conf
   Active: active (running) since вт 2017-06-13 16:34:26 EEST; 12s ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 25145 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/postfix.service
           ├─20894 /usr/lib/postfix/master
           ├─20895 pickup -l -t unix -u -c
           └─20896 qmgr -l -t unix -u

чер 13 16:34:26 newserver systemd[1]: Starting LSB: Postfix Mail Transport Agent...
чер 13 16:34:26 newserver postfix[20782]: Starting Postfix Mail Transport Agent: postfix.
чер 13 16:34:26 newserver systemd[1]: Started LSB: Postfix Mail Transport Agent.
чер 13 16:34:26 newserver postfix/master[20894]: daemon started -- version 2.11.3, configuration /etc/postfix

Comments

Popular posts from this blog

Upgrade postgres 9.4 to 9.6 at Debian linux

I'm using virtual server based on Debian Linux for some my free projects.  One of them is based on Postgres with PostGIS extension.   This windy rainy day is a good time for executing some upgrade. Also I would like to add partman extension for partituoning.
Checking new version. Update package list :
aptitude update Get: 1 http://ftp.debian.org/debian jessie-updates InRelease [145 kB] Get: 2 http://security.debian.org stretch/updates InRelease [62.9 kB] Get: 3 http://security.debian.org jessie/updates InRelease [63.1 kB]
 Check for new version:


dpkg-query -l postgresql* Desired=Unknown/Install/Remove/Purge/Hold| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)||/ Name Version Ar…

Small script for one of the plarium game

few notes about google games.
Goggle informed that access to the all games be closed after June, 30. I played "Pirates: Tides of fortune" and decided to limit my game time using small script. Detail is below.
Some history
First internet games were updated network games only. 15 years ago internet connection requires a lot of money and nobody had a problem with lagging of the other players. Usually games uses personal communication protocol. Warbirds, Aces High and Eve online use this way.
Next part use a browser and trivial HTTP protocol. One of the popular game in this area is travian . Travian player uses browser and every browser (PC, cell phone, tablet) can be used for playing. Of course, popularity of the game is related to graphics. Trivial HTTP does not have good power in this and other technology is used for this side. One of them is Flash . Unfortunately flash requires a lot of CPU : "Pirates" was near to froze at my old celeron with 512M…

Small python script for monitoring MySQL performance

I have few services which use MySQL as database server. I would like to have information about load in PNG  image  or  in Cacti app.
MySQL   has  performance information at 'SHOW STATUS' command.

Values  which  are monitored : 
 threads_running, threads_connected, thread_cached, slow_queries
 Of course,  it is really easy to add more variables.

Connection to MySQL is accomplished by MySQLdb  module. Typical example of usage is below :
import MySQLdb mydb = MySQLdb.connect(host = 'hostname', user = 'username', password = 'secret', database = 'mysatabase' ) mycursor = mydb.cursor() mycursor.execute('SQL command') sqlresult = cur.fetchall()
Storing data in rrd file is aviable via rrdtools package. This one is present in debian and Centos OS. example of creating file is below: import rrdtool rrdtool.create("myfile.rrd" , "DS:value1:datatype:hea…