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

random failures during script "cannot open /dev/disk/by-partlabel/disk-sda-boot" #739

Open
ghostbuster91 opened this issue Aug 19, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ghostbuster91
Copy link

ghostbuster91 commented Aug 19, 2024

Following disko script:

{ disks ? [ "/dev/sda" ], ... }: {
  disko.devices = {
    disk = {
      sda = {
        type = "disk";
        device = builtins.elemAt disks 0;
        content = {
          type = "gpt";
          partitions = {
            grub = {
              size = "1M";
              type = "EF02";
              priority = 1;
            };
            boot = {
              size = "512M";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot";
              };
              priority = 2;
              hybrid.mbrBootableFlag = true;
            };
            root = {
              size = "128G";
              content = {
                type = "zfs";
                pool = "rpool1";
              };
              priority = 4;
            };
          };
        };
      };
    };
    zpool = {
      rpool1 =
        let
          unmountable = { type = "zfs_fs"; };
          filesystem = mountpoint: {
            type = "zfs_fs";
            options = {
              canmount = "noauto";
              inherit mountpoint;
            };
            inherit mountpoint;
          };
        in
        {
          type = "zpool";

          rootFsOptions = {
            compression = "lz4";
            "com.sun:auto-snapshot" = "false";
            canmount = "off";
            xattr = "sa";
            atime = "off";
          };
          options = {
            ashift = "12";
            autotrim = "on";
            compatibility = "grub2";
          };
          datasets = {
            "local" = unmountable;
            "local/root" = filesystem "/" // {
              postCreateHook = "zfs snapshot rpool1/local/root@blank";
            };
            "local/nix" = filesystem "/nix";
            "local/state" = filesystem "/state";

            "safe" = unmountable;
            "safe/persist" = filesystem "/persist";
          };
        };
    };
  };
}

sometimes (but very often) fails with mkfs.vfat cannot open /dev/disk/by-partlabel/disk-sda-boot (or other similar error). This happens when the disko format script refers to a disk by by-partlabel lookup (so also when calling zpool create or mkswap etc). What is weird is that these entries exist (verified by manually inspecting these directories with ls)

Manually calling the failed command and restarting disko script eventually passes.

This only happens on a real machine never on virtual one. Originally reported in #735

@Lassulus
Copy link
Collaborator

maybe some timing issues, can you post the scripts output on such a failed attempt? maybe sleeping a bit before the mkfs.vat could help. you can try adding a preCreateHook = "sleep 3"; next to the type = "filesystem";

@ghostbuster91
Copy link
Author

maybe some timing issues

I think so too.

can try adding a preCreateHook = "sleep 3"; next to the type = "filesystem";

This looks very promising, thanks :)

can you post the scripts output on such a failed attempt?

I will reproduce the issue as I need to test the preCreateHook suggestion anyway and then I will post the whole output.

@iFreilicht iFreilicht added bug Something isn't working help wanted Extra attention is needed labels Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants