Wifi works but ethernet does not

I just installed NixOS today.

During installation, the ethernet did not work but the wifi did.

Now that it installed, the ethernet continues to not work but the wifi remains functional.

through nmtui, I get the error “Activation failed: IP configuration could not be reserved”

Some research I’ve done suggested that I could have a competing network manager or dhcp client causing the issue. As far as I can tell, dhcpcd is not even installed and systemd-networkd is not running.

I have a functional install of CachyOS that is also using Network Manager and the ethernet runs fine. I have compared the Network Manager settings, for the ethernet connection, between cachy and nix and they appear to be the same.

Not sure what I can do at this point but any help would be appreciated.

If you have administrative access to your router you could check the state of the DHCP pool; once or twice with MAC address randomisation I have observed pool exhaustion. This is unlikely though.

Also, please show the output of the command nmcli device show.

I would also run the command journalctl -b -u NetworkManager to see if it reveals any more details as to the nature of the failure.

Also share your configuration.nix, if you say you may have competing network daemons that’d be visible in there.

Here is my config, this from a fresh install. The only changes I made were to switch from LXQT to plasma

# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Use the systemd-boot EFI boot loader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "America/Indiana/Indianapolis";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the Desktop Environment.
  services.desktopManager.plasma6.enable = true;

  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  services.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    # jack.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users."fero" = {
    isNormalUser = true;
    description = "fero";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  thunderbird
    ];
  };

  # Install firefox.
  programs.firefox.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile.
  # You can use https://search.nixos.org/ to find more packages (and options).
  # environment.systemPackages = with pkgs; [
  #   vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  #   wget
  # ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # Copy the NixOS configuration file and link it from the resulting system
  # (/run/current-system/configuration.nix). This is useful in case you
  # accidentally delete configuration.nix.
  # system.copySystemConfiguration = true;

  # This option defines the first version of NixOS you have installed on this particular machine,
  # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
  #
  # Most users should NEVER change this value after the initial install, for any reason,
  # even if you've upgraded your system to a new NixOS release.
  #
  # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
  # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
  # to actually do that.
  #
  # This value being lower than the current NixOS release does NOT mean your system is
  # out of date, out of support, or vulnerable.
  #
  # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
  # and migrated your data accordingly.
  #
  # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
  system.stateVersion = "26.05"; # Did you read the comment?

}

what part of the “nmcli device show” result would you like me to post? I don’t know a lot about networking but I know it’s generally not best practice to share my IP online and it is ALL over that result. I understand that this caution may be counterintuitive but I would prefer to only post a portion if at all possible.

journalctl -b -u NetworkManager result:

Sep 23 22:20:09 nixos systemd[1]: Starting Network Manager...
Sep 23 22:20:09 nixos systemd[1]: Started Network Manager.
Sep 23 22:20:09 nixos NetworkManager[1045]: <warn>  [1790216409.8104] device (p2p-dev-wlp7s0): error setting IPv4 forwarding to '0': Resource temporarily unavailable
Sep 23 22:20:57 nixos NetworkManager[1045]: <warn>  [1790216457.7112] device (enp8s0): Activation: failed for connection 'Ethernet connection 1'
Sep 23 22:21:42 nixos NetworkManager[1045]: <warn>  [1790216502.7118] device (enp8s0): Activation: failed for connection 'Ethernet connection 1'
Sep 23 22:22:27 nixos NetworkManager[1045]: <warn>  [1790216547.7096] device (enp8s0): Activation: failed for connection 'Ethernet connection 1'

For device enp8s0, what is GENERAL.STATE and WIRED-PROPERTIES.CARRIER, do you have any assignment for IPV4.{ADDRESS, ROUTE, GATEWAY, DNS}?

This is true and you should redact any personally identifiable information that you do not wish to share.

Err… ish. That’s kind of sensible advice, but in context bordering on bullshit. All IP addresses in nmcli device show will be link-local, and literally useless to anyone not on your LAN (and people on your LAN can just listen for ARP broadcasts to get the same information).

Caveat maybe if you have valid IPv6 addresses, but that’s both quite rate and networkmanager generates new ones on boot by default anyway for privacy reasons, so those are also mostly useless.

