Module postfix does not exits, broken virtualmin

SYSTEM INFORMATION
OS type and version Almalinux 9
Webmin version 2.202
Virtualmin version 7.20.2

Hi everyone, today my VPS’s postfix was deconfigured, I can’t reinstall it because the emails are important and I can’t lose them, I need to activate postfix again, with the fatal message: bad string length 0 < 1: mynetworsks_style=

When I start virtualmin I get the error “Module postfix does not exist”, but via ssh it tells me that postfix is ​​running and active.

I can’t see the postfix module in webmin
I hope for your help

You should never jump to “reinstall it” as a solution to any problem. That can only ever make more problems. (Unless the problem is “I uninstalled it”, of course.)

The Webmin module for Postfix is not Postfix the mail server. Stop trying to mess with Postix, because that’s not what’s wrong (you can see it’s running so obviously it is installed, though you have it disabled for some reason, and should probably enable it again…systemctl enable postfix).

I’m not sure how you’d have Webmin without the Postfix module, though, that’s a very strange situation.

What does this output:

rpm -V webmin

We’re looking to see if you’ve modified or removed the Postfix files somehow.

And:

rpm -ql webmin | grep postfix

Specifically, we’re looking to see that you have the Webmin Postfix module files.

Also show us this:

ls -l /etc/webmin/postfix

This command rpm -V webmin show

root@vmi2077506:~# rpm -V webmin
.......T.    /usr/libexec/webmin/postfix/address_rewriting.cgi
.......T.    /usr/libexec/webmin/postfix/aliases.cgi
.......T.    /usr/libexec/webmin/postfix/autoreply.pl
.......T.    /usr/libexec/webmin/postfix/bcc.cgi
.......T.    /usr/libexec/webmin/postfix/body.cgi
.......T.    /usr/libexec/webmin/postfix/canonical.cgi
.......T.    /usr/libexec/webmin/postfix/canonical_edit.cgi
.......T.    /usr/libexec/webmin/postfix/client.cgi
.......T.    /usr/libexec/webmin/postfix/debug.cgi
.......T.    /usr/libexec/webmin/postfix/delete_aliases.cgi
.......T.    /usr/libexec/webmin/postfix/delete_mappings.cgi
.......T.    /usr/libexec/webmin/postfix/delete_queues.cgi
.......T.    /usr/libexec/webmin/postfix/dependent.cgi
.......T.    /usr/libexec/webmin/postfix/detach_queue.cgi
.......T.    /usr/libexec/webmin/postfix/edit_access.cgi
.......T.    /usr/libexec/webmin/postfix/edit_afile.cgi
.......T.    /usr/libexec/webmin/postfix/edit_alias.cgi
.......T.    /usr/libexec/webmin/postfix/edit_canonical_mappings.cgi
.......T.    /usr/libexec/webmin/postfix/edit_ffile.cgi
.......T.    /usr/libexec/webmin/postfix/edit_manual.cgi
.......T.    /usr/libexec/webmin/postfix/edit_mapping.cgi
.......T.    /usr/libexec/webmin/postfix/edit_master.cgi
.......T.    /usr/libexec/webmin/postfix/edit_rfile.cgi
.......T.    /usr/libexec/webmin/postfix/filter.pl
.......T.    /usr/libexec/webmin/postfix/flushq.cgi
.......T.    /usr/libexec/webmin/postfix/general.cgi
.......T.    /usr/libexec/webmin/postfix/header.cgi
.......T.    /usr/libexec/webmin/postfix/index.cgi
.......T.    /usr/libexec/webmin/postfix/ldap.cgi
.......T.    /usr/libexec/webmin/postfix/local_delivery.cgi
.......T.    /usr/libexec/webmin/postfix/mailq.cgi
.......T.    /usr/libexec/webmin/postfix/mailq_search.cgi
.......T.    /usr/libexec/webmin/postfix/manual.cgi
.......T.    /usr/libexec/webmin/postfix/manual_update.cgi
.......T.    /usr/libexec/webmin/postfix/map_chooser.cgi
.......T.    /usr/libexec/webmin/postfix/map_chooser_save.cgi
.......T.    /usr/libexec/webmin/postfix/master.cgi
.......T.    /usr/libexec/webmin/postfix/postfinger.cgi
.......T.    /usr/libexec/webmin/postfix/rate.cgi
.......T.    /usr/libexec/webmin/postfix/reload.cgi
.......T.    /usr/libexec/webmin/postfix/relocated.cgi
.......T.    /usr/libexec/webmin/postfix/resource.cgi
.......T.    /usr/libexec/webmin/postfix/sasl.cgi
.......T.    /usr/libexec/webmin/postfix/save_afile.cgi
.......T.    /usr/libexec/webmin/postfix/save_alias.cgi
.......T.    /usr/libexec/webmin/postfix/save_client.cgi
.......T.    /usr/libexec/webmin/postfix/save_ffile.cgi
.......T.    /usr/libexec/webmin/postfix/save_manual.cgi
.......T.    /usr/libexec/webmin/postfix/save_map.cgi
.......T.    /usr/libexec/webmin/postfix/save_master.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_aliases.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_bcc.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_body.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_canonical.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_dependent.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_header.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_misc.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_relocated.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_sni.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_transport.cgi
.......T.    /usr/libexec/webmin/postfix/save_opts_virtual.cgi
.......T.    /usr/libexec/webmin/postfix/save_rfile.cgi
.......T.    /usr/libexec/webmin/postfix/save_sasl.cgi
.......T.    /usr/libexec/webmin/postfix/smtp.cgi
.......T.    /usr/libexec/webmin/postfix/smtpd.cgi
.......T.    /usr/libexec/webmin/postfix/sni.cgi
.......T.    /usr/libexec/webmin/postfix/start.cgi
.......T.    /usr/libexec/webmin/postfix/stop.cgi
.......T.    /usr/libexec/webmin/postfix/transport.cgi
.......T.    /usr/libexec/webmin/postfix/view_mailq.cgi
.......T.    /usr/libexec/webmin/postfix/virtual.cgi

