disko icon indicating copy to clipboard operation
disko copied to clipboard

Generate an .iso unattended install image

Open bam80 opened this issue 10 months ago • 19 comments

Could we produce a solution for unattended install?

bam80 avatar Apr 19 '24 15:04 bam80

yes, there a multiple solutions. like a modification of https://github.com/nix-community/disko/blob/master/docs/disko-install.md#using-disko-install-in-an-offline-installer or https://github.com/nix-community/nixos-anywhere

Lassulus avatar Apr 19 '24 18:04 Lassulus

Thanks.

Few questions:

  • I don't have NixOS yet, so to be documented "How to use Disko without NixOS" section seems necessary: https://github.com/nix-community/disko/blob/master/docs/HowTo.md#how-to-use-disko-without-nixos Could we fill one?

  • modification of https://github.com/nix-community/disko/blob/master/docs/disko-install.md#using-disko-install-in-an-offline-installer

    It's not quite clear to me what I supposed to do with these two snippets?:

    • https://github.com/nix-community/disko/blob/master/docs/disko-install.md#example-configuration-to-install
    • https://github.com/nix-community/disko/blob/master/docs/disko-install.md#example-for-a-nixos-installer
  • disko-install "can also be used to create bootable USB-Sticks from your normal workstation."

    https://github.com/nix-community/disko/blob/master/docs/disko-install.md#disko-install The bootable USB-Stick presumably will contain the installed system here, but what I wanted to achieve is to generate unattended installation media instead. Is it possible?

bam80 avatar Apr 19 '24 22:04 bam80

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cloud-init-unattended-install/39149/5

nixos-discourse avatar Apr 20 '24 12:04 nixos-discourse

Any help?

bam80 avatar Apr 20 '24 21:04 bam80

Can you please clarify what you mean by unattended installer? The code here does install NixOS onto a system when the installer is booted: https://github.com/nix-community/disko/blob/master/docs/disko-install.md#using-disko-install-in-an-offline-installer

Mic92 avatar Apr 20 '24 23:04 Mic92

OK, as I mentioned above, I do not quite understand how to exactly use these code snippets. It also was other question, could you look? https://github.com/nix-community/disko/issues/606#issuecomment-2067365962

bam80 avatar Apr 20 '24 23:04 bam80

You include those in a configuration that generates an image i.e. using nixos-generators: https://github.com/nix-community/nixos-generators?tab=readme-ov-file#supported-formats

Mic92 avatar Apr 20 '24 23:04 Mic92

Sorry, it's still not clear to me how to embed that snippets. Could you provide complete files please, not just snippets? And the commands to run after.

Please note I don't have Nix/NixOS yet.

bam80 avatar Apr 20 '24 23:04 bam80

You include those in a configuration that generates an image i.e. using nixos-generators: https://github.com/nix-community/nixos-generators?tab=readme-ov-file#supported-formats

@Mic92 so I installed Nix package manager to the system. But further steps are unclear to me.

I would be appreciate for your support.

bam80 avatar Apr 21 '24 15:04 bam80

I have "a" solution to this... it's still a bit hacky, but everything is building, it's just not booting. https://github.com/cowboyai/cim-start/blob/main/vhosts/x86/readme.md that builds an x86 system with libvirtd and specifically with 2 nvme drives and loads 3 containers. it builds correctly and deploys properly, then hangs at reboot because it won't load the disko config. it is specified here: https://github.com/cowboyai/cim-start/blob/main/vhosts/x86/vhost-dev/configuration.nix I have tried every attempt I have seen documented and cannot get the bootloader to configure correctly. The ISO works fine... create the ISO, boot the system... I have to usually restart wpa_supplicant and then install.service once I have an IP. then the system auto-builds correctly, exits disko-install correctly with no errors. on reboot, it hangs ALWAYS waiting for /dev/disk/by-partlabel/disk-sys-nixos rebooting into the ISO and getting a console reveals lsblk to show nvme0n1 does indeed contain two partitions, nvme0n1p1: disk-sys-boot nvme0n1p2: disk-sys-nixos nvme1n1p1: disk-data-data

cowboyai avatar May 02 '24 15:05 cowboyai

Uploading 20240502_091147.jpg…

cowboyai avatar May 02 '24 16:05 cowboyai

on reboot, it hangs ALWAYS waiting for /dev/disk/by-partlabel/disk-sys-nixos rebooting into the ISO and getting a console reveals lsblk to show nvme0n1 does indeed contain two partitions, nvme0n1p1: disk-sys-boot nvme0n1p2: disk-sys-nixos nvme1n1p1: disk-data-data

My efforts are still ongoing, but seems I passed the stage you stuck on, see: https://github.com/nix-community/disko/issues/613#issuecomment-2079307891

bam80 avatar May 02 '24 16:05 bam80

for auto-installation, I am using a systemd service that runs when the iso boots... https://github.com/cowboyai/cim-start/blob/main/vhosts/x86/builder.nix this is all working perfectly until reboot and then mounts all fail. I just don't see anywhere in the docs or the code that says I have to explicitly tell it to load something in the bootloader, in fact it specifically says NOT to and that utterly fails on grub... to even get grub to try to boot it needs grub.boot.device = ["some partition"]... ["nodev"] always fails on grub. systemd seems to work, but fails to mount root onto "/". I cannot see what is getting written to initrd so I can't tell if it is passing something incorrectly or not.

cowboyai avatar May 02 '24 16:05 cowboyai

WhatsApp Image 2024-05-02 at 9 28 44 AM

cowboyai avatar May 02 '24 16:05 cowboyai

WFIW, for my configuration I linked above, I had to pass OVMF firmware file to Qemu (for UEFI to work), and it uses systemd-boot. I was able to boot the installed system then.

bam80 avatar May 02 '24 16:05 bam80

I don't see a link to your config for that... I will need to do some of that later like: boot.initrd.kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd" ]; so I can pass through a GPU. but that shouldn't be needed to get the boot to work.

cowboyai avatar May 02 '24 16:05 cowboyai

I don't see a link to your config for that...

The config is embedded in the linked flake:

https://github.com/nix-community/disko/issues/613#issuecomment-2079307891

No more configs were used, search net for how to run Qemu with UEFI.

bam80 avatar May 02 '24 17:05 bam80

This is how I did it: https://gitlab.com/misuzu/nixos-unattended-install-iso

misuzu avatar Aug 17 '24 15:08 misuzu

And this is how I did it https://github.com/ibizaman/skarabox

ibizaman avatar Aug 22 '24 15:08 ibizaman

Linking to these examples might already be a win wrt the discoverability of this.

iFreilicht avatar Oct 01 '24 16:10 iFreilicht