How-to: cPanel to DA migration

the Cpanel import script have a big problem.

We tried to migrate 70 accounts, 45 failed with a message saying "database is locked", wich on other thread someone from DA i guess, said it was a problem creating the backup on the Cpanel server.

But if we login to cpanel server and with the same packgacct script create the 70 backups, none of them fails

And is not something about server load, or the amount of account, we tried now with just 1 account, and same error database is locked.
 
I've created a new Migration tool to help our resellers move from WHM to DirectAdmin, but this is a free tool for anyone to use, for any Host/servers as long as the host has an FTP service. Basically it automates the backup and transfer process and will also rename the backup files from backup-xxxx.tar.gx to cpmove-xxxx.tar.gz

The end result is the DirectAdmin reseller account will be left with a directory full of all the cpmove files which the reseller can then Restore easily from within DirectAdmin themselves. Basically it just automates everything for the reseller except the last step, but that last step is quick anyway as DirectAdmin automates the restores. So resellers can now do migrations themselves without the need of root or admin intervention/access.

Here is the link: https://deasoft.com/tools/cpanel-directadmin-automated-migration-tool.php
 
Last edited:
I've created a new Migration tool to help our resellers move from WHM to DirectAdmin, but this is a free tool for anyone to use, for any Host/servers as long as the host has an FTP service. Basically it automates the backup and transfer process and will also rename the backup files from backup-xxxx.tar.gx to cpmove-xxxx.tar.gz

The end result is the DirectAdmin reseller account will be left with a directory full of all the cpmove files which the reseller can then Restore easily from within DirectAdmin themselves. Basically it just automates everything for the reseller except the last step, but that last step is quick anyway as DirectAdmin automates the restores. So resellers can now do migrations themselves without the need of root or admin intervention/access.

Here is the link: https://deasoft.com/tools/cpanel-directadmin-automated-migration-tool.php
i would never enter login credentials of Cpanel, FTP or DA to anywebsite, and would recommend anyone to never do that.

If you want to release a tool for public use, release the code and everyone can check it and use it.

just my opinion, it's a big risk.
 
Yeah I understand, what you say is reasonable, but what you suggest is a fair bit more work that will take some time :) - The other option is to reset your passwords immediately after using it, but even so I understand you wouldn't know if it did something malicious before completing its work.

I can state plainly as the person who coded this I have no interest at all in peoples login details or doing something nefarious. The purpose was to initially make life easier for myself and my own clients and then I thought - why don't I make it publicly available and gain some good will and exposure. But yeah thinking about it more, it's probably too much of a security issue for most.

I could release the code, I will think about that. Problem with that is it will no doubt be taken and exploited by others for their own gain...... What I might end up doing is putting it in my DAreseller software.

Anyway thanks for your feedback.

Update - I added a FAQ to answer peoples questions.
 
Last edited:
I have a problem with the migration tool.

When I have a email account with the same name as system user in cpanel the script tries to merge the mail boxes as seen in the logs here:

WARNING! [email protected] matches system account name, merging mailbox with system user's one.

On restore the mailbox is empty at the direct admin end. It hasn't imported the [email protected] email.

On CPanel [email protected] has about 250MB of data. On Directadmin [email protected] ends up with 0 bytes of data in the mailbox. All other mailboxes transfer fine.

If i rename these accounts in cpanel its going to change the name of the databases and I will have to manually fix wordpress etc for about 60 sites.
 
When I have a email account with the same name as system user in cpanel
You shouldn't use names that are used for email as system user. It is better to give every system user a name that wouldn't be used for mail.

Also you should check if there isn't a MBOX or MDBOX now at the system user maildir as sometimes cpanel mbox/mdbox convert will not work and you will not see mail untill you convert the mbox or mdbox to maildir. You can easy do it.

But i would change the system user name on your da server and import cpanel again.
 
the Cpanel import script have a big problem.

We tried to migrate 70 accounts, 45 failed with a message saying "database is locked", wich on other
thread someone from DA i guess, said it was a problem creating the backup on the Cpanel server.

But if we login to cpanel server and with the same packgacct script create the 70 backups, none of them fails
And is not something about server load, or the amount of account, we tried now with just 1 account, and same error database is locked.
when using the same script directly on the CPanel server, the backups are created without any issues. This suggests that the problem might be related to the environment or configuration where the import script is being executed. It's worth investigating potential differences in the environments or any specific settings that could be causing the database lock errors during migration.
 
If there is no support included with your license - please PM me any cpmove backup file which had this issue (you may create a new one, without any data, if you wish). I'd like to check why FTP accounts didn't get migrated there.

