Nixpkgs: switch to specialisation does not work

Created on 12 Jul 2020  Â·  10Comments  Â·  Source: NixOS/nixpkgs

Describe the bug
I created a specialisation, which should run with nouveau instead of nvidia. When I switch to the specialisation, nothing happens. If I run /run/current-system/specialisation/nouveau/bin/switch-to-configuration boot and reboot, the changes do not seem to be in effect, as nvidia drivers are loaded nouveau is not.

To Reproduce
Steps to reproduce the behavior:

  1. /run/current-system/specialisation/nouveau/bin/switch-to-configuration boot
  2. reboot
  3. lsmod | grep nvidia

Expected behavior
The system boots with nouveau instead of nvidia drivers.

Additional context

  specialisation.nouveau = { 
    inheritParentConfig = true; 
    configuration = { 
        boot.blacklistedKernelModules = [ 
          # disable nvidia
          "rivafb"
          "nvidiafb"
          "rivatv"
          "nv"
          "nvidia"
          "nvidia-drm"
          "nvidia_drm"
          "nvidia-modeset"
          "nvidia_modeset"
          "nvidia-uvm"
          "nvidia_uvm"
          "i2c_nvidia_gpu"
          "ipmi_msghandler"
          "ipmi_devintf"
        ];
      # non nvidia configuration
      services.xserver.videoDrivers = [ "modeset" "nouveau" ];
      hardware.nvidia = { 
        modesetting = false;
        #nvidiaPersistenced.enable = false;
      };  
    };  
  };  

Notify maintainers

@grahamc
@adisbladis

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  • system: "x86_64-linux"
  • host os: Linux 5.6.18, NixOS, 20.09pre230335.9480bae3370 (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.6
  • channels(root): "nixos-20.09pre230335.9480bae3370"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: specialisation

bug nixos

Most helpful comment

I can confirm, that it works with the GRUB bootloader, just switched to GRUB for this.

For systemd-boot this functionality currently isn't implemented. The file systemd-boot-builder.py only searches for system profiles and their generations.

Is there some documentation about changing / testing NixOS build files? I would like to contribute here, but I have no clue how I can build a vm / system from local sources.

All 10 comments

Also, if I try to change nvidiaPersistenced.enable = false; in the specialisation, I get the following error:

error: The option value `hardware.nvidia.nvidiaPersistenced' in `<unknown-file>' is not of type `boolean'.
(use '--show-trace' to show detailed location information)

@veprbl Im not shure if this is really hardware related. The configuration does not work, which is not a hardware issue.

Hmm. Not sure if specializing should work through boots?

On Mon, Jul 13, 2020, at 4:41 AM, d4g wrote:

@veprbl https://github.com/veprbl Im not shure if this is really hardware related. The configuration does not work, which is not a hardware issue.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/NixOS/nixpkgs/issues/92999#issuecomment-657412429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASXLDVCVKYFSBUALXVH73R3LCCRANCNFSM4OXZFHCQ.

@grahamc please have a look at https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/system/activation/switch-to-configuration.pl

Usage: $0 [switch|boot|test]
switch:       make the configuration the boot default and activate now
boot:         make the configuration the boot default
test:         activate the configuration, but don\'t make it the boot default
dry-activate: show what would be done if this configuration were activated

So if this is not ment to work through boots, this would not make sense at all?

I mean, you activate a new configuration using this script and it says that this would activate the configuration on boot.

Also with the switch to specialisation instead of nested clones, I expected that this would include functionality of #45345 and #23458 which implemented, that you could choose the according configuration at boot time.

Could it be that #81848 has breaking side effects which were undetected before?

Also, there seems to be no documentation regarding this feature, except for inline. Are there any known limitations? For example:

  • I probably can't create a specialisation that uses a different kernel, if I cannot boot to it.
  • How would modules be handled? Would they be unloaded and then the new ones loaded? What if the blacklist changes?

I am not sure, it is possible -- but unlikely. That switch-to-configuration output is the same script used for every nixos-rebuild switch, with or without specialisation. Maybe you could try rolling back to before #81848 and trying to have it affect your boot-time system, like you've tried? Do you use grub, and if you use grub, does your additional specialisations appear in your bootloader?

I am actually using systemd boot. But I expected that this feature would be independent of the used bootloader.

Nevertheless, is there a way to use this feature to unload/load specific drivers at all? Or what are the limitations of this? What if I need a specific kernel as a specialisation for example?

Any updates on this? I seem to be facing the same problem, where I'm trying to use two different kernels through the specialisations, zen, and latest patched with one of Clear Linux's boot patches.

I can confirm, that it works with the GRUB bootloader, just switched to GRUB for this.

For systemd-boot this functionality currently isn't implemented. The file systemd-boot-builder.py only searches for system profiles and their generations.

Is there some documentation about changing / testing NixOS build files? I would like to contribute here, but I have no clue how I can build a vm / system from local sources.

Quick note: unless this is fixed for systemd-boot, users with a ZFS root, such as myself, cannot use specialisations, as grub has issues with a ZFS root that only Ubuntu seems to have fixed, as far as I know. And funtoo, I think...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Â·  3Comments

lverns picture lverns  Â·  3Comments

chris-martin picture chris-martin  Â·  3Comments

tomberek picture tomberek  Â·  3Comments

ayyess picture ayyess  Â·  3Comments