Backup Virtual Servers fails with strange " failed to create temporary backup directory" error

After importing all of our virtual servers from our old cPanel/WHM server to our new Virtualmin GPL server, I set up daily backups using the Backup Virtual servers feature. Everything works as it should accept a dozen or so subdomains that should have a directory of the format /home/username/domains/subdomain, but that directory doesn't exist. We get the following error in the the backup logs.

Creating backup for virtual server ..

.. failed to create temporary backup directory /home/username/domains/ : mkdir: cannot create directory `/home/username/domains/': No such file or directory

.. completed in 0 seconds

I have already posted on your help forum before creating this bug report to see if my problem was common, or if it could be a bug in Virtualmin's cPanel importer. The post linked below includes additional details regarding this bug.

Thanks, Dave.



So does the directory /home/username/domains/ exist?

Also, if you SSH in as root and run :

virtualmin validate-domains --domain --all-features

what does it output?

There are two virtual servers that have sub domains with this same problem. Both do not have /home/username/domains/ directories. Furthermore, they don't even have the main "domains" root directory of /home/username/domains.

The output of the command you asked me to run as root for all affected sub domains is:

[root@hostname ~]# virtualmin validate-domains --domain --all-features
    Home directory : Home directory /home/username/domains/ does not exist

Ok, that's the cause of the problem. Were both these domains migrated from cPanel?

The fix is to simply create those missing directories, and make sure they are owned by the same user and group as /home/username

Yes, both domains with these broken subdomains were migrated from cPanel.

Should I create the other directories that are in the main subdomain directory such as:

etc  fcgi-bin  homes  logs  tmp

php5  php.ini






Or will virtualmin create these other directories if they're needed later on.

I created the main "domains" directory and the smaller containing directories for each sub domain as the correct user, but I'll skip creating the smaller logs, tmp, and so on directories.

Tomorrow I'll check the backup log to see if the " failed to create temporary backup directory" errors are gone.

For a cPanel subdomain you don't really need those other directories ... but creating them won't cause any harm.

I'm still not entirely sure what the original cause of this issue was though. To debug further, I'd have to see the cPanel backup file you were migrating from.

Shouldn't the import from cPanel both have created the proper home directory, and populated it with the "public_html" data contained in the cPanel domain?

So if Dave now simply creates the home directory, it will be empty, and he'll have to populate it manually with the stuff from the former cPanel domain, right?

Yes, the import should have created it ... that's why I'd like to see the cPanel backup file used, to work out why that part of the import failed.

Ok, I checked the backup log, and there are no longer any errors. So, the errors were caused by those directories not existing.

@Locutus The subdomains in question may not of even had web sites in them to bother copying to a public_html directory. I believe they were just used for email.

@JamieCameron I'll ask my brother to see about uploading the cPanel backup files used. However, they both have web forums full of databases with usernames, password hashes, and email addresses and so on. So it's not as easy as just uploading them. I'll ask him if he can just delete the database files, and the contents of the Web directory, which should solve the privacy problem, and still leave them useful to debug this problem.