Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED Account Restore Failed: Cannot cleanup top level directory

Discussion in 'Data Protection' started by Sadaqat, Apr 28, 2017.

Tags:
  1. Sadaqat

    Sadaqat Registered

    Joined:
    Apr 28, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Bahrain
    cPanel Access Level:
    Root Administrator
    My VPS crashed so setup a new VPS and moving *.tar.gz cPanel accounts from backup and restoring them through Full Backup restore function of WHM, however running into captioned error for every account transferred.
    Took the liberty to check the line 668 in ArchieveManager.pm and it corresponds to the following codes string:
    Code:
    sub cleanup {
        my ($self) = @_;
    
        if ( $self->{'_temp_extract_dir'} && -e $self->{'_temp_extract_dir'} ) {
    
            # Ensure we never clean /XXXX
            # These are various safety checks to avoid blowing away
            # any directories that should never be cleaned up
            my $target_with_trailing_slash = $self->{'_temp_extract_dir'};
            $target_with_trailing_slash =~ s{/+$}{};
            if ( ( $target_with_trailing_slash =~ tr{/}{} ) <= 1 ) {
                die "clean: Cannot cleanup top level directory: “$self->{'_temp_extract_dir'} ”.";
            }
    
            my $run = Cpanel::SafeRun::Object->new(
                program => '/bin/rm',
                args    => [ '--recursive', '--force', '--', $self->{'_temp_extract_dir'} ],
            );
    
            warn $run->stderr() . $run->autopsy() if $run->CHILD_ERROR();
    Can you please tell me what is the solution to this? It seems there some "/" in the restore files thats causing the issue here, but how can change/resolve/bypass that and get the restore to complete?

    A quick look at the files reveals that the files have been moved into a temp folder in root however the cpanel account has been created and its mapping the file manager to its respective files - But its not sitting where it should be ... under /home directory. Furthermore the associated domain is not fully functional, while home page links, sub domains dont.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It's possible the permissions on your "/" directory are not allowing the restoration process the ability to complete. Could you try moving the backup archives to the /home directory before starting the restoration process? Let us know if that helps.

    Thank you.
     
    Sadaqat likes this.
  3. Sadaqat

    Sadaqat Registered

    Joined:
    Apr 28, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Bahrain
    cPanel Access Level:
    Root Administrator
    Done! Worked like a charm!

    Thank you!
     
    cPanelMichael likes this.
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm happy to see that helped. Thank you for updating us with the outcome.
     
Loading...

Share This Page