[SOLVED] hookscript trips on PVE binary

drjaymz@

Member
Jan 19, 2022
130
5
23
102
I created a simple hookscript based on the example and attached to my VM.

Code:
$ qm start 109
hookscript error for 109 on pre-start: command '/mnt/pve/replica/snippets/wms-precheck.pl 109 pre-start' 
failed: open3: exec       of /mnt/pve/replica/snippets/wms-precheck.pl 109 pre-start 
failed: Text file busy at /usr/share/perl5/PVE/Tools.pm line 455

It could be that I cannot read the error properly but it looks like Tool.pm is trying to open a logfile which is already open so it fails.
I threw my code away and used the blank example - that doesn't work either so its not me.
The impractical upshot of it is that cannot start the VM.
 
yep and yep:

Code:
$pwd
    /mnt/pve/replica/snippets
$ls -l
total 7
-rwxr-xr-x 1 root root 1741 Jul  4 15:08 wms-precheck.pl

$ls -l /usr/bin/perl
-rwxr-xr-x 2 root root 3681152 Sep 24  2021 /usr/bin/perl

1688480331467.png

I thought it was the line endings but fixed that.
Its a simple thing I'm sure.

Did you put the hookscript in a Storage (that has snippets enabled)? Did you enable the execute bit?
 
Last edited:
Do you have the hookscript open in a text editor when trying to execute it? e.g. vim

You can also check who has handles on the file via:
Code:
lsof /mnt/pve/replica/snippets/wms-precheck.pl
 
So the problem was that sftp had the file open (even though it didn't) so I killed that process and restarted it and then we can run the file ok.
I'll mark as solved and leave it here so I can google it in 3 years time when I fall down the same hole.

he he he... vim.... I haven't got the patience for that I finally moved into the 1990s and now use an IDE.
 
Last edited: