morph027 / pve-iso-2-pxe

Create PXE bootable Proxmox installation
MIT License
408 stars 91 forks source link

ProXmox 8.1 + PXE: searching for ISO error!?! #42

Closed spamrefuse closed 7 months ago

spamrefuse commented 7 months ago

Hi,

I downloaded proxmox-ve_8.1-1.iso and I extracted 'linux26' and 'initrd.img' from the installation ISO.

Then I converted the initrd.img into the initrd file, following the pve-iso-2-pxe.sh script: $ zstd -d initrd.img > initrd $ echo "proxmox-ve_8.1-1.iso" | cpio -L -H newc -o >> initrd

With that I have created a working PXE configuration entry like this:

label ProXmox menu label ProXmox 8.1 kernel ProXmox/linux26 initrd ProXmox/initrd append vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet splash=verbose proxdebug

The 'linux26' and 'initrd' files are transferred by tftp from server to client. The client PC shows the boot process on its monitor:

================================ Welcome to the Proxmox VE 8.1 installer initial setup startup mounting proc filesystem mounting sys filesystem boot commandline: BOOT_IMAGE=ProXmox/linux26 vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet splash=verbose proxdebug initrd=ProXmox/initrd loading drivers: nvdiafb pata_jmicron pata_acpi ahci mac_hid i2c_i801 ehci_pci acpi_cpufreq input_leds serio_raw psmouse pcspkr intel_cstate kvm_intel intel_powerclamp [ 2.8097181] nvidafb: unknown NV_ARCH searching for block device containing the ISO proxmox-ve-8.1-1 with ISO ID '1417249-89f2-11ee-9dc2-bf4a21bd54a0' testing device '/dev/sr0' for ISO testing device '/dev/sr0' for ISO testing again in 1 seconds testing device '/dev/sr0' for ISO testing again in 2 seconds testing device '/dev/sr0' for ISO testing again in 3 seconds testing device '/dev/sr0' for ISO testing again in 4 seconds testing device '/dev/sr0' for ISO testing again in 5 seconds testing device '/dev/sr0' for ISO testing again in 6 seconds testing device '/dev/sr0' for ISO testing again in 7 seconds testing device '/dev/sr0' for ISO testing again in 8 seconds

[ERROR] no device with valid ISO found, please check your installation medium unable to continue (type exit or CTRL-D to reboot) ~ #

Any ideas what is going wrong here?

Thank you! -Stub.

morph027 commented 7 months ago

Whats the size of your initrd file after adding the iso? Does the cpio command output something like 2524621 blocks ?

spamrefuse commented 7 months ago

I have done the process again and here are the results:

$ ls -s initrd.img 42504 initrd.img

$ zstd -d initrd.img -c > initrd

$ ls -s initrd* 192600 initrd 42504 initrd.img

$ echo "proxmox-ve_8.1-1.iso" | cpio -L -H newc -o >> initrd 2524621 blocks

$ ls -s initrd* 1454912 initrd 42504 initrd.img

Does that give a clue? Or has something unexpected changed in the iso between 8.0 and 8.1? -Stub.

morph027 commented 7 months ago

Looks good so far. Will try if i can find some time to spin up a test VM.

spamrefuse commented 7 months ago

By the way: my PXE server is a 32-bit PC, running Debian 12 (bookworm). So the commands I showed are executed on this 32-bit server. Could that be the issue? Are the results of zstd and/or cpio different when run on 32-bit and 64-bit?

The client is, obviously, a 64-bit PC with virtualization enabled.....

-Stub

spamrefuse commented 7 months ago

Aha, I may have found a clue what could be the cuprit:

I have prepared an initrd file once again, but now on a 64 bit (Fedora 38) PC. The cpio command outputs the same amount of blocks: 2524621 blocks.

Then I copied this initrd_64bit to the 32bit PXE server for comparison:

$ cmp initrd_32bit initrd_64bit initrd_32bit initrd_64bit differ: byte 197218825, line 488516

Further investigation tells that the 'zstd' decompression generates the exact same files on both PCs (the 'cmp' command has no output). So it's the appending cpio command that causes the difference, despite the same message of the blocks count. Apparently the cpio result is different depending on the bit-ness of the PC !?!?!

Both PCs use the exact same version of cpio: "cpio (GNU cpio) 2.13"

Maybe, maybe, this solves the problem. However, I'm currently far away from the PXE server. Some time later this week I will try the 32bit PXE server using the 64bit result of initrd and let you know about the outcome.

-Stub.

spamrefuse commented 7 months ago

Alas, I have tried the new initrd (created on a 64bit PC), but this gives the exact same error sequence as in my original message. Hence there is no issue related to 32bit vs 64bit.

Then I downloaded the proxmox-ve_8.0-2.iso and created the PXE setup for this 8.0 version: I again get the exact same error sequence as in my original message (although with a different ISO ID number, of course). Hence there is no issue related to version 8.0 vs 8.1.

So then what else could be going wrong? I wonder if the ISO ID (e.g. 1417249-89f2-11ee-9dc2-bf4a21bd54a0) has something to do with it. What kind of "ID" is this? And maybe the ISO contents at the end of the initrd is rejected because it has the wrong ISO ID....?!?!

Here are a few more details of my setup.

The PXE server is a 32bit PC with Debian 12 (bookworm), running dnsmasq for DHCP and TFTP. The PXE config entry:

default menu.c32
prompt 0
timeout 600

label ProXmox
  menu label ProXmox 8.1
  kernel ProXmox/linux26
  initrd ProXmox/initrd
  append vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet splash=verbose proxdebug

The Client PC is a 64bit Intel Core i7 CPU with 16 GB ram; it has NO cd/dvd drive attached.

Regards, -Stub

morph027 commented 7 months ago

Ah, was able to reproduce. The image filename is critical, it needs to be proxmox.iso as the initrd scripts within the setup are just looking for a file /proxmox.iso.

So either create a symlink like the script here does ln -s proxmox-ve_8.1-1.iso proxmox.iso or rename the file.

spamrefuse commented 7 months ago

Oh, woow, I didn't see that coming. Great! Then later this week I will do following:

$ cd tftpboot/ProXmox
$ ln -s proxmox-ve_8.1-1.iso proxmox.iso
$ sudo mount proxmox.iso /mnt
$ cp /mnt/boot/linux26 ./
$ cp /mnt/boot/initrd.img ./
$ sudo umount /mnt
$ zstd -d initrd.img -c > initrd
$ echo "proxmox.iso" | cpio -L -H newc -o >> initrd
2524621 blocks
$ cat ../pxelinux.cfg/default
default menu.c32
prompt 0
timeout 600

label ProXmox
  menu label ProXmox 8.1
  kernel ProXmox/linux26
  initrd ProXmox/initrd
  append vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet splash=verbose proxdebug

-Stub

spamrefuse commented 7 months ago

BINGO! I have installed Proxmox via PXE. Thanks for your help!

Out of curiosity: Why is the initrd so picky on the iso filename? Is this something Proxmox has baked into the initrd.img file? Or baked into the 'linux26' kernel? It would be better to search for the iso file with a more generous filename pattern....

Maybe you could add a few comment lines to your shell script about the necessity of the iso filename to be exactly "proxmox.iso" when using the 'cpio' command (for example by creating a symlink).

Best regards, -Stub.

morph027 commented 7 months ago

It's hardcoded, yes (see https://forum.proxmox.com/threads/proxmox-installation-via-pxe-solution.8484/).

The script does create a symlink ;)

https://github.com/morph027/pve-iso-2-pxe/blob/master/pve-iso-2-pxe.sh#L29