After server Virtualmin restore, email aliases are invalid

Thanks for sharing the backup! Sorry for the late reply. I’ve been super busy working on improving the Authentic UI for the upcoming release.

Anyway, I tried the backup you shared with me in the PM, but the backup doesn’t seem to have any alias-related data in it. Could you double-check that?

Also, did the restore work correctly with the option “Re-generate full user names” enabled?

@ilia My apologies for the backup issues. I guess I removed too much to keep the file size reasonable.
I ran the test on a local VM, but the restore fails with a memory error. I started with a VM of 2GB RAM (same as the cloud instance), then increased to 4GB but the problem remains. I haven’t had time to look in more detail.

The restore to the cloud instance worked without problem, except of course for the user issue that started this thread.

I hope to get time later this week and I’ll let you know the result.

Many thanks for the help here.

Thanks!

Can you unpack that? What kind of a memory error—what happened exactly?

Apologies for the delay, it took me some time, and a few OS reloads, to figure out the issue in running restore.

The “memory” problem I had appears to be caused because I transferred the backup files from backup storage to the VM as a single zip file. When I clicked “Show what will be restored”, after a few minutes I lost connection to Virtualmin/Webmin and the console showed:

[ 925.512591] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/system.slice/webmin.service,task=/usr/libexec/we,pid=6575,uid=0
[ 925.513028] Out of memory: Killed process 6575 (/usr/libexec/we) total-vm:4040632kB, anon-rss:1607712kB, file-rss:128kB, shmem-rss:0kB, UID=0 pgtables:6880kB oom_score_adj:0

The connection to Webmin/Virtualmin was automatically restored soon after.

With the server backup directory (created by VM Backup) I selected “All features” and also selected “Regenerate full user names”. The restore completed, but Postfix mail aliases again had a mixture of user@domain.tld and \user-domain.tld (the latter should read backslash user-domain.tld in case the backslash didn’t display)(no space between backslash and domain.tld)

I saw an old post from the Webmin category Sept 2018 ( Change login name from user.domain to user@domain for already created users - #4 by borjaevo ) which suggested that backup and restore could be used to convert user-domain to the current server template setting (e.g. user@domain.tld).

I’m not sure if that post is still relevant.

In summary: checking the “Regenerate full user names” did not appear to make a difference, BUT I’m not sure where to see if user-domain.tld is valid.

Where should I look to see if user-domain.tld is accepted by Postfix?

@Jamie, are you aware of it? It’s a serious issue.

@PeterP Did you transfer the file exactly how? Via upload? If so, does this issue also happen when files are uploaded to the system via File Manager, and a local backup file is used for restore?

Can you show exactly how the records were after the restore, and how you expect to see them?

We have an option in “System Settings ⇾ Virtualmin Configuration: Advanced options” page named “Create extra Unix user on Postfix systems when using user@domain format”. You should set it to “No” on all new systems. What was it set for you?

Lastly, if it still doesn’t work, can you send us a private message tagging @staff and attaching a backup that we can restore to repro the issue? Also, mention which alias records are wrong and how you would like them to be.

That depends .. was this backup uploaded from the browser, or was it already on the Virtualmin system? There are some cases where we need to optimize the uploading of large files, using the approach you implemented nicely in the Upload and Download modules.

I wouldn’t worry about it happening with uploads as it’s a known issue; and yes, I could take a look at implementing it later too.

However, could you absolutely make sure it doesn’t happen with restores for files that are already on the system?

I am 100% certain that we don’t read the entire backup file into RAM when restoring locally.

What about pre-viewing (what will be restored part)—same?

At first I used Restore source=Upload to server and that failed. The zip backup was about 6GB and at first I thought I might have run out of disk space to expand the nested compressed files since the disk was only 20GB. But changing to a 60GB disk had the same error.

When I uploaded the backup directory (3 files per domain + 3 files for virtualmin) using File Manager, Upload to Server, the restore completed.

I didn’t check before the restore, but after the restore it is set to “Decide automatically”

After restore I have aliases like “alias-domain.tld Address \info-domain.tld” (backslash immediately before info).
I would like the alias to be to Address info@domain.tld

I have some aliases that include both on-server and other email addresses. I appears that when I create the alias, the on-server addresses have user between backslashes as in \user\@domain.tld

But in Virtualmin, (domain), Mail Options, Edit mail aliases, the email addresses are “clean” like user@domain.tld.

The server was first setup with Virtualmin about 8 years ago. After setup I remember changing an option to enable logging in to Usermin with user@domain.tld (previously I think I had to type user-domain.tld).
Since then I have moved from Centos 6, to Centos 7, to AlmaLinux 9. Each time migrating using Virtualmin backup. And I never had a problem. My server is small - just a few (4) family domains. The issue did not affect simple users, it only occurred on email aliases that we use as a form of mailing list so we can send mail to family@domain and have Postfix send it to each of the aliased addresses, some on-server and some to Gmail, Hotmail etc.

Thank you all for your help, comments and suggestions. Much appreciated, but I think it’s not necessary to go further.

Can you just take the tar.gz file without any metadata files (with no .dom and .info), try to restore it using the same steps, and see if it crashes your server? That said, you don’t actually need to restore it; just select the file for restore and click the button to see what will be restored.

That is expected.

Can you explain why would you want that exactly?

That is expected also.

No, thank you!

Yes, only the contents of the tar.gz file are listed.

Are they loaded into memory? What if the backup file is 2TB and the .dom and .info files are missing?

No, even in that case the whole file isn’t read into RAM.

The restore shows what will be restored correctly and completes without errors.
I’m now fairly sure that the initial error was due to uploading the 5Gb file in the browser, since it has worked in all variants (e.g. only one domain tar.gz, all domains including .dom and .info) when I uploaded using File Manager.

My detailed knowledge of Postfix is sketchy at best, so I based the alias I want on the NDR (post 1 above) which said:

user-domain.tld@hostname (expanded from name@domain.tld): unknown user: “user-domain.tld”

So I assumed user-domain.tld was invalid for some reason - or at least couldn’t be delivered. I vaguely remember some time back that Postfix couldn’t deal with usernames including the @ sign, but I don’t know if that has since changed.

I think I should step back from this conversation until I have more knowledge of Postfix.

Thanks again for your patience :slight_smile:

Yes, this is the current limitation when uploading a backup directly on the restore page. We should fix it—it’s a lower priority but I’ll check.

I have spent some time checking it over again, and I do not see any issue. Mail aliases are created and restored from a backup just fine.

The \ that you see in aliases table is expected for any local user. If a virtual user table in Postfix references a local virtual user it should (correctly) point to a record that is escaped to deliver locally.

If it’s a new system configured with Postfix configured not to create extra users (remember that option in Virtualmin Configuration → Advanced options page), then I don’t have an answer for your question because everything worked correctly in my tests (create, delete and restore).

If it’s an old setup with extra Postfix users, I can run more deeper tests again to check that, too. However, I remember doing that before, and it should still work. If it doesn’t, please let me know!