nix-community / nixos-install-scripts

collection of one-shot scripts to install NixOS on various server hosters and other hardware. [maintainer=@happysalada]
123 stars 68 forks source link

Hetzner installation failing (zfs-uefi-nvme-nixos.sh script) #11

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hey đź‘‹ , I'm trying to install NixOS on my dedicated Hetzner box. I was trying the other script but wasn't able to get uefi booting to work. I switched to using this script and had a few questions.

First, I have Ubuntu 20.10 installed on my dedicated server. The script fails on this line:

# Stop all mdadm arrays that the boot may have activated.
mdadm --stop --scan

with the following error:

+ mdadm --stop --scan
mdadm: Cannot get exclusive access to /dev/md2:Perhaps a running process, mounted filesystem or active volume group?
mdadm: Cannot get exclusive access to /dev/md1:Perhaps a running process, mounted filesystem or active volume group?
mdadm: Cannot get exclusive access to /dev/md0:Perhaps a running process, mounted filesystem or active volume group?

I understand those errors are due to the current Ubuntu installation using those drives. Output of lsblk:

NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
nvme0n1     259:0    0 953.9G  0 disk
├─nvme0n1p1 259:2    0   256M  0 part
├─nvme0n1p2 259:3    0     4G  0 part
│ └─md0       9:0    0     4G  0 raid1 [SWAP]
├─nvme0n1p3 259:4    0   512M  0 part
│ └─md1       9:1    0   511M  0 raid1 /boot
└─nvme0n1p4 259:5    0 949.1G  0 part
  └─md2       9:2    0   949G  0 raid1 /
nvme1n1     259:1    0 953.9G  0 disk
├─nvme1n1p1 259:6    0   256M  0 part  /boot/efi
├─nvme1n1p2 259:7    0     4G  0 part
│ └─md0       9:0    0     4G  0 raid1 [SWAP]
├─nvme1n1p3 259:8    0   512M  0 part
│ └─md1       9:1    0   511M  0 raid1 /boot
└─nvme1n1p4 259:9    0 949.1G  0 part
  └─md2       9:2    0   949G  0 raid1 /

Is there a step I'm missing? Should this script be running with the Hetzner machine booted in Ubuntu? cc @happysalada (thanks for contributing the script btw!)

ghost commented 2 years ago

Alternatively, I could attempt the installation using the other script (https://github.com/nix-community/nixos-install-scripts/issues/1) but I think I'll need to ask Hetzner to disable UEFI since it is already enabled.

happysalada commented 2 years ago

You have to boot in rescue mode, not with ubuntu. the script is trying to do something to the file system, so you need to have a terminal with the filesystem unmounted. The rescue mode is debian if I remember correctly. Let me know if any of that doesn't make sense. I'm also interested in how to improve the docs when you figure it out (it's also something I struggled with.

ghost commented 2 years ago

Thanks for the response!

There’s a comment in the script that mentions Ubuntu needs to be installed and I misinterpreted that to mean “run from Ubuntu”. I was able to make some progress in the rescue system late last night but ran into issues with installing zfs (looks like the rescue system has kernel 5.13.1 but the zfs packages in the repo only support up to 5.10).

I think I have a path forward so I’ll give that a shot tonight after work (removing 5.13.1 headers and using 4.19.0 to unblock the zfs installation in the rescue system).

I’ll keep tracking my progress in this issue and am happy to contribute to documentation/script changes if necessary. Thanks again!

happysalada commented 2 years ago

Amazing! Happy to help you merge anything that you think improves the doc.

ghost commented 2 years ago

I was able to resolve my issue by compiling zfs from source to get the latest version (2.1.x) that's compatible with kernel 5.13.1. Unfortunately I am not out of the woods and running into issues installing the bootloader but I've deviated from the script to use systemd-boot instead. Going to close this issue though. Thanks!