a-schaefers / themelios

Bootstrap a zfs-on-root NixOS configuration in one command. Themelios automates the entire installation process using any NixOS livedisk with an internet connection and your git repo. Themelios is flexible with many configuration options and allows for unique, per-machine customization.
MIT License
57 stars 22 forks source link

cannot resolve path '/dev/nvme0n1-part3' #2

Closed ghost closed 5 years ago

ghost commented 5 years ago

In configuration.sh I give themelios the raw disk at /dev/nvme0n1 (the 1 at the end is not a partition). Themelios proceeds but then gives me an error cannot resolve path '/dev/nvme0n1-part3'. Of course it cannot resolve that path, the third partition would be `/dev/nvme0n1p3".

How do I fix this error?

bash <(curl https://raw.githubusercontent.com/a-schaefers/themelios/master/themelios) . git@git.sr.ht:~taohansen/nixfiles
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 23700  100 23700    0     0  45576      0 --:--:-- --:--:-- --:--:-- 45489
WARNING: The following script intends to replace all of your disk(s) contents with a zfs-on-root NixOS installation and bootstrap your configuration.nix.
Ready? (Y or N) Ycloning repo via git@git.sr.ht:~taohansen/nixfiles
Cloning into '/tmp/cloned_remote'...
remote: Enumerating objects: 54, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 54 (delta 16), reused 0 (delta 0)
Receiving objects: 100% (54/54), 15.15 KiB | 12.00 KiB/s, done.
Resolving deltas: 100% (16/16), done.
.
clearing disk with sgdisk...
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
wiping disk signatures with wipefs...
Creating new GPT entries in memory.
The operation has completed successfully.
making bios boot partition...
Setting name!
partNum is 0
The operation has completed successfully.
make efi system partition...
Setting name!
partNum is 1
The operation has completed successfully.
making zpool partition...
Setting name!
partNum is 2
The operation has completed successfully.
Disk /dev/nvme0n1: 1000215216 sectors, 476.9 GiB
Model: INTEL SSDPEKNW512G8                     
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 69C615AA-D125-463F-9AF1-C0E89C06CCA6
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1000215182
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  BIOS Boot Partition
   2            4096         2101247   1024.0 MiB  EF00  EFI System Partition
   3         2101248      1000215182   475.9 GiB   8300  Linux ZPOOL Partition
creating zpool...
cannot resolve path '/dev/nvme0n1-part3'
ghost commented 5 years ago

Ah, I see, /dev/disk/by-uuid/ iss preferable because it displays correct partition names. Closing.

ghost commented 5 years ago

I spoke too soon. Now I can see the the id it complains it can't find but apparently themelios can't?

[root@nixos:~]#  bash <(curl https://raw.githubusercontent.com/a-schaefers/themelios/master/themelios) . git@git.sr.ht:~taohansen/nixfiles
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 23700  100 23700    0     0  65650      0 --:--:-- --:--:-- --:--:-- 65650
WARNING: The following script intends to replace all of your disk(s) contents with a zfs-on-root NixOS installation and bootstrap your configuration.nix.
Ready? (Y or N) Ycloning repo via git@git.sr.ht:~taohansen/nixfiles
fatal: destination path '/tmp/cloned_remote' already exists and is not an empty directory.
The previous command failed. Continue running script? (Y or N) Y.
clearing disk with sgdisk...
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
wiping disk signatures with wipefs...
Creating new GPT entries in memory.
The operation has completed successfully.
making bios boot partition...
Setting name!
partNum is 0
The operation has completed successfully.
make efi system partition...
Setting name!
partNum is 1
The operation has completed successfully.
making zpool partition...
Setting name!
partNum is 2
The operation has completed successfully.
Disk /dev/disk/by-id/nvme-eui.0000000001000000e4d25cc191c54f01: 1000215216 sectors, 476.9 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): D250B0CD-D178-4932-850D-99432D4AF84E
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 1000215182
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  BIOS Boot Partition
   2            4096         2101247   1024.0 MiB  EF00  EFI System Partition
   3         2101248      1000215182   475.9 GiB   8300  Linux ZPOOL Partition
creating zpool...
cannot resolve path '/dev/disk/by-id/nvme-eui.0000000001000000e4d25cc191c54f01-part3'
The previous command failed. Continue running script? (Y or N) NAborted.

[root@nixos:~]# ls /dev/disk/by-id/nvme-eui.0000000001000000e4d25cc191c54f01-part3
/dev/disk/by-id/nvme-eui.0000000001000000e4d25cc191c54f01-part3
ghost commented 5 years ago

Got a little further on a reboot:

creating zpool...
Creating and mounting datasets in /mnt...
mkfs.fat 4.1 (2017-01-24)
Setting property com.sun:auto-snapshot=true to zroot/HOME...
Setting property com.sun:auto-snapshot=true to zroot/ROOT...
moving repo from /tmp to /mnt/nixfiles...
executing nixos-generate-config --root /mnt
writing /mnt/etc/nixos/hardware-configuration.nix...
writing /mnt/etc/nixos/configuration.nix...
generating random hostid...
af29f777
executing nixos-install --root /mnt
building the configuration in /mnt/etc/nixos/configuration.nix...
nix: src/libexpr/primops.cc:56: void nix::EvalState::realiseContext(const PathSet&): Assertion `store->isStorePath(ctx)' failed.
/run/current-system/sw/bin/nixos-install: line 99: 10037 Aborted                 nix build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" --extra-substituters "$sub" -f '<nixpkgs/nixos>' system -I "nixos-config=$NIXOS_CONFIG"
themelios hint: check /mnt/etc/nixos/configuration.nix and your other files in /mnt/nixfiles before trying again.
themelios hint: make sure you are using relative path imports for all of your .nix files.
nixos-install --root /mnt failed, retry? will add --show-trace (y or n) ybuilding the configuration in /mnt/etc/nixos/configuration.nix...
nix: src/libexpr/primops.cc:56: void nix::EvalState::realiseContext(const PathSet&): Assertion `store->isStorePath(ctx)' failed.
/run/current-system/sw/bin/nixos-install: line 99: 10257 Aborted                 nix build --out-link "$outLink" --store "$mountPoint" "${extraBuildFlags[@]}" --extra-substituters "$sub" -f '<nixpkgs/nixos>' system -I "nixos-config=$NIXOS_CONFIG"
themelios hint: check /mnt/etc/nixos/configuration.nix and your other files in /mnt/nixfiles before trying again.
themelios hint: make sure you are using relative path imports for all of your .nix files.

configuration.nix is at https://gist.github.com/Spass1966/87bf9b50fe020121dfb6aa8ebd2feb96

a-schaefers commented 5 years ago

Thank you for spotting this problem, it appears nvme is addressed using p3 and not -part3 like regular disks. The script will need fixing on this. Unfortunately I'm pretty busy this week and not sure when I'll be able to get to it. If memory serves me correctly, if you do not use UEFI you might not have this problem, however.

a-schaefers commented 5 years ago

What about using /dev/disk/by-id ? (Not by-uuid)

a-schaefers commented 5 years ago

On further look it does look like you were able to make it farther by using id, [or uuid actually which I have never tried before], but I assume that is what worked and that makes sense. In fact it appears you were made it work all the way to the last step. If your Nix files do not bootstrap on a fresh install I cannot help with that, however.

Leaving this open so that i can fix the nvme issue

a-schaefers commented 5 years ago

By the way, fetchTarball is probably the reason it wont bootstrap. Its a nix os bug i think...

ghost commented 5 years ago

By the way, fetchTarball is probably the reason it wont bootstrap. Its a nix os bug i think...

let
  url = "https://github.com/colemickens/nixpkgs-wayland/archive/master.tar.gz";
  waylandOverlay = (import (builtins.fetchTarball url));
in

was the issue, as you said! Thanks for your help.

a-schaefers commented 5 years ago

this could be added to documentation too, regarding fetchTarball...

a-schaefers commented 5 years ago

https://github.com/NixOS/nix/issues/2405