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

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

Closed
mweinelt opened this issue Oct 20, 2019 · 3 comments

Comments

@mweinelt
Copy link
Member

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

@fpletz fpletz added this to the 20.03 milestone Feb 8, 2020
fpletz added a commit that referenced this issue Feb 8, 2020
As outlined in #71447, postCommands should always be run if networking
in initrd is enabled. regardless if the configuration actually
succeeded.
fpletz added a commit that referenced this issue Feb 8, 2020
As outlined in #71447, postCommands should always be run if networking
in initrd is enabled. regardless if the configuration actually
succeeded.

(cherry picked from commit 5897899)
Ma27 pushed a commit to Ma27/nixpkgs that referenced this issue Mar 4, 2020
As outlined in NixOS#71447, postCommands should always be run if networking
in initrd is enabled. regardless if the configuration actually
succeeded.

(cherry picked from commit 5897899)

The backport of this patch has been requested in NixOS#79532[1]. The diff is
slightly off the original commit since some changes from
ea7d024 were needed, however this
commit shouldn't be backported as it potentially breaks existing setups.

[1] NixOS#79532 (comment)
@flokli
Copy link
Contributor

flokli commented Apr 3, 2020

@mweinelt has this been fixed by #81744?

@flokli
Copy link
Contributor

flokli commented Apr 3, 2020

I think it has. Please complain if I'm wrong ;-)

@flokli flokli closed this as completed Apr 3, 2020
@mweinelt
Copy link
Member Author

mweinelt commented Apr 5, 2020

Yep, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants