The postfix service not active, I try to activate the service but drops

SYSTEM INFORMATION
OS type and version ALMALINUX 9.1
Webmin version 2.021
Virtualmin version 7.5 Pro
Related packages SUGGESTED

The postfix service of my VPS not active, I try to activate the service but drops.
If deleting the service and including it again could normalize?
How to reinstall postfix correctly?

  • Systemd service details
    postfix.service

[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network.target
Conflicts=sendmail.service exim.service

[Service]
Type=forking
PIDFile=/var/spool/postfix/pid/master.pid
EnvironmentFile=-/etc/sysconfig/network
PrivateTmp=true
CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE
ProtectSystem=true
PrivateDevices=true
ExecStartPre=-/usr/sbin/restorecon -R /var/spool/postfix/pid/master.pid
ExecStartPre=-/usr/libexec/postfix/aliasesdb
ExecStartPre=-/usr/libexec/postfix/chroot-update
ExecStart=/usr/sbin/postfix start
ExecReload=/usr/sbin/postfix reload
ExecStop=/usr/sbin/postfix stop

[Install]
WantedBy=multi-user.target

Current status: not running

/$ postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
resolve_dequoted_address = no
sample_directory = /usr/share/doc/postfix/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
smtp_dns_support_level = dnssec
smtp_host_lookup = dns
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_security_level = dane
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_security_level = may
tls_server_sni_maps = hash:/etc/postfix/sni_map
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

What is the output from:
service postfix status

or:
systemctl status postfix

If nothing useful try:
tail -f syslog

Start postfix from the interface or another terminal. There should be an error in there somewhere.

systemctl status postfix
× postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: failed (Result: oom-kill) since Tue 2023-03-28 18:26:18 CEST; 5min ago
Duration: 21.000s
Process: 54125 ExecStartPre=/usr/sbin/restorecon -R /var/spool/postfix/pid/master.pid (code=exited, status=0/SUCCESS)
Process: 54126 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
Process: 54128 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 54129 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
Process: 54368 ExecStop=/usr/sbin/postfix stop (code=exited, status=0/SUCCESS)
Main PID: 54197 (code=killed, signal=TERM)
CPU: 50.924s
systemd[1]: postfix.service: A process of this unit has been killed by the OOM killer.
postfix/postfix-script[54380]: stopping the Postfix mail system
postfix/master[54197]: terminating on signal 15
systemd[1]: postfix.service: Failed with result ‘oom-kill’.
systemd[1]: postfix.service: Consumed 50.924s CPU time.

First I saw this was a few days ago when someone had a mysqld problem. It was a memory problem. I’m guessing oom is out of memory from the context.

I increased the mysqld memory to test…

I only mentioned mysqld because that problem just popped up and that’s where I first saw the oom-killer. You might want to stop a few things and see if postfix starts.

There has been no change and Postfix keeps falling…

I’ve gone as far as I can take this. I’ve just confirmed what oom-kill is. Maybe this link will help if no one else has anything to offer.

It would help if you posted your systems properties.

Typically, a process fails like that because you are out of memory. How much physical memory and virtual memory do you have? Have you checked your usage lately? Is it running rather high or close to maximum? How much disc space is available? Are you at or near the max?

If so, that’s the problem.

That would only make the matter worse if you’re running low on physical memory or disc space.

2 Likes

Memory RAM 8Gb
4.72 GiB used / 822.81 MiB cached / 7.75 GiB total
Virtual Memory 0
Mysqld 4Gb
Disk Space : 12% busy

Have you rebooted the vps?

yes, that’s certainly !!!

@li9-hst_web-services,

Is your system running “antivirus”? The error noted in one of your posts “oom-kill” means your system is running out of memory, hence it’s killing off processes…

8GB of RAM should generally be enough, as long as you don’t have memory hungry processes running and/or depending on what you are running on your system including but not limited to how many domains you have and what they are using or needing for resources.

Good morning to all !!!
I disabled ClamAV, reduced SpamAssassin to the standalone version, and yet, Postfix does not remain active. I disabled SpamAssassin and nothing has changed. In all these phases executed, the reboot was made.
The investigation continues.
I’m thinking of uninstalling and reinstalling Postfix, would it be a correct action?

Are you sure clamav is stopped … on one of my servers it kept restarting on reboot after being disabled

Nope. It’s not postfix that’s the problem.

This is the current :

/$ postconf -n
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_sender_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_client_restrictions
postconf: warning: /etc/postfix/master.cf: undefined parameter: mua_helo_restrictions
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
allow_percent_hack = no
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
meta_directory = /etc/postfix
mydestination = $myhostname, localhost.$mydomain, localhost
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
resolve_dequoted_address = no
sample_directory = /usr/share/doc/postfix/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
smtp_dns_support_level = dnssec
smtp_host_lookup = dns
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_security_level = dane
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_relay_restrictions = ${{$compatibility_level} < {1} ? {} : {permit_mynetworks permit_sasl_authenticated defer_unauth_destination}}
smtpd_sasl_auth_enable = yes
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1
smtpd_tls_security_level = may
tls_server_sni_maps = hash:/etc/postfix/sni_map
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

Can we confirm that we still have the same problem and aren’t chasing a new one?

Just before starting postfix:

free -h

After starting:

systemctl status postfix

The memory usage you show above would mean postfix needs over 3G of memory to start. That just doesn’t seem plausible.

Did you save a backup of your last main.cf before you added the new entries?
Please read this page: Postfix SMTP relay and access control

The relay parameter has a very strange setting? Can you elaborate on it?

The warning also states undefined parameters.