Debian – Specifying preseed for debian installer inside the initrd as a kernel argument

debianpreseed

I'm setting up an installer using both PXE and USB, and it works well, however I need to add a few different options to the boot menu to use different preseed files. This is for different situations, like whether or not to set up software raid, and with how many disks, etc.

So ideally, I'd like to roll one initrd image containing several preseed files, and specify which one to use with a kernel argument, as detailed in the manual. However, this isn't working. It seems that no matter how I specify preseed/file= , the installer will only look for /preseed.cfg .

Here is an example of my pxelinux.cfg/default file (a very similar config exists for syslinux as well):

DISPLAY boot.txt
DEFAULT install_raid_1disk

LABEL install_raid_1disk
        kernel installer/2b/linux
        append vga=normal initrd=/installer/2b/initrd.gz preseed/file=/preseed-net-raid-1disk.cfg --

LABEL install_raid_2disks
        kernel installer/2b/linux
        append vga=normal initrd=/installer/2b/initrd.gz preseed/file=/preseed-net-raid-2disks.cfg --

LABEL install_noraid
        kernel installer/2b/linux
        append vga=normal initrd=/installer/2b/initrd.gz preseed/file=/preseed-net-noraid.cfg --


PROMPT 1
TIMEOUT 20

Best Answer

Zoredache proposal is very interesting. I would try it first. If it does not work, I would suggest to create one initrd for each preseed. Put the preseed file on the root of initrd.

  1. extract files from initrd:

    $ mkdir /tmp/1; cd /tmp/1; cat /boot/initrd.gz |gzip -d|cpio -i

  2. copy preseed file to root of the initrd:

    $ cp preseed.cfg .

  3. Re create the initrd:

    $ find|cpio -o --format=newc|gzip -9c > ../initrd-custom1.gz

Repeat the steps for each preseed file...