An issue with Backup - TASK ERROR: command '/usr/local/bin/vzdump-hook.pl job-init' failed: exit code 255

smellycat

New Member
May 31, 2023
17
0
1
Hello everyone.

I'm having an issue with backup that driving me crazy. This is the error

INFO: HOOK: job-init INFO: oops, i got a weird phase that i dont recognize 'job-init' at /usr/local/bin/vzdump-hook.pl line 67. TASK ERROR: command '/usr/local/bin/vzdump-hook.pl job-init' failed: exit code 255

I think the issue was when I tried to use a hookup script to do a backup on google drive, but for some reason now every time I try to do a backup, the backup is run over this script even if this is not stated in the jobs file. How can i ignore this hook script and run backup normaly
 
Last edited:
the hookscript is defined globally for all jobs in /etc/vzdump.conf
 
you can edit the file and remove the hookscript, but it's removed for all jobs then of course
 
you can remove the hookscript line then the other options are not changed (if there are any)
 
I removed the content from /etc/vzdump.conf and file is now empty. But again it's the same error and it is pointing to this script

/usr/local/bin/vzdump-hook.pl

This is the content of the script

Code:
#!/usr/bin/perl -w

# example hook script for vzdump (--script option)

use strict;

print "HOOK: " . join (' ', @ARGV) . "\n";

my $phase = shift;

if ($phase eq 'job-start' ||
        $phase eq 'job-end'  ||
        $phase eq 'job-abort') {

        my $dumpdir = $ENV{DUMPDIR};

        my $storeid = $ENV{STOREID};

        print "HOOK-ENV: dumpdir=$dumpdir;storeid=$storeid\n";

        if ($phase eq 'job-end') {
        system ("rclone delete --config /root/.config/rclone/rclone.conf --min-age 1w -vvvvv GSuite:backups/") == 0 ||
                die "Deleting old backups failed";
        }
} elsif ($phase eq 'backup-start' ||
         $phase eq 'backup-end' ||
         $phase eq 'backup-abort' ||
         $phase eq 'log-end' ||
         $phase eq 'pre-stop' ||
         $phase eq 'pre-restart' ||
         $phase eq 'post-restart') {

        my $mode = shift; # stop/suspend/snapshot

        my $vmid = shift;

        my $vmtype = $ENV{VMTYPE}; # lxc/qemu

        my $dumpdir = $ENV{DUMPDIR};

        my $storeid = $ENV{STOREID};

        my $hostname = $ENV{HOSTNAME};

        # tarfile is only available in phase 'backup-end'
        my $tarfile = $ENV{TARFILE};

        # logfile is only available in phase 'log-end'
        my $logfile = $ENV{LOGFILE};

        print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;storeid=$storeid;hostname=$hostname;tarfile=$tarfile;logfile=$logfile\n";

        # move tarfile to /backups directory in google drive
        if ($phase eq 'backup-end') {
        system ("rclone move -v --config /root/.config/rclone/rclone.conf $tarfile GSuite:/backups") == 0 ||
                die "move tar file to gdrive failed";
        }

        # copy tarfile to /backups-log directory in google drive
        if ($phase eq 'log-end') {
                system ("rclone copy --config /root/.config/rclone/rclone.conf $logfile GSuite:/backups-log") == 0 ||
                        die "copy log file to gdrive failed";
        }

} else {

        die "oops, i got a weird phase that i dont recognize '$phase'";

}

exit (0);
 
Ah, I found the solution. I had the line script: /usr/local/bin/vzdump-hook.pl in /etc/vzdump.conf so the hook file run with every backup:

I removed it and now all is working
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!