!oNSIfazDqEcwhcOjSL:matrix.org

disko

171 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko55 Servers

Load older messages


SenderMessageTime
8 Aug 2024
@lassulus:lassul.uslassulus:D maybe I should have written NoDeps11:40:21
@eyjhb:eyjhb.dkeyJhbWe got to it in the end :p Thank you for the quick response :D Now I can continue11:42:33
10 Aug 2024
@matthewcroughan:defenestrate.itmatthewcroughanDisko can't make something with an arbitrary sector start or gpt table length can it?21:48:22
@matthewcroughan:defenestrate.itmatthewcroughanIs it possible with the gpt type to dd a nix store path to a partition?22:06:21
@matthewcroughan:defenestrate.itmatthewcroughanI guess that'd be done in the postCreate hook, but it's quite an unsafe thing to do22:13:05
@matthewcroughan:defenestrate.itmatthewcroughannot clear how to access the disko vars or what ones to access to get the absolute path to the partition in question, by nix evaluation22:13:25
11 Aug 2024
@matthewcroughan:defenestrate.itmatthewcroughanHere's what I'm talking about, and the best I could come up with14:23:32
@matthewcroughan:defenestrate.itmatthewcroughan
    devices = {
      disk = {
        disk1 = rec {
          type = "disk";
          device = "/dev/disk/by-id/usb-Generic-_SD_MMC_20120501030900000-0:0";
          postCreateHook = ''
            lsblk
            cat ${uboot}/bl2.bin > /dev/disk/by-partlabel/disk-disk1-bl2
            cat ${uboot}/fip.bin > /dev/disk/by-partlabel/disk-disk1-fip
            sgdisk -A 1:set:2 ${device}
          '';
          content = {
            type = "gpt";
            partitions = {
              bl2 = {
                start = "34";
                end = "8191";
                priority = 1;
                type = "8300";
              };
              fip = {
                start = "8192";
                end = "12287";
                priority = 2;
                type = "8300";
              };

14:23:35
@matthewcroughan:defenestrate.itmatthewcroughan *
...
    disko.devices = {
      disk = {
        disk1 = rec {
          type = "disk";
          device = "/dev/disk/by-id/usb-Generic-_SD_MMC_20120501030900000-0:0";
          postCreateHook = ''
            lsblk
            cat ${uboot}/bl2.bin > /dev/disk/by-partlabel/disk-disk1-bl2
            cat ${uboot}/fip.bin > /dev/disk/by-partlabel/disk-disk1-fip
            sgdisk -A 1:set:2 ${device}
          '';
          content = {
            type = "gpt";
            partitions = {
              bl2 = {
                start = "34";
                end = "8191";
                priority = 1;
                type = "8300";
              };
              fip = {
                start = "8192";
                end = "12287";
                priority = 2;
                type = "8300";
              };
...
14:23:44
@matthewcroughan:defenestrate.itmatthewcroughan notice how I've just guessed the by-partlabel paths and it's not happening by nix evaluation, and how I've had to use a recursive set to get the device path 14:24:24
@matthewcroughan:defenestrate.itmatthewcroughanThis also won't work in the image builder, it will only work for running the real disko script due to the dependency on the device path which will differ in the VM 14:24:49
@matthewcroughan:defenestrate.itmatthewcroughanAnother issue with using disko for embedded is that the label name is derived from the attributes16:01:57
@matthewcroughan:defenestrate.itmatthewcroughan
Device       Start      End  Sectors Type-UUID                            UUID                                 Name            Attrs
/dev/sda1     2048     8191     6144 0FC63DAF-8483-4772-8E79-3D69D8477DE4 1422349D-2826-4F14-B386-22BAA5192059 disk-disk1-bl2  
/dev/sda2     8192    12287     4096 0FC63DAF-8483-4772-8E79-3D69D8477DE4 1A62DEAA-68A3-4601-A69A-7ADFE4ECDED9 disk-disk1-fip  
/dev/sda3    12288  2109439  2097152 C12A7328-F81F-11D2-BA4B-00A0C93EC93B FAB4CFF0-8873-4B78-B61E-E6252BA5EEDD disk-disk1-boot 
/dev/sda4  2109440 62332927 60223488 0FC63DAF-8483-4772-8E79-3D69D8477DE4 5A0ACF68-C9C3-4822-A92D-99A02DCFA863 disk-disk1-root 

16:01:58
@matthewcroughan:defenestrate.itmatthewcroughan the name is disk-disk1-fip and not fip, but the u-boot bl2 (second stage bootloader) specifically reads this label and matches a string 16:02:24
@matthewcroughan:defenestrate.itmatthewcroughanSo this seems like another awkward point for disko, where I'm unable to coerce it into doing the right thing for the use-case16:02:50
@matthewcroughan:defenestrate.itmatthewcroughan

I managed to end up with the following error on bcachefs creation, maybe the diskoScript is too fast?

starting version 1.9: disk_accounting_v2 opts=compression=lz4
initializing new filesystem
going read-write
initializing freespace
IO error: Operation not permitted
16:03:36
@matthewcroughan:defenestrate.itmatthewcroughanPosted that to #bcache anyway, having so many issues with it lately16:07:10
@lassulus:lassul.uslassulusYou can override the partition Labels. Also some attributes are available in the hooks like the device16:08:07
@lassulus:lassul.uslassulusJust run env in the hook and look at the output16:08:21
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @lassulus:lassul.us
You can override the partition Labels. Also some attributes are available in the hooks like the device
I may be able to, but this then makes it even more risky to run outside of the image builder, since the partlabel may conflict with a real world part label
16:08:48
@matthewcroughan:defenestrate.itmatthewcroughanof something else also plugged into the machine16:09:07
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @lassulus:lassul.us
You can override the partition Labels. Also some attributes are available in the hooks like the device
"in the hooks" have you got a literal example?
16:09:45
@matthewcroughan:defenestrate.itmatthewcroughan is it like config.disko.something._hooks ? 16:09:54
@matthewcroughan:defenestrate.itmatthewcroughan Something that should never change is the ${device}-part1 ${device-part2}, so maybe I can just use that, since the kernel is responsible for keeping that stable 16:10:44
@matthewcroughan:defenestrate.itmatthewcroughan * Something that should never change is the ${device}-part1 ${device-part2}, so maybe I can just use that, since the kernel is responsible for keeping that -part1 -part2 string stable 16:10:57
@lassulus:lassul.uslassulusNo example ready now. But just run env in a hook to see what's available16:28:18
@matthewcroughan:defenestrate.itmatthewcroughan

lassulus:

Device       Start      End  Sectors Type-UUID                            UUID                                 Name            Attrs
/dev/sda1     2048     8191     6144 0FC63DAF-8483-4772-8E79-3D69D8477DE4 AF2745B3-D3AB-4956-99D2-07CB46646F95 bl2 
17:36:50
@matthewcroughan:defenestrate.itmatthewcroughanit starts at 204817:37:00
@matthewcroughan:defenestrate.itmatthewcroughan fdisk -x says First usable LBA: 34 17:37:18
@matthewcroughan:defenestrate.itmatthewcroughan

So:

          content = {
            type = "gpt";
            partitions = {
              bl2 = {
                start = "34";
                end = "8191";

Didn't quite do what I was looking for

17:37:37

Show newer messages


Back to Room ListRoom Version: 10