Skip to content
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

Difference in kernel modules from nixos-generate-config and facter #65

Open
pimvh opened this issue Nov 4, 2024 · 2 comments
Open

Difference in kernel modules from nixos-generate-config and facter #65

pimvh opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@pimvh
Copy link

pimvh commented Nov 4, 2024

Describe the bug

Hi! Thanks for this cool new way of defining hardware config. I am not sure, but I think I ran into a bug.

I am not using nixos-hardware on my machine (as my laptop not defined in there), and using facter I observed changes in my available kernel modules.

In short, the following kernel modules did not appear when using facter instead of the generated hardware-configuration.nix:

> "usb_storage"
> "sd_mod"

Hardware config

nix hardware scan config:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{
  config,
  lib,
  pkgs,
  modulesPath,
  ...
}:

{
  imports = [
    (modulesPath + "/installer/scan/not-detected.nix")
  ];

  boot.initrd.availableKernelModules = [
    "xhci_pci"
    "thunderbolt"
    "nvme"
    "usb_storage"       # < -- missing in facter
    "sd_mod"            # < -- missing in facter
  ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" = {
    device = "/dev/disk/by-uuid/...";
    fsType = "ext4";
  };

  boot.initrd.luks.devices."luks-..".device = "/dev/disk/by-uuid/...";

  fileSystems."/boot" = {
    device = "/dev/disk/by-uuid/...";
    fsType = "vfat";
  };

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

generates the following kernel modules:

nixosConfigurations.<< host >>.config.boot.kernelModules
[
  "kvm-intel"
  "bridge"
  "macvlan"
  "tap"
  "tun"
  "tun"
  "loop"
  "atkbd"
  "ctr"
  "msr"
]

nixosConfigurations.nolte.config.boot.initrd.availableKernelModules
[
  "xhci_pci"
  "thunderbolt"
  "nvme"
  "usb_storage"
  "sd_mod"
  "ext2"
  "ext4"
  "dm_mod"
  "dm_crypt"
  "cryptd"
  "input_leds"
  "aes"
  "aes_generic"
  "blowfish"
  "twofish"
  "serpent"
  "cbc"
  "xts"
  "lrw"
  "sha1"
  "sha256"
  "sha512"
  "af_alg"
  "algif_skcipher"
  "ecb"
  "ahci"
  "sata_nv"
  "sata_via"
  "sata_sis"
  "sata_uli"
  "ata_piix"
  "pata_marvell"
  "nvme"
  "sd_mod"
  "sr_mod"
  "mmc_block"
  "uhci_hcd"
  "ehci_hcd"
  "ehci_pci"
  "ohci_hcd"
  "ohci_pci"
  "xhci_hcd"
  "xhci_pci"
  "usbhid"
  "hid_generic"
  "hid_lenovo"
  "hid_apple"
  "hid_roccat"
  "hid_logitech_hidpp"
  "hid_logitech_dj"
  "hid_microsoft"
  "hid_cherry"
  "hid_corsair"
  "pcips2"
  "atkbd"
  "i8042"
  "rtc_cmos"
]

Using facter

With the following relevant config:

...
modules = [
    inputs.nixos-facter-modules.nixosModules.facter
    # configure the facter report
    { config.facter.reportPath = "${self}/inventory/${systemAttrs.hostname}/facter.json"; }
]
...

I observed the following diff:

Version changes:
[C.]  nix-community/nixos-facter#1  udev-rules  <none> x2 -> <none>
Removed packages:
[R.]  nix-community/nixos-facter#1  extra-utils    <none>
[R.]  nix-community/nixos-facter#2  initrd-fsinfo  <none>
[R.]  nix-community/nixos-facter#3  keymap         <none>
[R.]  nix-community/nixos-facter#4  link-units     <none>
[R.]  nix-community/nixos-facter#5  stage          1-init.sh
Closure size: 2605 -> 2599 (14 paths added, 20 paths removed, delta -6, disk usage -15.5MiB).
nix-repl> nixosConfigurations.nolte.config.boot.kernelModules
[
  "kvm-intel"
  "bridge"
  "macvlan"
  "tap"
  "tun"
  "tun"
  "loop"
  "atkbd"
  "ctr"
  "msr"
]



nixosConfigurations.nolte.config.boot.initrd.availableKernelModules
[
  "thunderbolt"
  "xhci_pci"
  "nvme"
  "ext2"
  "ext4"
  "dm_mod"
  "dm_crypt"
  "cryptd"
  "input_leds"
  "aes"
  "aes_generic"
  "blowfish"
  "twofish"
  "serpent"
  "cbc"
  "xts"
  "lrw"
  "sha1"
  "sha256"
  "sha512"
  "af_alg"
  "algif_skcipher"
  "ecb"
  "ahci"
  "sata_nv"
  "sata_via"
  "sata_sis"
  "sata_uli"
  "ata_piix"
  "pata_marvell"
  "nvme"
  "sd_mod"
  "sr_mod"
  "mmc_block"
  "uhci_hcd"
  "ehci_hcd"
  "ehci_pci"
  "ohci_hcd"
  "ohci_pci"
  "xhci_hcd"
  "xhci_pci"
  "usbhid"
  "hid_generic"
  "hid_lenovo"
  "hid_apple"
  "hid_roccat"
  "hid_logitech_hidpp"
  "hid_logitech_dj"
  "hid_microsoft"
  "hid_cherry"
  "hid_corsair"
  "pcips2"
  "atkbd"
  "i8042"
  "rtc_cmos"
]

If I am correct, the facter hardware scan does not include the following 'extra' nixosConfigurations.<< host >>.config.boot.initrd.availableKernelModules, which appear when using hardware-configuration.nix:

> "usb_storage"
> "sd_mod"

Expected behavior

I expect the kernel modules to remain the same, as with hardware-configuration.nix. It might have to do with kernel modules which are generated on initial install via a USB stick, as when I re-generate the config these kernel modules seem to match the ones generated by facter, the missing kernel modules might indeed then be superfluous. I wonder whether this is expected behaviour. Regenerating it generates the following relevant config:

 boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" ];

System information

HP HP ZBook Firefly 14 inch G10 Mobile Workstation PC
Linux ... 6.6.56 nix-community/nixos-facter#1-NixOS SMP PREEMPT_DYNAMIC Thu Oct 10 10:50:06 UTC 2024 x86_64 GNU/Linux

And I am running NixOS unstable. I can share the full report if you want, but I am not sure whether that is relevant.

@pimvh pimvh added the bug Something isn't working label Nov 4, 2024
@pimvh pimvh changed the title Difference in kernel modules from nixos-generate-config and facter Difference in kernel modules from nixos-generate-config and facter Nov 4, 2024
@brianmcgee
Copy link
Collaborator

Hi, thanks for the detailed feedback. I will have a look in the next few days.

@brianmcgee brianmcgee self-assigned this Nov 4, 2024
@brianmcgee brianmcgee transferred this issue from nix-community/nixos-facter Jan 8, 2025
@brianmcgee
Copy link
Collaborator

@pimvh, it's been longer than I expected, but I can finally look at this.

Please re-run with the latest and greatest, and let me know if the kernel modules are still missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants