Postfix Mail Server failed after upgrading MariaDB to 10.2

Dear Support manager,

Server is based on CentOS 7.5

Based on this guide: https://www.virtualmin.com/node/53051 I could upgraded MariaDB 5.5 to 10.2.

Now MariaDB 10.2 is fine but Postfix is not working!

The status of postfix after

mail -v

is:

-bash: mail: command not found

or

echo "This is the body of the email" | mail -s "This is the subject line" user@example.com

is:

-bash: mail: command not found

also I check postfix via this:

service postfix status

The result is attached screen shot. In addition the ip which is shown in report is not familiar to me!

Could you please help me to solve this?

The History Is:

In the steps of upgrading MariaDB I followed the aforementioned link.

since the guide didn't recommend to backup Postfix Mail Server Config Files , So I didn't get a backup from main.cf, virtual and master.cf in /etc/postfix/

After

yum install MariaDB-server MariaDB-client

and

systemctl enable mariadb systemctl start mariadb mysql_upgrade -u root -p

and also recovering the backup of /etc/my.cnf , (I replaced the content of the new my.cnf with the old one) I checked:

mysql --version

the result: mysql Ver 15.1 Distrib 10.2.16-MariaDB, for Linux (x86_64) using readline 5.1

After reboot I saw in Virtualmin > Server Status

the Mysql Database server was not running!

In the Mysql Database server this was shown:

Warning: The Perl module DBD::mysql is not installed on your system, so Webmin will not be able to reliably access your MySQL database. Click here to install it now.

I clicked it.

Also in Webmin CP -> Servers -> Postfix Mail Server this was shown:

The Postfix control command /usr/sbin/postfix is not installed on your system. Maybe your module configuration is incorrect, or Postfix is not installed. The Postfix package can be automatically installed by Webmin. Click here to have it downloaded and installed using YUM.

I clicked it.

Then in Virtualmin panel I pressed on the "play" button to run Mysql Database server. And it suddenly ran. But I saw the postfix mail server stoped !!!!

Then in Webmin CP -> Servers -> Postfix Mail > "Edit Config Files" I only found two files 1) main.rpmsave 2) master.rpmsave but didn't find virtual.rpmsave

I replaced the contents of these two file with their respective default file. And I pressed the play button to start the postfix. it started.

Now although in the Server status it is shown that postfix is running but in fact it is stoped!! as you can see in the screen shot. And also I don't receive any email from the server.

I'll appreciate any help or comment.

Status: 
Active

Comments

Howdy -- thanks for contacting us!

Note that the steps you're seeing for MySQL are community members sharing their experiences for how they upgraded MySQL. There isn't an official/supported way to upgrade to a different MySQL version though, and doing so can cause a number of problems unfortunately.

Our recommendation is typically to use a Linux distribution that provides the software versions you need.

With all that said -- let's take a look at your Postfix/email issue --

Let's start here, what is the output of this command:

rpm -qa | grep postfix

And if you run the command "service postfix restart", does that work, or do you receive an error? If there is an error, what message(s) are shown in /var/log/maillog?

Dear andreychek,

Thank you so much for your comment,

rpm -qa | grep postfix

gives me this:

postfix-2.10.1-6.el7.x86_64

and also

service postfix restart

gives me this:

Redirecting to /bin/systemctl restart postfix.service
Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

Which the result of "systemctl status postfix.service" is here https://ibb.co/bOqYbK

the maillog error is very long which part of the first file is :

https://ibb.co/hTLibK

and

https://ibb.co/dbz1wK

More Info: I can test without any stress on this server. it is raw and I installed Minimal CentOS 7.5 and then virtualmin. I need php 7.1 and a version of MariaDB which is able to accept json format.

Already I had a good experience to upgrade the php from 5.4 to 7.1 without problem and any issue for some months. ( I removed the 5.4 and installed 7.1 ) Now I need also MariaDB latest version.

So just after installation of Centos 7.5 I started to upgrade first MariaDB to 10.2 based on that unofficial method ( MariaDB working fine) and although I saw the postfix problem but continued to install php 7.1 based on my method.

Now PHP7.1 and virtualmin plus MariaDB are fine but Postfix does not work.

Also in the virtualmin panel in server status I see the postfix is not running . And the "play" button does not work.

Do I have to reinstall postfix from scratch?

It looks like you have the standard Postfix provided with CentOS 7 there, but it also appears that you are missing several important files from it (not just the config files, but also the binaries themselves).

Before we get too far, I'd recommend making a copy of every file in /etc/postfix.

Next, can you paste in the contents of the main.rpmsave and master.rpmsave files that you had found?

I suspect we'll end up needing to re-install Postfix, but I'm just trying to verify what it is we still have.

it seems I can not post the content. I am uploading it and share it

Dear andreychek,

Based on the files above I have shared, If you recommend me to re-install Postfix, I would be so thankful if you let me know what are the safe commands and how can I do that without bringing further issues?

Best Regards,

We're very happy to help! Note that responses can take up to 24 hours in some cases. We have a small staff (just 4 people in total) and we're not always able to respond right away. With an issue as serious as you're seeing there, it could take a little while to get that fully sorted out.

I see that your Postfix config is also referencing an additional file -- can you share the output of this command:

ls /etc/postfix/

Thanks!

Dear andreychek,

I am so grateful. Hope you more success!

the files are:

access  canonical     generic        main.cf.rpmsave  master.cf.rpmsave  transport
bcc     dependent     header_checks  main.cf.upgrade  master.cf.upgrade  virtual
bcc.db  dependent.db  main.cf        master.cf        relocated          virtual.db

I just should add that the suffix of .upgrade is mine and I got a backup of the new content after upgrading the MariaDB before overwriting file with the old content. I named them .upgrade like main.cf.upgrade

Best Regards,

Oh good, I am seeing virtual and dependent files there, amongst others, which would have been a problem if they were missing.

Here is what I think I'd do then -- after ensuring that you have backups of all the files in /etc/postfix, just run this one command to reinstall Postfix:

yum reinstall postfix

And then run this command:

service postfix restart

When running that command, do you see any errors, or does it appear to start?

If you see any errors, can you share the last few lines of the /var/log/maillog file? Thanks!

Thank you so much for your time and your kind help.

I reinstalled it with : yum reinstall postfix And then: service postfix restart

the response is :

Redirecting to /bin/systemctl restart postfix.service
Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.

It is confusing!

Best Regards,

We're always happy to help! I just didn't want to raise any expectations that we're always able to respond super quickly :-)

After trying to restart Postfix, can you share the messages that show up at the end of the log file in /var/log/maillog?

Oh ! something good happened! After the above response when I got error I rebooted the server and did what you recommended agai.

Again I reinstalled it with : yum reinstall postfix And then: service postfix restart.

The postfix is working now!

I did:

service postfix status

the result is : https://send.firefox.com/download/fabc0acbc1/#QKMeV2_l7bvmSI-kzgjV_A

And

https://send.firefox.com/download/aa41d311e1/#2gwfbObzfbO7oY_zdrlB6A

Hey that's good news! I'm not seeing anything unusual in your logs there.

Are things working as expected?

Are you able to send and receive emails?

The next step, is it sounded like the "mail" command may be missing.

That can be reinstalled by running this command:

yum install mailx

yes !!! That's it!!!

Dear andreychek,

Thank you Thank you SO much for your help and your kind support,

I also installed mailx,

I could send email too.!

let me check it during the next hours to see everything is working well.

The life becomes so beautiful with : Virtualmin + php 7.1 + MariaDB 10.2 + Also your valuable support

Thank you for your time and your help.

All the best,