!oNSIfazDqEcwhcOjSL:matrix.org

disko

355 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko89 Servers

Load older messages


SenderMessageTime
28 Apr 2024
@waterturkey:matrix.orgwaterturkey set a profile picture.13:19:38
@vartroc:matrix.org@vartroc:matrix.org* That solved it, thanks a lot13:26:13
@adzuki:matrix.orgadzuki joined the room.15:07:43
@adzuki:matrix.orgadzuki

I'm having problems getting disko and impermanence to work after moving some functionality into separate modules. Here is the output of nixos-rebuild boot --flake /persist/nixos#amstrad:

trace: warning: The legacy table is outdated and should not be used. We recommend using the gpt type instead.
Please note that certain features, such as the test framework, may not function properly with the legacy table type.
If you encounter errors similar to:
"error: The option `disko.devices.disk.disk1.content.partitions."[definition 1-entry 1]".content._config` is read-only, but it's set multiple times,"
this is likely due to the use of the legacy table type.

trace: the create output is deprecated, use format instead
trace: warning: The legacy table is outdated and should not be used. We recommend using the gpt type instead.
Please note that certain features, such as the test framework, may not function properly with the legacy table type.
If you encounter errors similar to:
"error: The option `disko.devices.disk.disk1.content.partitions."[definition 1-entry 1]".content._config` is read-only, but it's set multiple times,"
this is likely due to the use of the legacy table type.

trace: warning: The legacy table is outdated and should not be used. We recommend using the gpt type instead.
Please note that certain features, such as the test framework, may not function properly with the legacy table type.
If you encounter errors similar to:
"error: The option `disko.devices.disk.disk1.content.partitions."[definition 1-entry 1]".content._config` is read-only, but it's set multiple times,"
this is likely due to the use of the legacy table type.

error:
       … while calling the 'seq' builtin

         at /nix/store/370qy3d3wg9zhbn5a3dcv6k1q1iigfh4-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while calling the 'throw' builtin

         at /nix/store/370qy3d3wg9zhbn5a3dcv6k1q1iigfh4-source/lib/modules.nix:298:18:

          297|                     ''
          298|             else throw baseMsg
             |                  ^
          299|         else null;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attribute 'currentSystem' missing

       at /nix/store/370qy3d3wg9zhbn5a3dcv6k1q1iigfh4-source/pkgs/top-level/impure.nix:17:43:

           16|   # (build, in GNU Autotools parlance) platform.
           17|   localSystem ? { system = args.system or builtins.currentSystem; }
             |                                           ^
           18|

This is my disko.nix (located at modules/nixos/system/disko.nix in the nixos config directory:

{
  device ? throw "Set this to your disk device, e.g. /dev/sda",
  ...
}: {
  disko.devices = {
    disk.main = {
      inherit device;
      type = "disk";
      content = {
        type = "gpt";
        partitions = {
          boot = {
            name = "boot";
            size = "1M";
            type = "EF02";
          };
          esp = {
            name = "ESP";
            size = "500M";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
            };
          };
          swap = {
            size = "4G";
            content = {
              type = "swap";
              resumeDevice = true;
            };
          };
          root = {
            name = "root";
            size = "100%";
            content = {
              type = "lvm_pv";
              vg = "root_vg";
            };
          };
        };
      };
    };
    lvm_vg = {
      root_vg = {
        type = "lvm_vg";
        lvs = {
          root = {
            size = "100%FREE";
            content = {
              type = "btrfs";
              extraArgs = ["-f"];

              subvolumes = {
                "/root" = {
                  mountpoint = "/";
                };

                "/persist" = {
                  mountOptions = ["subvol=persist" "noatime"];
                  mountpoint = "/persist";
                };

                "/nix" = {
                  mountOptions = ["subvol=nix" "noatime"];
                  mountpoint = "/nix";
                };
              };
            };
          };
        };
      };
    };
  };
}

And this is the flake.nix used for building:

{
  description = "Nixos config flake";
     
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    impermanence = {
      url = "github:nix-community/impermanence";
    };

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {nixpkgs, ...} @ inputs:
  {
    homeManagerModules.default = ./modules/home-manager;
    nixosConfigurations = {
      amstrad = nixpkgs.lib.nixosSystem {
        specialArgs = { inherit inputs; };
        modules = [
          inputs.disko.nixosModules.default
          (import ./modules/nixos/system/disko.nix { device = "/dev/sda"; })

          ./hosts/amstrad/configuration.nix
	 ./modules/nixos
              
          inputs.impermanence.nixosModules.impermanence
          inputs.home-manager.nixosModules.default
        ];
      };
    };
  };
}

Any help would be greatly appreciated, I'm really stumped by this as it was working before I tried to use impermanence as a module.

15:17:48
29 Apr 2024
@perchun:matrix.orgPerchun Pak joined the room.11:46:45
@perchun:matrix.orgPerchun Pakjust a quick probably stupid question, will disko ignore these 2mb of unallocated space? gparted doesn't want to include them into first partition, the only way would be to move 600gb partition two times (second time on 2mb back)11:49:56
@perchun:matrix.orgPerchun Pakimage.png
Download image.png
11:49:58
@lassulus:lassul.uslassulusNot sure what you mean by ignore. If they are there and you use the format script disko generates it will be gone. If you use disko just to configure your filesystem it has no effect if not specified11:56:43
@perchun:matrix.orgPerchun Pak

