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

Can't change default networking.hostId value when usingzpool disko config #434

Closed
sbc64 opened this issue Oct 27, 2023 · 5 comments · Fixed by nix-community/nixos-anywhere#239

Comments

@sbc64
Copy link

sbc64 commented Oct 27, 2023

I don't know whether to make the issue in this repository or at https://github.com/nix-community/nixos-anywhere, even though I'm using nixos-anywhere it seems that the executing scripts recide in this repository.

Here is the disko config I'm trying to use:

# disc-config.nix
{
  lib,
  config,
  ...
}:{
  # This doesn't work
  networking.hostId = lib.mkForce "00022319"; 
  # This works
  # networking.hostId = lib.mkForce "8425e349";
  
  
  disko.devices = {
    disk.main = {
      device = lib.mkDefault "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_38446325";
      type = "disk";
      content = {
        type = "gpt";
        partitions = {
          boot = {
            name = "boot";
            size = "500M";
            type = "EF02";
          };
          esp = {
            name = "ESP";
            size = "1G";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
            };
          };
          zfs = {
            size = "100%";
            content = {
              type = "zfs";
              pool = "zroot";
            };
          };
        };
      };
    };
    zpool = {
      zroot = {
        type = "zpool";
        rootFsOptions = {
          compression = "zstd";
          "com.sun:auto-snapshot" = "false";
        };
        mountpoint = "/";
        postCreateHook = "zfs snapshot zroot@blank";
        datasets = {
          nextcloud = {
            type = "zfs_fs";
            mountpoint = "/nextcloud";
            options = {
              "com.sun:auto-snapshot" = "true";
              "userprop:access" = "nextcloud";
              mountpoint = "legacy";
            };
          };
        };
      };
    };
  };
}

If I use networking.hostId = "<something other than 8425e349>", I get greated with the following booting sequence:
Screenshot 2023-10-27 at 07 42 21

I have not been able to find out how disko sets the current 8425e349 hostId since all the results I see are in the test libraries: https://github.com/search?q=repo%3Anix-community%2Fdisko+8425e349&type=code

How can I set my own networking.hostId value, or do I have to change after the first boot sequence is done, if changing is at all possible?

@Mic92
Copy link
Member

Mic92 commented Oct 27, 2023

The hostid comes from here: https://github.com/nix-community/nixos-images/blob/87bccdbdfbeb07e0c4fb4c2ec3d71986e8fa24d9/nix/noninteractive.nix#L52
There can currently only be changed by rebuilding the installer image. We have some zpool export step that is supposed to solve this issue, but it seems to be not always be effective?

Mic92 added a commit to nix-community/nixos-anywhere that referenced this issue Oct 27, 2023
@Mic92
Copy link
Member

Mic92 commented Oct 27, 2023

Does this fix the issue? nix-community/nixos-anywhere#239

@Mic92
Copy link
Member

Mic92 commented Oct 27, 2023

Let's wait for feedback if this fixed the root cause.
It would be also good to know what the error output is in case it does not work.

@Mic92 Mic92 reopened this Oct 27, 2023
@phaer
Copy link
Member

phaer commented Oct 27, 2023

Ah thanks, I did not close this - Github did so automatically because of the PRs message. Its clever enough to interpret "fixes", but not clever enough to understand "potentially" :D

@sbc64
Copy link
Author

sbc64 commented Oct 27, 2023

nix-community/nixos-anywhere#239 solved the issue.

Thank you very much for your stupendus speed!

Edit:

I have the hostId I wanted now on my sytem:

[root@<domain>:~]# hostid
15fa0d9f

@sbc64 sbc64 closed this as completed Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants