DEV Community

Cover image for 15.Linux Postfix Troubleshooting
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

15.Linux Postfix Troubleshooting

Lab Information

Some users of the monitoring app have reported issues with xFusionCorp Industries mail server. They have a mail server in Stork DC where they are using postfix mail transfer agent. Postfix service seems to fail. Try to identify the root cause and fix it.

Lab Solutions

🧭 Part 1: Lab Step-by-Step Guidelines

Objective

On the mail server (stmail01), identify why Postfix fails to start and fix the configuration.

1️⃣ Login to Jump Host

ssh thor@jump_host.stratos.xfusioncorp.com
Enter fullscreen mode Exit fullscreen mode

Password

mjolnir123

2️⃣ Connect to Mail Server

ssh groot@stmail01
Enter fullscreen mode Exit fullscreen mode

Password

Gr00T123

3️⃣ Switch to Root

sudo -i
Enter fullscreen mode Exit fullscreen mode

4️⃣ Check Postfix Status

systemctl status postfix
Enter fullscreen mode Exit fullscreen mode

You will likely see failed status.

5️⃣ Validate Postfix Configuration

Run:

postfix check
Enter fullscreen mode Exit fullscreen mode

Output

root@stmail01 ~]# postfix check
postfix: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
postsuper: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
/usr/sbin/postconf: warning: /etc/postfix/main.cf, line 135: overriding earlier entry: inet_interfaces=all
Enter fullscreen mode Exit fullscreen mode

6️⃣ Fix Postfix Configuration

Edit the configuration file:

vi /etc/postfix/main.cf
Enter fullscreen mode Exit fullscreen mode

Find this line: inet_interfaces

Comment or remove the second line.

Change this:

inet_interfaces = localhost

to:

inet_interfaces = localhost

Save:

ESC
:wq

7️⃣ Restart Postfix

systemctl restart postfix
Enter fullscreen mode Exit fullscreen mode

8️⃣ Verify Service

systemctl status postfix
Enter fullscreen mode Exit fullscreen mode

Expected result:

active (running)

9️⃣ Confirm Postfix Process

ps -ef | grep postfix
Enter fullscreen mode Exit fullscreen mode

You should see postfix processes running.


🧠 Part 2: Simple Explanation (Beginner Friendly)

What this lab is testing

This lab tests basic Linux service troubleshooting.

Steps engineers usually follow:

Check service status

Read error logs

Fix configuration

Restart service

What Postfix Does

Postfix is a mail transfer agent (MTA).

It handles sending and receiving emails.

Example flow:

Application → Postfix → Mail Server → Recipient
Why the Service Failed

The configuration file:

/etc/postfix/main.cf

contains network settings.

The parameter:

inet_interfaces

tells postfix which network interfaces to listen on.

If the value is incorrect or empty, postfix fails to start.

Correct configuration:

inet_interfaces = all

This allows postfix to listen on all available interfaces.

How Engineers Diagnose This

Typical troubleshooting commands:

systemctl status postfix
journalctl -xe
postfix check

These commands reveal configuration errors.

Final Expected Result
Component Status
postfix running
configuration valid
mail server operational

💡 Tip: In real DevOps environments, 80% of service failures come from configuration mistakes, so checking configuration files and logs is always the first step.


Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)