Subject: Re: [bug#77004] [PATCH] gnu: libvirt: Fix path to Linux modules, [PATCH] gnu: libvirt: Fix path to Linux modules

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 16 Mar 2025 22:14:47 +0900

Hi Nathan,

nathan <[email-masked]> writes:

> libvirt needs to load a file that is inside the modules folder.
> Fix the path
> Nix has a similar fix https://github.com/NixOS/nixpkgs/pull/286985
>
> From f3317c91eb469ff54e31b0fafd45e2070a1bb06a Mon Sep 17 00:00:00 2001
> Message-ID: <f33[email-masked]>
> From: nathan <[email-masked]>
> Date: Thu, 13 Mar 2025 20:36:27 -0400
> Subject: [PATCH] gnu: libvirt: Fix path to Linux modules
>
> * gnu/packages/virtualization.scm (libvirt): Use LINUX_MODULE_DIRECTORY to
> find modules.
> [source]: Add libvirt-respect-modules-path.patch
> * gnu/packages/patches/libvirt-respect-modules-path.patch: new file
> * gnu/local.mk: Register new file
> * gnu/services/virtualization.scm (libvirt-shepherd-service)
> <#:environment-variables>: pass LINUX_MODULE_DIRECTORY

LGTM.

[...]

> @@ -508,11 +508,13 @@ (define (libvirt-shepherd-service config)
>                       (list (string-append #$libvirt "/sbin/libvirtd")
>                             "-f" #$config-file
>                             #$@(if listen-tcp? '("--listen") '()))
> -                     ;; For finding qemu and ip binaries.
> +                     ;; For finding qemu, ip binaries, and kernel modules
>                       #:environment-variables
> -                     (list (string-append
> -                            "PATH=/run/current-system/profile/bin:"
> -                            "/run/current-system/profile/sbin"))))
> +                     (list
> +                      (string-append
> +                       "PATH=/run/current-system/profile/bin:"
> +                       "/run/current-system/profile/sbin")
> +                      "LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules")))

I suppose only modules from the booted kernel makes sense to be used,
hence the /run/booted-system instead of /run/current-system as Nix uses?

-- 
Thanks,
Maxim