Unless you’re working on a router or have your laptop plugged straight into a modem, you don’t have to worry about this.

So, yeah, not sharing that could be sensible advice if you lived in the year 1980, and just bought your first internet connection with a freshly minted IPv4 address. In the modern world it’s almost certainly rooted in misunderstanding networking, though.


That said, if you are really unsure that you’re not on some super weird connection, you can check this wikipedia page - it has a list of all special address ranges with information about them - anything that says “local”, “private” and such is always safe to share. Refer to the descriptions for other contexts (if you, say, somehow got something from the military-reserved IP address range, maybe don’t share your IP address).

Take as an example my eno1, all of these addresses are in the 192.168.0.0/16 block, and hence only accessible on my LAN. The fe80:: IPv6 address is the link-local address, and also not accessible elsewhere. Depending on what block your router chooses, and how its dhcpd assigns addresses, you in fact might have the same exact IP addresses on your device:

GENERAL.DEVICE:                         eno1
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         18:C0:4D:39:64:87
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     ethernet
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/5
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS[1]:                         192.168.8.193/24
IP4.GATEWAY:                            192.168.8.1
IP4.ROUTE[1]:                           dst = 192.168.8.0/24, nh = 0.0.0.0, mt = 100
IP4.ROUTE[2]:                           dst = 0.0.0.0/0, nh = 192.168.8.1, mt = 100
IP4.DNS[1]:                             192.168.8.1
IP4.DOMAIN[1]:                          ts.net
IP4.DOMAIN[2]:                          lan
IP6.ADDRESS[1]:                         fe80::bd95:d202:3bc0:9b25/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 1024
IP6.DNS[1]:                             fe80::9683:c4ff:febd:813c

The only arguably problematic address is the HWADDR, because that can uniquely identify your network chip, but it cannot easily be used for anything since it’s not exposed on the IP layer. The worst we can do is link a specific purchase to you if we worked for the manufacturer of your chip, or tell you which chip it is.

I initially was going to reply and discuss RFC 1918 private addresses and IPv6 link-local and ULA addresses. But I decided not to because I do have a globally routable IPv6 address in my nmcli device show because of IPv6 prefix delegation. So from that point of view a public address is shown, albeit it is not of much use.

Doing this quickly while on lunch so I just redacted any addresses until I have time to research it.

Result while attempting connection:

GENERAL.DEVICE:                         enp8s0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         [Redacted]
GENERAL.MTU:                            1500
GENERAL.STATE:                          70 (connecting (getting IP configuration))
GENERAL.CONNECTION:                     Ethernet connection 1
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/10
WIRED-PROPERTIES.CARRIER:               on
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         [Redacted]
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 1024

Result after connection failed:


GENERAL.DEVICE:                         enp8s0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         [Redacted]
GENERAL.MTU:                            1500
GENERAL.STATE:                          30 (disconnected)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               on
IP4.GATEWAY:                            --
IP6.GATEWAY:                            --

Considering no one commented on my config file, I’m going to assume that everything looks fine on that end?

I appreciate all the help!

This means your device is waiting for DHCP. That’s probably the router’s fault, but might also be the kernel or faulty hardware.

You can get broad logs with sudo journalctl -f and then replugging the cable, might give you a hint.

Yep!

To see more details about the DHCP exchange you can add networking.networkManager.logLevel = “DEBUG” to your configuration.nix and then rebuild your system. This will provide more verbose logs as the default is "WARN”. Then attempt to activate your Ethernet connection using nmtui or nmcli. Then run journalctl -b | grep “dhcp[4/6] (enp8s0)” to view the logs.

The 45-seconds between each failure is indicative of timeout implying that you are not getting a response.

Thanks for all the help!

The router was simply not responding to the DHCP calls. Restarted my router and the issue appears to have gone away. I don’t know enough about networking to understand why it was working on my CachyOS installation and not the NixOS installation. Haven’t booted to Cachy yet to see if the issue moved over there but the plan is to replace Cachy anyway once I get a better understanding of Nix.

I will definitely start with a router reset anytime I have internet issues going forward, would have started there but it working on one distro and not the other had me confused :stuck_out_tongue: