I'm having some trouble getting Virtualmin to work with Postfix and MySQL backend. I understand that configuration (with MySQL) is frowned upon, but I couldn't get the "easy" flat file configuration to work.Holy cow. Words fail. ;-)
How could you have gotten the MySQL configuration, which is incredibly complicated and fragile, to work, and a flatfile configuration (which requires literally
one configuration directive in main.cf) gave you trouble?
So, ditch MySQL for mail users. Seriously. Life is complicated enough without introducing a
relational database into the mix for extremely simple local key:value lookups. As I've mentioned elsewhere, it's much slower, requires tons more resources, and is a lot harder to manage. Virtualmin could probably be convinced to work with your configuration...but I'd suggest not doing so. (Obviously, I'm not a fan of using MySQL as a user database, except in cases where the users already have to be in MySQL for other reasons.)
OK, so converting to a more sane configuration...
Plan for a few minutes to an hour of downtime (it sounds like you've already got troubles, so maybe downtime isn't a big deal).
How many users do you have? If it's a lot, you'll want to write a script to pull things out of the DB and dump them into Virtualmin using the command-line tools. If it's only a few, just plan to add the users using Virtualmin once you've switched the configuration. If you need help scripting this, let me know, and I'll offer some suggestions.
OK, once you have a plan for the move, shut down Postfix (mail will be held by the sending server, or by your hold and forward server if you have a backup MX server--nothing is bounced as long as the server isn't down for more than about 24 hours), and fix the configuration.
I would probably suggest starting from scratch on your postfix configuration (though you'll want to make backups of the configuration files in /etc/postfix, just in case there's some other configuration you need, like certs or forwarding or whatever). Use RPM to remove the package:
rpm -e --nodeps postfix
Remove the bum configuration files:
rm /etc/postfix/*
rmdir /etc/postfix
Install postfix again:
yum install postfix
Use this script to configure it (or, if you have an oddball configuration for Dovecot and procmail, you might want to just pick out the postfix stuff and perform those steps manually...there are very few steps for Postfix--it's dead simple to configure for use in a Virtualmin system, as long as it isn't complicated by databases and such):
http://software.virtualmin.com/lib/mail-setup.plOnce that's done, check things for sanity--configuration re-check in Virtualmin (you'll need to configure Virtualmin not to use MySQL for this stuff...reverting back to defaults), and try creating a user or two. Let us know the results, and include relevant maillog entries, and we'll help you work out the remaining issues (I'm sure there will be more issues...but I'm unfamiliar with the configuration you're coming from, so I don't know exactly what needs to be done to recover from it).
Another option, if you wanted to go for a "default" Virtualmin setup, would be to start from scratch on the whole system, and use the automated install script found on the download page. CentOS 5 is the best supported system by the install script, and should very reliably produce a nicely working system, with most features available out of the box. But this pretty much
requires a fresh install of the OS (no Webmin, no Virtualmin, no Apache, nothing installed from alternate package sources, etc...a fresh OS install with the base and updates package repositories enabled and nothing else).
Hope this helps.
Holler if you run into any problems with the change. Things are not as bad as they seem--mail problems just look really ugly when they're happening, but in hindsight it'll all seem pretty simple, especially when you get MySQL out of the picture. I wish I could fix the Internet so it never guides people into using MySQL for this purpose. It just makes
no sense at all...but you're not alone in ending up in this situation. People find stuff like this on the Internet and think, "MySQL is awesome, so this must be an awesome way to deal with mail." They're right on the first count, but the second part just doesn't follow.