Skip to content

boot.initrd.network.postCommands should be executed when boot.initrd.networking is enabled #71447

@mweinelt

Description

@mweinelt

Describe the bug
The boot.initrd.network.postCommands are only executed when the initrd cmdline includes an ip= config line, which is most commonly used for NFS root setups.

The documentation for the option explains no such limitation:

Shell commands to be executed after stage 1 of the boot has initialised the network.

IMO the postCommands should be executed as soon as boot.initrd.networking.enabled is true.

To Reproduce
Steps to reproduce the behavior:

{
  boot.initrd = {
    kernelModules = [ "ipv6" ];
    network = {
      enable = true;
      postCommands = ''
        ip link set up dev eth0
        ip addr add 2001:db8::1/64 dev eth0
        ip route add default via fe80::1 dev eth0
      '';
    };
  };
}

=> Network will not be configured.

Expected behavior
The commands in boot.initrd.networking.postCommands will be executed and network will be set up.

Metadata

$ niv show nixpkgs
Showing package nixpkgs
Reading sources file
  homepage: https://github.com/NixOS/nixpkgs
  url: https://github.com/NixOS/nixpkgs-channels/archive/8bf142e001b6876b021c8ee90c2c7cec385fe8e9.tar.gz
  owner: NixOS
  branch: nixos-19.09
  url_template: https://github.com/<owner>/<repo>/archive/<rev>.tar.gz
  repo: nixpkgs-channels
  type: tarball
  sha256: 1z8id8ix24ds9i7cm8g33v54j7xbhcpwzw50wlq00alj00xrq307
  description: A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to
  rev: 8bf142e001b6876b021c8ee90c2c7cec385fe8e9

Maintainer information:

none given

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions