Libxl hook isn't working?

I have no idea what’s going on but my libxl isn’t doing anything.
Does not matter how basic I make it, it just doesn’t do anything.

I literally have it echoing $1 and $2 to a file in a 777 folder. Nothing…

Permissions are all fine.

Is the script working when you run it manually?

yes, that works fine.
My first thought was a coding error, but all it does at the moment is…

echo $# > /dev/kmsg

So outputs the number of arguments to dmesg

Nothing fancy, nothing that causes issues.

I can even change it to output to the normal log location I use for my script, and no issue when running manually.

So I don’t know what is causing this issue.

Can you elaborate on what you did to set this hook?

Created the file, added the code, made it executable.

#!/bin/bash
echo $# > /dev/kmsg

That is all that is in there because I’m trying to get it working.

Can you provide the full path where the libxl script is located and its name?
Also, have you tried restarting the libvirtd service? Maybe it doesn’t know it exists yet.

I tried your script, just changed the path to a random log file in my home directory and I was able to get output when a qube start/shutdown.

Exactly right. I can get it to work perfectly when running it manually.
It’s just it won’t run automatically.

It is in the correct location
-rwxr-xr-x 1 root qubes 557 Feb 25 20:26 /etc/libvirt/hooks/libxl

I should also mention, I’ve restarted my PC many times trying to get it working.

Where in the startup and shutdown code does it call the libxl hook? Or if not in the Qubes code, how does it actually get called?

That seems correct.

Here’s mine:

-rwxr-xr-x 1 root root 372 Feb 26 08:50 /etc/libvirt/hooks/libxl

Content:

#!/bin/bash

qube="$1"
state="$2"
action="$3"

echo "$qube - $state - $action" >> /tmp/libxl.log

/tmp/libxl.log after starting a disp qube:

disp8462 - prepare - begin
disp8462 - start - begin
disp8462 - started - begin

If you use the same script, do you have the same behavior as I do?

1 Like

Mine does not get executed, remember?
That’s what we are trying to resolve.
Once we have that figured out, we can work on the internal behaviour.