Skip to content

hostname --fqdn broken when enableIPv6 = false #196934

Description

@thomask77

Describe the bug

In NixOS 22.05, the domain name is not set correctly when networking.enableIPv6 is set to false.

Steps To Reproduce

  1. It's working with IPv6:
{
  networking.hostName = "foo";
  networking.domain = "bar.baz";
  networking.enableIPv6 = true;
}
$ hostname --fqdn
foo.bar.baz
  1. .. but broken without:
{
  networking.hostName = "foo";
  networking.domain = "bar.baz";
  networking.enableIPv6 = false;
}
$ hostname --fqdn
foo

Expected behavior

Obviously, it should work in both cases.

Additional context

The issue seems to be related to nscd:
systemctl stop nscd also fixes the problem.

Similar issues seem to have been discussed in #1248, #10183 and #87633, but it's still broken.

Metadata

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

 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.74, NixOS, 22.05 (Quokka), 22.05.3702.c5203abb132`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.8.1`
 - channels(root): `"nixos-22.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

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

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions