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

vdev member lables dont match automaticlly hashed disk partiton label names #913

Open
jan-leila opened this issue Dec 11, 2024 · 3 comments

Comments

@jan-leila
Copy link

I have a configuration set up roughly like this:

{...}: {
    disko.devices.disk.ata-ST18000NE000-3G6101_ZVTCXVEB = {
          type = "disk";
          device = "/dev/disk/by-id/ata-ST18000NE000-3G6101_ZVTCXVEB";
          content = {
            type = "gpt";
            partitions = {
              zfs = {
                size = "100%";
                content = {
                  type = "zfs";
                  pool = "rpool";
                };
              };
            };
          };
        }
    };
    disko.devices.zpool.rpool = {
          type = "zpool";
          mode = {
            topology = {
              type = "topology";
              vdev = [
                  {
                     members = "ata-ST18000NE000-3G6101_ZVTCXVEB";
                  }
              ]
            };
          };
    }
}

When try to install with my configuration with nixos-anywhere the installer trys to check an make sure that all disks are accounted for with this as its query:

[[ /dev/disk/by-id/ata-ST18000NE000-3G6101_ZVTCXVEB != \/\d\e\v\/\d\i\s\k\/\b\y\-\p\a\r\t\l\a\b\e\l\/\2\c\7\1\e\4\4\d\9\8\2\c\f\8\1\5\b\3\1\e\6\e\c\0\4\d\7\a\7\5\b\f\6\f\9\b\]]

which results in the error: not all disks accounted for, skipping creating zpool rpool

which comes out false because the first half is trying to use the device names I defined where as the second half is trying to use the hashed label that was generated in gtp.nix::87

I'm struggling a bit to follow the code an where the issue is exactly and struggling even more on trying out changes on my local but I think it might be that the function formatOutput in zpool.nix::197 needs have the same check that gtp.nix uses when generating its labels if the label length is too long.

@Mic92
Copy link
Member

Mic92 commented Dec 11, 2024

I guess the workaround for now would be using a shorter disk name:

    disko.devices.disk.disk1 = {
    ...
        disko.devices.zpool.rpool = {
          type = "zpool";
          mode = {
            topology = {
              type = "topology";
              vdev = [
                  {
                     members = "disk1";
                  }
              ]
            };
          };
    }
    

@jan-leila
Copy link
Author

yep thats what I'm doing for now but it was a bit of a nightmare to try and figure out what wasn't working do I just wanted to document the issue somewhere

@guiniol
Copy link

guiniol commented Jan 3, 2025

I ran into the same issue:

  1. the name is too long and gets hashed here:
    builtins.substring 0 limit (builtins.hashString "sha256" label)
  2. but zpool doesn't know about this:
    (d: if lib.strings.hasPrefix "/" d then d else "/dev/disk/by-partlabel/disk-${d}-zfs") members

I think there should be a function to get the partlabel so code doesn't have to be duplicated and everything is computing it the same way.

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

No branches or pull requests

3 participants