[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Preseeding from USB



T o n g wrote:
> If I want to do automated install on Debian (http://www.hps.com/~tpg/
> notebook/autoinstall.php)

Those directions are doing a network install and are loading the
preseed file from the network.

> using preseeding configuration file from USB 
> key, how should I tell the Debian boot loader to look there? 

It isn't completely obvious but as stated here:

  http://www.debian.org/releases/stable/i386/apbs02.html.en

  If you are using initrd preseeding, you only have to make sure a
  file named preseed.cfg is included in the root directory of the
  initrd. The installer will automatically check if this file is
  present and load it.

So for you booting off of USB the simplest thing would be to put the
preseed file in the initrd of your usb boot media.  Then you don't
need to specify anything anywhere and it happens automatically.  But
if you decide not to do that then the docs go on to say:

  For the other preseeding methods you need to tell the installer what
  file to use when you boot it. This is normally done by passing the
  kernel a boot parameter, either manually at boot time or by editing
  the bootloader configuration file (e.g. syslinux.cfg) and adding the
  parameter to the end of the append line(s) for the kernel.

In which case it would be the path to the preseed file at the time
that the install is happening.

> If normally booted, my USB key would be sdc, should I use 
> 
>   preseed/file=/sdc/path/preseed.cfg
> 
> or /mnt/sdc or /media/its_label, or...?

You would need to determine what the path to the install media would
be at boot time.  I would manually boot the installer and then do
Alt-F2 and then return to get a text console.  Then I would inspect
the disks there to see where the installer is mounted.  Then use that
path.

Or if you specify a network path at install boot time then just as
shown in the doc you were referencing you can specify an http URL path
to it and load it that way.  The only downside is that some variables
such as locale and keyboard are used before networking is activated
and so those questions are not automated by this method.

And so you might find it easier to place the preseed file into the
initrd that is on the usb boot media and then have it happen
automatically.  Or at the least have the keyboard and locale variables
set there to avoid those questions and then load the rest of the
preseed file from the network.  Being on the network it would be more
easily edited and changed.

So your next question I expect would be: How do I get the preseed file
into the initrd on the usb boot media?

A useful trick to know is that the initrd maybe a list of concatenated
gzip'd files.  So you don't have to read-modify-write the existing
initrd.gz file.  You only need to *append* an additional file to it.

I haven't tried this with wheezy but with squeeze:

cp $PATH_TO_INSTALL_MEDIA/initrd.gz .
mkdir initrd-preseed
cd initrd-preseed
cat >preseed.cfg <<EOF
d-i debian-installer/locale string en_US.UTF-8
d-i console-keymaps-at/keymap select us
d-i netcfg/choose_interface select eth0
EOF
find . -print | cpio -R 0:0 -o -H newc | gzip >> ../initrd.gz

Then replace the usb install media copy of initrd.gz with your new
copy that has the extra preseed file appended to the end of it.  Then
when you boot from that usb media the initrd.gz file will be loaded
and it will have the preseed.cfg file in place in the initrd and it
will be automatically loaded.

You will need to understand the paths and make adjustments in the
above but I think that should give you the right idea.

I only load those three variables in my initrd preseed.cfg file.  All
other configuration I make in a network available preseed file and I
specify it on the boot line.  I can edit that file easily and the
changes are available without needing to rebuild the initrd each and
every time.  But once you have the initrd preseed it is certainly
possible to specify everything there.

Make sure you keep a pristine copy of your original initrd.gz file.
That way you can rebuild by appending to the end of the pristine copy
again.  I use a read-only iso image for my master copy.  Then I make a
copy of it and append to the end of it for my active boot media.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: