1

Topic: Migrate postfix postqueue between servers

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.2.1
- Deployed with iRedMail Easy or the downloadable installer? downloadable
- Linux/BSD distribution name and version: Debian 10.4
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

I recently migrated iRedMail to a new mail server. Everything is moved over except the outgoing messages in the old server's queue, visible with 'postqueue -p'.

The two servers run different OSs and use different ID formats for messages in the queue:

old (FreeBSD): F289150ACEE
new (Debian): 49VYHl2BkSzxQ78

Is it safe to just rsync the /var/spool/postfix/defer and /var/spool/postfix/deferred contents over to the new machine? One potential problem I see is that old server's hostname is in the message headers. Is there some safe way to migrate the queue? Thanks.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Migrate postfix postqueue between servers

cvcvelo wrote:

Is it safe to just rsync the /var/spool/postfix/defer and /var/spool/postfix/deferred contents over to the new machine?

It's ok. Just make sure synced files/directories have correct owner/group and permission (check on Debian first, then set after synced).

3

Re: Migrate postfix postqueue between servers

ZhangHuangbin wrote:
cvcvelo wrote:

Is it safe to just rsync the /var/spool/postfix/defer and /var/spool/postfix/deferred contents over to the new machine?

It's ok. Just make sure synced files/directories have correct owner/group and permission (check on Debian first, then set after synced).

That went ... poorly.

After rsync'ing two directories from the old system:

/var/spool/postfix/defer/
/var/spool/postfix/deferred/

and doing 'postfix reload', the Debian system returned this message:

postsuper: Renamed to match inode number: 39 messages
postsuper: warning: QUEUE FILE NAMES WERE CHANGED TO MATCH INODE NUMBERS

but postfix did not reload. And Postfix will not start with 'systemctl start postfix'.

The directory owners were root:wheel on the FreeBSD system and postfix:root on the Debian system. All directories and files under that are owned by postfix:postfix on both systems.

Postfix now will not start on the new system. Thanks in advance for clues on getting it running again.

4 (edited by cvcvelo 2020-05-26 13:38:26)

Re: Migrate postfix postqueue between servers

ps. Here are the entries from maillog when attempting to restart postfix.

May 25 20:08:40 mail9 postfix/postqueue[13028]: fatal: Queue report unavailable - mail system is down
May 25 20:08:44 mail9 postfix/postfix-script[13709]: warning: symlink leaves directory: /etc/postfix/./makedefs.out
May 25 20:08:44 mail9 postfix/postfix-script[13883]: starting the Postfix mail system
May 25 20:08:45 mail9 postfix/master[13885]: daemon started -- version 3.4.10, configuration /etc/postfix

and here is the output of 'systemctl status postfix':

● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/lib/systemd/system/postfix.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2020-05-25 20:08:45 PDT; 2min 42s ago
  Process: 13888 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 13888 (code=exited, status=0/SUCCESS)

May 25 20:08:45 mail9 systemd[1]: Starting Postfix Mail Transport Agent...
May 25 20:08:45 mail9 systemd[1]: Started Postfix Mail Transport Agent.

Note the "active (exited)" instead of "active (running)"

Thanks for any troubleshooting clues.

5

Re: Migrate postfix postqueue between servers

Still looking for some help on this. Ever since migrating postfix queue messages from the old server, 'systemctl status postfix' has shown "active (exited)" instead of "active (running)". My concern is that the postfix installation is corrupted in some way.

Running "apt-get reinstall postfix" did not clear the issue.

Thanks in advance for troubleshooting clues on this.

6

Re: Migrate postfix postqueue between servers

This might be due to a Debian bug:

https://forum.iredmail.org/topic15457-p … rking.html
https://bugs.debian.org/cgi-bin/bugrepo … =877992#10

But that was in Debian 9, and it was marked as fixed. Also, I didn't have this problem before rsync'ing postqueues from the old server.

7

Re: Migrate postfix postqueue between servers

Try to move all files under /var/spool/postfix/ to another directory (e.g. /opt/temp_dir), then restart Postfix service, it will re-create dir/files. Then try to copy queued messages (not directories) under /opt/temp_dir/ to /var/spool/postfix/ one by one for testing, again, make sure copied files have correct owner/group/permission.

8

Re: Migrate postfix postqueue between servers

Thanks, zhb. I regret to report postfix still reports "active: exited" after creating the directories as suggested.

Also, this procedure did not recreate the 0-F subdirectories under the defer and deferred directories. Also, several other files were missing from other directories, not just defer or deferred. Ffor example, there was no /var/spool/postfix/dev/log and the /var/spool/postfix/flush directory was missing three files.

I've moved the original directories back into /var/spool/postfix.

Thanks in advance for any other troubleshooting clues.

9

Re: Migrate postfix postqueue between servers

At this point I think Postfix's status as "active: exited" is either a bug in the Debian port of postfix or working-as-designed behavior.

After noticing the same Postfix status on a Raspberry Pi running Raspian, I tried building another VM running Debian 10 and installed Postfix. Same thing -- status was "active: exited".

Since I haven't noticed any problems with mail delivery, I think it's more of a cosmetic bug than anything else.

10

Re: Migrate postfix postqueue between servers

You may want to stop postfix service first, then run "ps aux | grep postfix" (or "smtp") to check whether there's any postfix child process running. Kill the rest child processes manually, then start Postfix service again. It should get rid of this "active : exited" issue.

11

Re: Migrate postfix postqueue between servers

ZhangHuangbin wrote:

You may want to stop postfix service first, then run "ps aux | grep postfix" (or "smtp") to check whether there's any postfix child process running. Kill the rest child processes manually, then start Postfix service again. It should get rid of this "active : exited" issue.

Sorry, but the system still shows "active: exited" after that.

This may be a Debian-port-of-postfix problem rather than something with iRedMail. I saw the same "active: exited" message on a brand-new installation of Debian, and also on a Raspberry Pi running Raspbian.