I mean in this example, will disko try to overwrite 2mb of free space with partition with random_windows_partition_1, or it will skip it?

partitions = {                                                                                              
  esp = { ... };
  # 2mb of free space
  random_windows_partition_1 = { };                                                                          
  windows_main_partition = { };                                                                             
  # etc...
};

and for context, yes I am again trying to partially format my disk using script without backups

12:01:51
@lassulus:lassul.uslassulusWell you can create a partition without content. So that it alligns correctly. But you can also leave some space by using start12:06:58
@lassulus:lassul.uslassulusI guess start would be the right thing to do here12:07:24
@lassulus:lassul.uslassulusSince an empty partition is a bit different than no partition12:07:45
@perchun:matrix.orgPerchun Paki just realized this will break my windows partition because it (windows) doesn't like when you move its partitions12:09:27
@perchun:matrix.orgPerchun Pakso i will just hard format my drive probably12:09:39
@perchun:matrix.orgPerchun Pak

i accidentally nuked my entire drive and now trying to add space for windows before Linux. is this a bug?

esp = { ... };
swap = {
  start = "500G";
  # ...
};
luks = {
  size = "100%";
  # ...
};
13:03:20
@perchun:matrix.orgPerchun Pakimage.png
Download image.png
13:03:22
@perchun:matrix.orgPerchun Pak(swap partition is after the luks partition)13:03:34
@matthewcroughan:defenestrate.itmatthewcroughan changed their profile picture.13:04:12
@perchun:matrix.orgPerchun Pak

if I add start = "500G"; to luks, it fails with

+ sgdisk --align-end --new=3:500G:-0 --change-name=3:disk-main-luks --typecode=3:8300 /dev/nvme0n1
Could not create partition 3 from 1048576000 to 1048575999
Unable to set partition 3's name to 'disk-main-luks'!
Could not change partition 3's type code to 8300!
Error encountered; not saving changes.
+ sgdisk --change-name=3:disk-main-luks --typecode=3:8300 /dev/nvme0n1
Unable to set partition 3's name to 'disk-main-luks'!
Could not change partition 3's type code to 8300!
Error encountered; not saving changes.
+ rm -rf /tmp/tmp.STzH236qNq

[nixos@nixos:~/nixos-dotfiles]$ 

(same error if I set 520gb instead of 500 in luks partition)

13:09:23
@lassulus:lassul.uslassulusHmm interesting. But not sure why it can't set those things13:11:12
@lassulus:lassul.uslassuluswhat does fdisk -l show on the device?13:11:39
@perchun:matrix.orgPerchun Pak
$ sudo fdisk -l
Disk /dev/loop0: 2.32 GiB, 2491564032 bytes, 4866336 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: WDC PC SN530 SDBPNPZ-1T00-1114          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 49C5265D-9693-4B24-8167-2CC85DF82C4B

Device              Start        End  Sectors  Size Type
/dev/nvme0n1p1       2048    1026047  1024000  500M EFI System
/dev/nvme0n1p2 1048576000 1090519039 41943040   20G Linux filesystem


Disk /dev/sda: 28.91 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB DISK 3.0    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9fb6382f

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *          0  4989023  4989024  2.4G  0 Empty
/dev/sda2         17780    23923     6144    3M ef EFI (FAT-12/16/32)
/dev/sda3       4997120 60628991 55631872 26.5G 83 Linux
13:12:10
@perchun:matrix.orgPerchun Pakor you mean when it places swap after luks?13:12:38
@perchun:matrix.orgPerchun Pak
Disk /dev/loop0: 2.32 GiB, 2491564032 bytes, 4866336 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: WDC PC SN530 SDBPNPZ-1T00-1114          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BE5D969-68F3-4616-89B4-4942C37C2E9F

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048    1026047    1024000   500M EFI System
/dev/nvme0n1p2 1048576000 1090519039   41943040    20G Linux filesystem
/dev/nvme0n1p3    1026048 1048575999 1047549952 499.5G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/sda: 28.91 GiB, 31042043904 bytes, 60628992 sectors
Disk model: USB DISK 3.0    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9fb6382f

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *          0  4989023  4989024  2.4G  0 Empty
/dev/sda2         17780    23923     6144    3M ef EFI (FAT-12/16/32)
/dev/sda3       4997120 60628991 55631872 26.5G 83 Linux


Disk /dev/mapper/encrypted: 499.5 GiB, 536328798208 bytes, 1047517184 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/root_vg-root: 499.49 GiB, 536325652480 bytes, 1047511040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
13:49:44
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:28:20
@common0r:matrix.orgcomm0n(they/them) changed their display name from common to comm0n.19:51:46
@mfed3:matrix.orgmfed3 joined the room.23:47:57
30 Apr 2024
@xondtx:matrix.orgondt joined the room.22:24:22
1 May 2024
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.15:05:56
3 May 2024
@hxr404:tchncs.dehxr404 ✨ [it/she] changed their display name from hxr404 ✨ [they/them] to hxr404 ✨ [it/she].10:18:23

Show newer messages


Back to Room ListRoom Version: 10