In Progress [CPANEL-29469] Backup creating empty folders for no apparent reason

Smartypants

Member
May 1, 2015
24
1
53
cPanel Access Level
Root Administrator
I have the CPanel backup system enabled on my various servers, configured to send (weekly) backups to an in-house SSH/SFTP server. This works for the most part, but for several years I've noticed that CPanel's backup system has a weird glitch where it will create empty folders in the backup destination, apparently with no rhyme or reason. Specifically, within the backup destination/folder, there is a "weekly" sub-folder, which in turn contains sub-folders for each week's backup, in other words/E.g.:

/backup/
/backup/weekly/
/backup/weekly/2019-07-21/
/backup/weekly/2019-07-21/accounts/

That part works as expected/intended. However, CPanel's backup is ALSO creating folders outside the /backup/weekly/ folder (in the /backup/ folder itself) that have the same names/dates as the weekly backup folders, and also contain "accounts" sub-folders... but they're completely empty, except for the ".master.meta" file.

I've checked in case I'd accidentally enabled monthly or daily backup as well, but verified that that isn't the case. Why is CPanel's backup creating the duplicate folders - or is there at least fix/workaround to prevent that?
 

Smartypants

Member
May 1, 2015
24
1
53
cPanel Access Level
Root Administrator
Are the backups completing as expected? Meaning are there errors in the backup logs? You can find them at /usr/local/cpanel/logs/cpbackup/
I haven't checked the logs, but it does complete the backups. Continuing the example, I have the following folders:

/backup/weekly/2019-07-21/accounts/
and
/backup/2019-07-21/accounts/

The backups were successfully created & copied to the /backup/weekly/2019-07-21/accounts/ folder, while /backup/2019-07-21/accounts/ is empty & there doesn't seem to be any reason for it to exist.

It's more of an annoyance than anything else, though I've noticed it happening for a while now & it has caused a few moments of panic, along the lines of "Okay, I'll just restore that from backu-OH NO WHERE DID ALL THE BACKUPS GO?!?!? ...oh, wait, I'm looking in the wrong folder, phew, I'll just go get that from the correct folder once my heart starts beating again."
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,309
363
Houston
Hi @Smartypants

My curiosity being whether or not the pruning operation is completing properly. It would be noted in either the backup logs or the backup_transport logs if there were errors.
 

Smartypants

Member
May 1, 2015
24
1
53
cPanel Access Level
Root Administrator
Hi @Smartypants

My curiosity being whether or not the pruning operation is completing properly. It would be noted in either the backup logs or the backup_transport logs if there were errors.
I'm not certain - I don't see separate backup & backup_transport logs in that folder, just two .log files that appear to be from the last 2 backup runs: 1563084008.log and 1563688808.log. When I search through the latest one, there are no errors related to pruning, and the only log items that appear to be related to pruning are:

[2019-07-21 02:00:10 -0400] info [backup] Pruning metadata for backup at /backup/weekly/2019-07-21

And:

[2019-07-21 12:10:38 -0400] info [backup] Queuing prune operation for remote destination weekly backups
 

Smartypants

Member
May 1, 2015
24
1
53
cPanel Access Level
Root Administrator
Any update on this...? The issue is still occurring, CPanel is still creating duplicate/empty folders every time the weekly backup runs - it's since created those for 2019-07-28, 2019-08-04, 2019-08-11, 2019-08-18.

I see that others are experiencing a similar issue (see post 7 here: Backup creating two sets of backups). Based on the solution recommended there, it sounds like it would be better to disable weekly backups, then enable daily backups & configure them to backup only 1 day per week - would that get around whatever glitch is causing CPanel to create the duplicate folders?

I suppose that, worst-case, I could change the folder permissions so that the only the /backup/weekly/ folder is writable, and prevent CPanel from creating the empty/duplicate folders that way - though that seems like a hack (one that really shouldn't be necessary in the first place), and I wouldn't be surprised if that would cause additional problems.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,309
363
Houston
Hi @Smartypants

That post you're referencing is not quite the same issue you seem to be encountering. I think that the best way to go about this at this point would be to open a ticket with us. You shouldn't need to have to go through and remove empty folders when backups run.
 

Smartypants

Member
May 1, 2015
24
1
53
cPanel Access Level
Root Administrator
After much back-and-forth, it was finally confirmed that this is in fact a CPanel issue (ticket ID# 13265829) - so the only option is to wait and hope that it will eventually be fixed in a future update...
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,309
363
Houston
Hi @Smartypants

I did have a feeling that something was amiss here, that is not the intended behavior. CPANEL-29469 is open for this issue which seems to be specific to SFTP remote backup destinations only. I'll update here when the issue is updated or added to a RELEASE version of cPanel/WHM

Thanks!