-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libvirt hooks run without bash context #98448
Comments
FWIW, I work around this by simply excluding the shebang(s): Not really a solution, but a(nother) workaround for the time being. |
I marked this as stale due to inactivity. → More info |
Still important to me |
I just came across the same issue. Thank you cole-h for the reference nix configuration. |
FWIW, I've slightly changed how I do this: https://github.com/cole-h/nixos-config/blob/61d17a3355288872e4b765ddce1700654a9accc8/hosts/scadrial/modules/libvirt/default.nix#L5-L16 |
Thanks @cole-h, I didn't realise modprobe would also be unavailable to my hooks.
|
I marked this as stale due to inactivity. → More info |
Describe the bug
This bug is partially related to #51152, in that a declarative method of adding the hooks would solve this.
Hooks (eg
/var/lib/libvirt/hooks/qemu
) normally start with#!/usr/bin/env bash
.It seems this isn't valid within the libvirt context and causes the hook execution - and therefore the vm - to fail.
Instead I have had to work around this by using
#!/run/current-system/sw/bin/bash
.To Reproduce
Steps to reproduce the behavior:
Expected behavior
VM starts without error
Screenshots
Additional context
#!/usr/bin/env bash
does not fix the issue#!/run/current-system/sw/bin/bash
does fix the issue.This also applies to all hook scripts that are in turn executed by the hook itself.
Eg.
qemu.d/<vm>/prepare/begin/start.sh
.Notify maintainers
@fpletz
Metadata
$ nix-shell -p nix-info --run "nix-info -m"
"x86_64-linux"
Linux 5.4.62, NixOS, 20.03.2913.4bd1938e03e (Markhor)
yes
yes
nix-env (Nix) 2.3.6
"home-manager-20.03, nixos-20.03.2913.4bd1938e03e"
/nix/var/nix/profiles/per-user/root/channels/nixos
Maintainer information:
The text was updated successfully, but these errors were encountered: