Bug in Virtualmin restore process?

I’ve been running into what I believe may be a bug in Virtualmin’s restore process. A few weeks ago, we had a server go down, and had to bring it back up from our Virtualmin backups, which are in the one archive per server format. Most everything went smoothly and we were able to get everything back up within a day, however, I’m now running into instances where multiple users will have the same ID. I suspect this is a side effect of having multiple people restoring these backups at the same time. Does anyone know of a script to look for any more duplicated ID’s? So far it’s caused only minor issues which have been fixed by manually changing the ID on the affected users, but I’m concerned that this could become a greater issue.

That sounds like a pretty big bug. I’ll ask Jamie to drop by this thread. (In the future, when you’ve got a bug, drop it in the bug tracker…it’s easier to keep up with what’s going on with issues when we can change statuses, take ownership, etc.). Forum posts make it easy to forget about the problem.

yeah there were multiple restores running simultaneously. Perhaps a feature for the restore where if you need to restore from multiple one-domain-per-file archives, you can feed it just a folder full of the archives and it will do them one at a time? Or is this already present and we missed the capability?

You can restore a whole directory of backup files with a command like :

restore-domain.pl --source /backups --all-domains --all-features

or replace --all-domains with parameters like :

–domain domain1.com --domain whatever.com etc…

Actually, I took another look at my code, and found that when restoring domains the UIDs from the original system are preserved by default … so it shouldn’t actually be possible to get a clash, even if you have two restores running at the same time. Unless you used the --reuid parameter to restore-domain.pl to re-allocate UIDs ?

Did you have several restores running at the same time? This could have triggered a problem like this, when Virtualmin checks for free UIDs before creating users and then creates them in two separate processes at the same time.

I will try to recreate this situation on my own system, and fix it in the next Virtualmin release. You can find duplicate UIDs on your own box with a command like :

perl -e ‘while(@u=getpwent()) { $uid{$u[2]}++ }; foreach $u (keys %uid) { print “$u : $uid{$u}\n” if ($uid{$u} > 1) }’