Thanks, after some figuring, I was able to create a ticket in the end. The mistake was trying to create the ticket with our ID + the license ID, instead of our ID + our pass.

If you have access, ticket #31750 - the x4 cpmove tgz's are on the server and the ticket has admin details to access it.

Was this ever resolved?

I bring this up, because I'm seeing the same behavior now. Sub FTP users on cPanel are not being copied over to DirectAdmin.

Perhaps the most damning thing is that the directories for these sub FTP users are not being copied over. It's one thing to miss the FTP accounts themselves (i.e. not being able to log in to these special FTP accounts) it's another thing to completely miss the contents of the directories these sub FTP accounts have.

For example, if a sub FTP account on cPanel has the home directory: /home/%user/%domain%/ftp1 at the very least I would expect the directory - /home/%user/%domain%/ftp1 to exist on DirectAdmin when the hosting account is migrated over. But at least for me this directory and it's contents all appear to be missing with the migration. Is the migration script not doing a 1:1 copy of the web hosting account's home directory?

I will also add that I'm kind of creating my own wrapping system around the cpanel_to_da.sh script, so it's possible all of this is missing due to something that I am doing (although I don't know what that would be). But I did find this mention in the thread from @jonathanPcolo which seems to mirror what I am seeing. I'm not seeing any further discussion regarding this issue - so that's why I'm asking now.
 
Ha! Turns out I was kind of on to this in March of last year:


The issue here stems from the fact that cpanel_to_da.sh is going to use zstd regardless if it's enabled in directadmin.conf as long as /usr/bin/zstd (or more specifically command -v zstd) exists.

I don't have zstd enabled on our servers, but the /usr/bin/zstd binary does exist on the server.

This results in the restore process not properly restoring things from the home.tar.zst in the package backup.

I would propose the attached patch that does a system check to see if zstd is enabled in DirectAdmin before changing the TAR_ENDING variable.

You PROBABLY need the same thing for pigz, although it doesn't appear to cause any disruptions like zstd does.

And while you're at it, you may want to do the same thing for gzip - which I assume is tied to the DirectAdmin configuration option backup_gzip

I know I'm probably an outlier in that I don't normally use compression because the saved disk space doesn't counteract the added CPU time to do the compression.

The cpanel_to_da.sh script is just looking for the existence of these compression binaries without any regard of whether or not they are enabled in the DirectAdmin configuration. And then the restore process is acting on what DirectAdmin configuration compression options are enabled.
 

Attachments

I have been using these methos without big issues for a good amount of time.

today we migrated 3 accounts from Cpanel to DA, but 1 of them fails (tried 3 times already)

-----------------------------------------------
We tried manuall moving the cpmove- file, fails with
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
Failed to extract /home/admin/admin_backups/cpmove-USERACC.tar.gz to /home/admin/admin_backups/USERACC_cpanel_to_convert

Error converting file: /home/admin/admin_backups/cpmove-USERACC.tar.gz: Converting rene021516 (/home/admin/admin_backups/cpmove-USERACC.tar.gz)...

File '/home/admin/admin_backups/cpmove-USERACC.tar.gz' has not been restored

-----------------------------------------------

tried the Cpanel import trough DA GUI, fails with
convert stage, parsing cpmove user config: open as tar archive: archive/tar: invalid tar header

---------------------------------------------

anyone familiar with this?
 
Same problem here. Same error, started today for me.

Did you already open a ticket with DA?
 
Same problem here. Same error, started today for me.

Did you already open a ticket with DA?
Hi,

Yes, on ticket support checked and it seems the issue is with the backup itself (not being able to untar it). it's odd, since we can create the backup on cpanel without issues, and have tried 6 times already.

sadly haven't had time to check it further, but i will try today/tomorrow.
 
I'm able to untar the file on mac, so it's not a corrupt file or anything. Something changed in 1.663, because it was working well previously.
 
Still happening, this time with a different cpmove file, and different destination server :\
 

Attachments

  • Castris404 Not Found0725200928.jpg
    Castris404 Not Found0725200928.jpg
    33.2 KB · Views: 55
Is possible correct link?
It's the old link, converted to seo link I guess. Now it's this one:
 
It's the old link, converted to seo link I guess. Now it's this one:
A lot of thanks.
 
Since some time, every Cpanel to DA migration, using the Cpanel Importer inside DA has completed succesfully, but all databases have been migrated empty.
 
Also, the Cpanel Importer tool, is not updating both NS records.

this has always been like that, but should be fixed.
 
Back
Top