This command rpm -ql webmin | postfix

root@vmi2077506:~# rpm -ql webmin | postfix
postfix/postfix-script: fatal: unknown command: ''. Usage: postfix start (or stop, reload, abort, flush, check, status, set-permissions, upgrade-configuration, logrotate)

This command ls -l /etc/webmin/postfix

root@vmi2077506:~# ls -l /etc/webmin/postfix
total 8
-rw-------. 1 root bin  791 Aug 27 03:05 config
-rw-r--r--  1 root root   6 Aug 27 04:48 version

I managed to activate the module, I exported it from another VPS with webmin and installed it on the VPS with the problem, I can now send mail, but I can’t receive it, I have an error

554 5.7.1 : Relay access denied

To reconfigure postfix use the command:
virtualmin-config-system -i Postfix

Sorry this should have been rpm -ql |grep postfix

This indicates you have modified your Webmin installation outside of the package. You generally shouldn’t do that. (When Verification Fails — rpm -V Output)

I recommend you stop doing stuff before you know you need to and before you know what’s actually wrong.

This has a specific purpose, and it’s when you have a “blank” Postfix configuration. It sets a few defaults to suit a virtual hosting environment.

If you blew away your virtual map somehow, which it sounds like maybe is what happened based on the behavior above, this won’t fix it and is not expected to fix it.

So, does /etc/postfix/virtual contain your mail users for all your domains?

This file is empty, only default values

Show this

root@vmi2077506:/etc/postfix# rpm -ql |grep postfix
rpm: no arguments given for query

I get the same output, this works though rpm -qa |grep postfix, I’m not sure if Joe wants that though.

help shows it should work
Query options (with -q or --query):
–dump dump basic file information
-l, --list list files in package
–queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files

Works without grep
rpm -ql postfix

Argh. Sorry, still not what I meant.

rpm -ql webmin |grep postfix

Regardless, we already know those files have changed because of the verify output.

So…at some point you reinstalled Postfix, I guess and replaced your configuration with defaults?

Are there any .rpmold files in /etc/postfix?

Do you have backups? These easiest solution is to restore whatever you deleted. Presumably if all the Postfix configuration zeroed out, you’d want to restore the files in /etc/postfix.

If you don’t have backups…you’ll need to recreate all the virtual map entries (and, I guess you already did the initial configuration with virtualmin config-system). I think you can do that by disabling mail for the users and then re-enabling them. (Also, make backups of everything important now, before doing anything else.)

Can you explain to me what is meant by enabling or disabling email accounts?

In the end I decided to install all webmin and virtualmin and back up the emails they had (luckily there weren’t many).

How can I back up the configuration to avoid these problems in the future?

I recommend several layers of backups, depending on the way you’re deploying things.

First, Virtualmin backups. This backs up individual virtual servers. These backups can be used to move a single account to another server, or restore it to a known-good state in the event of a mistake or exploit. These should end up somewhere off-system (to protect against flood, fire, disk failure, root exploit). https://www.virtualmin.com/docs/data-operations/how-to-backup-virtual-servers/

Next, config file backups. Many ways to do this. I use/recommend etckeeper, so you have a git history of all changes to /etc; this can be a little temperamental, so you may have to babysit it a little bit if it stops being able to update automatically, but nothing is better than a git history of every change to every configuration…rolling back any change becomes possible. You probably also want just a static backup now and then that goes to another system, for cases where something catastrophic happens to the server itself (again, disk failure, root exploit, flood, fire, etc.). Webmin has a tool for backing up all the config files it manages: Backup Configuration Files | Webmin or you can just ssh the entire /etc directory to somewhere safe periodically (or rclone it to a s3 bucket, whatever, many options).

If you have a “golden image” that you deploy to all new servers, with your exact configuration and software (i.e. already has Virtualmin installed, and all services configured how you like), you can stop there…you won’t need to worry about the other stuff. Many people who don’t have a standard install just do Virtualmin backups and config file backups, and plan to just install Virtualmin on a fresh system with the same OS and version and restore the relevant configuration files (not the ones Virtualmin modifies per domain, though, like `virtual) in the event they have a catastrophic failure. That can work, too, but the easiest disaster recovery is probably a full filesystem backup. Many ways to do that.

One option is the Webmin Filesystem Backup module: Filesystem Backup | Webmin

If you only do one thing today, start using Virtualmin backups for your domains. It only takes a few minutes to setup and is easy to backup to S3 buckets or whatever (which can be quite cheap, Amazon is among the most expensive S3 options and even it’s quite cheap…but BackBlaze and some others have S3 compatible storage that’s even cheaper, you can shop around, but don’t let perfect be the enemy of the good, get your backups happening immediately). That alone can restore most things even on a freshly installed OS with Virtualmin installed. The important stuff is usually user data, unless you have a bunch of really critical custom configuration.

If you search the forum for backup discussions you’ll find people discussing use of rclone, rsync, full-featured system backup tools, etc. I don’t care how you backup your systems, as long as you’re backing them up and testing that you can restore them in a timely manner (and selectively, it’s useful to be able to pick out one file without having to roll the whole system back to the last backup).

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.