Hello 
I have a VM running on PVE 8.3.3 with a hookscript setup on it.
The hookscript appears to be running only when the VM shutdowns (either from the VM itself or via PVE webui). As part of the troubleshooting of this, I have replaced my own brewed script with the example PERL script and the same behavior is observed.
On the "System Log" of the node hosting my VM (VMID is 4020) I can only see the output for the "stop" phase as below
The hookscript itself (example script cleaned up from comments):
I have no idea when it stopped working, I had CPU pining performed for the VM to contain it on one CCD of my CPU. This seems to not apply anymore and it triggering checking the hookscript.
Does any of you have an idea why the "pre-start" and "post-start" are triggering output ?
Is there any additional logs I can check to confirm the behavior of hookscript ?
I'm unsure what additional info you may want, please don't ignore if you are missing something simply tell me and I will provide.
ArnaudN

I have a VM running on PVE 8.3.3 with a hookscript setup on it.
The hookscript appears to be running only when the VM shutdowns (either from the VM itself or via PVE webui). As part of the troubleshooting of this, I have replaced my own brewed script with the example PERL script and the same behavior is observed.
On the "System Log" of the node hosting my VM (VMID is 4020) I can only see the output for the "stop" phase as below
Code:
Feb 12 13:19:37 HW-1-NDZ-001-AeosPrime pvedaemon[710948]: start VM 4020: UPID:HW-1-NDZ-001-AeosPrime:000AD924:00E15ED3:67AC91D9:qmstart:4020:root@pam:
Feb 12 13:19:37 HW-1-NDZ-001-AeosPrime pvedaemon[703744]: <root@pam> starting task UPID:HW-1-NDZ-001-AeosPrime:000AD924:00E15ED3:67AC91D9:qmstart:4020:root@pam:
[... Removed Pass-through output info for clarity ...]
Feb 12 13:19:38 HW-1-NDZ-001-AeosPrime systemd[1]: Started 4020.scope.
[... Removed Pass-through output info for clarity ...]
Feb 12 13:19:42 HW-1-NDZ-001-AeosPrime pvedaemon[710948]: VM 4020 started with PID 710982.
[... Removed Pass-through output info for clarity ...]
Feb 12 15:12:06 HW-1-NDZ-001-AeosPrime qmeventd[763273]: Starting cleanup for 4020
Feb 12 15:12:06 HW-1-NDZ-001-AeosPrime qmeventd[763273]: GUEST HOOK: 4020 post-stop
Feb 12 15:12:06 HW-1-NDZ-001-AeosPrime qmeventd[763273]: 4020 stopped. Doing cleanup.
Feb 12 15:12:06 HW-1-NDZ-001-AeosPrime qmeventd[763273]: Finished cleanup for 4020
[... Removed Pass-through output info for clarity ...]
Feb 12 15:12:09 HW-1-NDZ-001-AeosPrime systemd[1]: 4020.scope: Deactivated successfully.
Feb 12 15:12:09 HW-1-NDZ-001-AeosPrime systemd[1]: 4020.scope: Consumed 18min 25.597s CPU time.
The hookscript itself (example script cleaned up from comments):
Perl:
#!/usr/bin/perl
use strict;
use warnings;
print "GUEST HOOK: " . join(' ', @ARGV). "\n";
my $vmid = shift;
my $phase = shift;
if ($phase eq 'pre-start') {
print "$vmid is starting, doing preparations.\n";
} elsif ($phase eq 'post-start') {
print "$vmid started successfully.\n";
} elsif ($phase eq 'pre-stop') {
print "$vmid will be stopped.\n";
} elsif ($phase eq 'post-stop') {
print "$vmid stopped. Doing cleanup.\n";
} else {
die "got unknown phase '$phase'\n";
}
exit(0);
I have no idea when it stopped working, I had CPU pining performed for the VM to contain it on one CCD of my CPU. This seems to not apply anymore and it triggering checking the hookscript.
Does any of you have an idea why the "pre-start" and "post-start" are triggering output ?
Is there any additional logs I can check to confirm the behavior of hookscript ?
I'm unsure what additional info you may want, please don't ignore if you are missing something simply tell me and I will provide.
ArnaudN