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

140edd2 breaks btrfs subvolumes needed for boot on my machine #310

Closed
GenericNerdyUsername opened this issue Aug 1, 2023 · 6 comments
Closed

Comments

@GenericNerdyUsername
Copy link

/etc/nixos#nixosConfigurations.nixos.config.fileSystems before and after the commit.

My disk-config.nix:

{ ... }:
{
  disko.devices = {

    disk = {
      nvme = {
        type = "disk";
        device = "/dev/disk/by-id/nvme-WDS250G3X0C-00SJG0_191334805406";
        content = {
          type = "table";
          format = "gpt";
          partitions = [
            {
              name = "ESP";
              start = "1MiB";
              end = "256MiB";
              fs-type = "fat32";
              bootable = true;
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot/efi";
              };
            }
            {
              name = "root";
              start = "256MiB";
              end = "100%";
              content = {
                type = "luks";
                name = "crypted";
                extraFormatArgs = [ "--pbkdf argon2id" ];
                extraOpenArgs = [ "--allow-discards" ];
                content = {
                  type = "lvm_pv";
                  vg = "pool";
                };
              };
            }
          ];
        };
      };
    };

    lvm_vg.pool = {
      type = "lvm_vg";
      lvs = {
        root = {
          size = "210GiB";
          content = {
            type = "btrfs";
            subvolumes = {
              "/rootfs".mountpoint = "/";
              "/home".mountOptions = [ "compress=zstd" ];
              "/nix".mountOptions = [ "compress=zstd" "noatime" "noacl" ];
            };
          };
        };
        swap = {
          size = "20GiB";
          content = {
            type = "swap";
          };
        };
      };
    };

  };
}

I'm pretty sure the problem is that disko.devices.lvm_vg.pool.lvs.root.content.subvolumes.rootfs has a mountpoint and the others don't, but I feel at least an eval warning is needed here if there's a breaking change.

@Lassulus
Copy link
Collaborator

Lassulus commented Aug 1, 2023

ah, it was hard to find out in which cases we should emit a warning, sorry for that. generally people are encouraged to check the upgrade-guide

@Mic92
Copy link
Member

Mic92 commented Aug 2, 2023

I wonder if we should make some sort of releases so that people can actually read the upgraded guides before upgrading.

@eliandoran
Copy link

@GenericNerdyUsername , thanks for the bug report. I've just had the same issue today so it helped me find the solution quickly.

@Mic92 , I think it's a great idea. I've been using disko on all my devices for a few months now and I was completely unaware of the upgrade guide.

On my side I have an upgrade.sh script which just does a nix flake update, so disko is automatically updated each time I update my system as well so I was in for a bit of a surprise.

If there are breaking changes, such as this one, it would be really nice to enforce the user to make a conscious choice if they want to update. Releases sounds like a good way to do it.

In this particular case, I would say that this might have been avoided by making auto-mount opt-out instead of opt-in (e.g. subvolumes.foo.autoMount = false) for the subvolumes that the user does not want to mount. Especially since I believe that users most likely want to mount their drives.

@lilyinstarlight
Copy link
Member

lilyinstarlight commented Aug 7, 2023

In this particular case, I would say that this might have been avoided by making auto-mount opt-out instead of opt-in (e.g. subvolumes.foo.autoMount = false) for the subvolumes that the user does not want to mount. Especially since I believe that users most likely want to mount their drives.

I was the one who originally added subvol mounts and made it happen by default, but it's different behavior from all of the other types and it's not explicit what is being mounted and what isn't. I've since regretted that decision and endorsed the breaking change (might as well rip the bandage off now rather than later when even more people use disko)

We definitely should do more to communicate to users when breaking changes occur, though (e.g. semver, warnings, etc)

@nrabulinski
Copy link

I just got bit by it and it really scared me. The warning did not show up until I manually loaded the configuration in the nix repl and inspected all the disko options after finally figuring out that my nix store was missing from config.fileSystems.
I'm not sure when/how you emit the warning but deploy-rs happily deployed the config for me without showing any warnings. It may be deploy-rs' fault for not propagating the warning but IMO such breaking changes should actually break the build and not silently fail.

I'd like something either akin to stateVersion or just breaking changes actually failing and not emitting a warning.

@iFreilicht
Copy link
Contributor

As this issue is over a year old, it's unlikely that anyone will hit this again, and as I understand we can't really fix it either, as that would also be a breaking change.

However, I think your suggestions regarding handling breaking changes are very valid, so I opened #833 for this. Let's continue the discussion there :)

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

7 participants