Skip to content

nixos/systemd: disable systemd-gpt-auto-generator by default#146497

Closed
Artturin wants to merge 1 commit intoNixOS:masterfrom
Artturin:systemd-gpt-autogen-disable
Closed

nixos/systemd: disable systemd-gpt-auto-generator by default#146497
Artturin wants to merge 1 commit intoNixOS:masterfrom
Artturin:systemd-gpt-autogen-disable

Conversation

@Artturin
Copy link
Member

@Artturin Artturin commented Nov 18, 2021

it is not declarative and breaks our declarative configuration sometimes

See: #4002

Motivation for this change

Closes #4002

Things done

tested in a vm

{
  inputs = {
    #nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs.url = "/home/artturin/nixgits/my-nixpkgs";
  };

  outputs = inputs@{ self, nixpkgs }: {

    nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; };
      modules = [
        ({ pkgs, lib, config, ... }: {
          # try without the comment and with
          #systemd.generators = { systemd-gpt-auto-generator = "${config.systemd.package}/lib/systemd/system-generators/systemd-gpt-auto-generator"; };
        })

        ({ pkgs, lib, config, modulesPath, ... }: {
          documentation.enable = false;
          users.mutableUsers = false;
          users.users.root = {
            password = "root";
          };
          users.users.user = {
            password = "user";
            isNormalUser = true;
            extraGroups = [ "wheel" ];
          };

          imports = [
            #(modulesPath + "/profiles/minimal.nix")
          ];
        })
      ];
    };
    # So that we can just run 'nix run' instead of
    # 'nix build ".#nixosConfigurations.vm.config.system.build.vm" && ./result/bin/run-nixos-vm'
    defaultPackage.x86_64-linux = self.nixosConfigurations.vm.config.system.build.vm;
    defaultApp.x86_64-linux = {
      type = "app";
      program = "${self.defaultPackage.x86_64-linux}/bin/run-nixos-vm";
    };
  };
}

tested on my system

  disabledModules = [ "system/boot/systemd.nix" ];
  
  imports = let
    pkgsReview = builtins.fetchTarball {
      url = "https://github.com/artturin/nixpkgs/archive/systemd-gpt-autogen-disable.tar.gz";
    };
  in [
    (import "${pkgsReview}/nixos/modules/system/boot/systemd.nix")
  ];
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@Artturin Artturin requested a review from dasJ as a code owner November 18, 2021 16:30
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Nov 18, 2021
@Artturin Artturin force-pushed the systemd-gpt-autogen-disable branch from 53204ca to 0fa4513 Compare November 18, 2021 16:37
@Artturin Artturin requested review from nh2 and vcunat November 18, 2021 16:52
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Nov 18, 2021
@Artturin Artturin force-pushed the systemd-gpt-autogen-disable branch from 0fa4513 to c207bad Compare November 18, 2021 17:02
@github-actions github-actions bot added 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation labels Nov 18, 2021
@dasJ
Copy link
Member

dasJ commented Nov 18, 2021

Umm why not expose an option to opt into this very useful feature? Also I'm not really a fan of doing this a week before branchoff

@Artturin
Copy link
Member Author

Artturin commented Nov 18, 2021

it can be reenabled with (i put it in the example value)

systemd.generators = { systemd-gpt-auto-generator = "${config.systemd.package}/lib/systemd/system-generators/systemd-gpt-auto-generator"; };

lets wait at least until branchoff before merging

@SuperSandro2000 SuperSandro2000 added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 30, 2021
@Artturin Artturin marked this pull request as draft December 2, 2021 14:00
@Artturin
Copy link
Member Author

@dasJ do you or anyone you know use this feature? I think there's most likely no one using this on nixos since it's undeclarative and breaks declarative mounting sometimes

@Artturin Artturin force-pushed the systemd-gpt-autogen-disable branch from c207bad to 2df4dc5 Compare December 24, 2021 14:44
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 24, 2021
@Artturin Artturin force-pushed the systemd-gpt-autogen-disable branch from 2df4dc5 to 9fb9ed1 Compare December 24, 2021 14:52
@Artturin Artturin marked this pull request as ready for review December 24, 2021 14:53
@dasJ
Copy link
Member

dasJ commented Dec 25, 2021

Just self merge it again, idc really

@Artturin
Copy link
Member Author

setting root= cmdline var disables the root logic
https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html#root=
https://github.com/systemd/systemd/blob/master/src/gpt-auto-generator/gpt-auto-generator.c#L822

however that will interact with https://www.freedesktop.org/software/systemd/man/systemd-fstab-generator.html#root=
if the fstab generator is enabled, i also do not know what the root= should be for zfs volumes

so i'd rather disable this for now at least until we use systemd for init

pinging @ElvishJerricco to make him aware of this pr due to #120015

@NickCao NickCao mentioned this pull request Jan 9, 2022
11 tasks
@Artturin Artturin marked this pull request as draft April 24, 2022 21:26
@Artturin Artturin closed this Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nixos tries to start/stop "-.mount" target

3 participants