Fatal PHP error with Teleporter

Please follow the below template, it will help us to help you!

If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.

Expected Behaviour:

I am trying to use pihole -a -t to create scheduled backup jobs. This command appears to work once and only once. After which, you get a fatal PHP error claiming that the backup file already exists, even if you delete it. I'm running this script under the /tmp directory. I'm expecting to get a .tar.gz container with the datetime stamp in the file name.

Actual Behaviour:

Instead of a new file, I get:
PHP Fatal error: Uncaught BadMethodCallException: phar "/tmp/pi-hole-pihole-wf-inside-teleporter_2022-06-30_11-21-35.tar.gz" exists and must be unlinked prior to conversion in /var/www/html/admin/scripts/pi-hole/php/teleporter.php:634 Stack trace: #0 /var/www/html/admin/scripts/pi-hole/php/teleporter.php(634): PharData->compress() #1 {main} thrown in /var/www/html/admin/scripts/pi-hole/php/teleporter.php on line 634
This happens even if I delete the previous backup files.

Debug Token:

GtTfU2RY

I can't recreate your issue on my side.
Consecutive executions of pihole -a -t always complete successfully.

Same for me. I cannot duplicate the observed problem.

I would look at details of the cron script.

Unfortunately it’s happening even outside of cron.

Sorry for overlooking this:
I can reliably reproduce your issue by running:

cd /tmp/
pihole -a -t

This causes teleporter.php to fail at:

634	$archive->compress(Phar::GZ); // Creates a gziped copy

This happens because PHP's compress function tries to create a temporary copy for holding the compression result in the system's tmp directory, which in your case happens to be the same directory where the target file is to be created.

Avoiding this should be easy:
Create a subdirectory in your tmp folder (e.g. /tmp/sched_backup/) and operate your backup jobs from that subdir.

@iTim314

Could you try if this special version fixes your issue?

pihole checkout web teleporter_tmp

You can go back to default anytime (and before upgrading to the next Pi-hole version) with

pihole checkout web master

This happens because PHP's compress function tries to create a temporary copy for holding the compression result in the system's tmp directory, which in your case happens to be the same directory where the target file is to be created.

This was it. A subdirectory fixes this. I should have known. Thank you!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.