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

Re: Preseeding from USB



T o n g wrote:
> Bob Proulx wrote:
> >> 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.
>
> wow, I was planning to boot from CD and put preseed.cfg on USB, which
> will definitely make things even more complicated.

I am sure what you were planning is possible because during
installation time it is possible to load firmware blobs from usb
media.  But I don't know how to do it.  If you figure it out please
educate me.  :-)

> You mean using Alt-F2 to get a text console even before boot up
> process begins? IIRC, the text console will not be available only
> until the boot up process is almost half way through.

It is available after the debian-installer has booted the kernel.  It
will then start asking you questions.  You can Alt-F2 and get a
console and poke around.

> I guess you are right, preseed.cfg has to be on the boot up media.

It is much easier that way.  And the only way to set keyboard and
locale and default network device.

> But still, its path is for the installer, which can be entirely
> different than the normal /mnt/... thing.

Correct.

> Now back to the very beginning, is this automated preseeded installation
> a feature only provided by kernel?

Not by the kernel.  By the debian-installer software.  The d-i runs as
a program application after the installation environment kernel has booted.

> Is the preseeded installer available only at boot time, or there is
> a tool that I can use after the system has booted, like
> debootstrap.

Questions phrased as, "Is it possible?", can only ever be answered in
the affirmative.  It is always possible.

> Is it doing installation from the CD or from the Internet? I mean,
> do I have to user a certain CD, eg Debian installation CD, or it has
> nothing with the CD media so I can put the proper boot up
> instruction in my general-purpose, multi-boot USB key?

It depends upon the installation media.  There are CD/DVD images that
install from hard media.  There are netinst images that boot from
media and then install packages from the network.  The netinst images
are the most useful and are highly recommended.  But you can also use
small CD images that are completely self-contained to install a small
system image.

> Eg,
>
>  kernel linux
>     append auto=true priority=critical preseed/locale=en_US kbd-chooser/
> method=us preseed/url=http://192.168.13.184/preseed-files/preseed.cfg
> ramdisk_size=14984 root=/dev/rd/0 initrd=initrd.gz
>
> (copied from http://serverfault.com/questions/143296/how-to-get-http-
> preseed-to-work-correctly-on-ubuntu-10-04-lts-lucid)

I use:

  append vga=788 initrd=debian-installer/i386/initrd.gz console-keymaps-at/keymap=us locale=en_US interface=eth0 hostname=localhost domain=localdomain auto url=http://localwwwserver/debian/preseed.cfg

Usually I set the hostname and domain to public values there.  It
depends upon what I am targeting.  Using localhost.localdomain is one
internally consistent possibility.  Good for a standalone test victim
machine for random software testing.

> Furthermore info about my preseed testing: to speed up reboot & testing,
> I'm testing with VirtualBox, using ISO file as its CD. The ISO that I'm
> testing now is Ubuntu (because that's the one people most blogged about).

And here we are on the debian-user mailing list talking about Ubuntu
again.  (me hangs head and shakes head sorrowfully)

> That one (Ubuntu 12.04) has problem with DNS resolving at boot up time,

I am using Debian and the debian-installer uses dhcp to configure the
network.  DHCP provides all of the information needed (nameservers)
for host names to be used.  I use names in my URL for the preseed
file.  It works fine in Debian.  :-)

> so I was forced to consider providing preseed.cfg from USB, which now I

Why were you forced?  It looks like you used IP addresses okay.  IP
addresses would not need a name lookup.

> think maybe even more troublesome. It'd be much better if the boot
> process can be decoupled from the preseeded installation. That will make
> troubleshooting much much easier.

If you are doing an install boot such that you can control the kernel
command line parameters then I think you don't need an initrd preseed
file but can specify those three early variables keyboard, locale,
network interface, on the command line.  Then use a preseed file on
your local web server for everything else.  That should work just
fine.

I am not using VirtualBox but I am using KVM.  It is similar but
different.  Here is a command line that I use to do a network
installation onto a virtual machine.  (I use 'env -i' because some
environment variable in my environment that I never closed on caused
virt-install to fail.  YMMV.)  I set the variables earlier in the
script in the obvious way.

env -i HOME=$HOME PATH=$PATH \
  virt-install \
  --name "$name" \
  --ram "$ram" \
  --vcpus "$cpus" \
  --hvm \
  --nographics \
  --disk path=/var/lib/libvirt/images/"$name".img,size="$size" \
  --os-type linux \
  --os-variant debiansqueeze \
  --network bridge:br0 \
  --location http://localwww/ftp.us.debian.org/debian/dists/squeeze/main/installer-amd64/ \
  --extra-args "console=ttyS,9600n8 initrd=debian-installer/i386/initrd.gz console-keymaps-at/keymap=us locale=en_US interface=eth0 hostname=$name domain=$domain auto url=http://localwww/debian/preseed-all.cfg";

Here I am using the --location option.  But this works just as well to
boot a netinst cdrom iso image too.  And it also works to boot a PXE
boot image too.  (But on my network PXE boot installations require
interaction.  So I use the above for fully automated installation.)

Then as long as I am here talking...  I use preseeding to hook in a
final finishing up installation script.

  d-i preseed/late_command string wget -O/target/var/tmp/bootstrap http://localwww/bootstrap/bootstrap; in-target sh /var/tmp/bootstrap

That runs a script and allows me to do additional configuration in
that script.  In that script I install additional packages such as
openssh-server and set up host keys and other things.  Since I am
creating clones I configure a cloned host key.  I rename the host
system there to whatever I am doing at the time.  I use the following
to differentiate virtual machines from real machines:

  if grep -q "^model name.* QEMU Virtual CPU" /proc/cpuinfo ; then
    # This is a virtual machine.

Then as long as I am here talking...  If you create enough unique
systems in a short timespan you might run your dhcp server out of
dynamically available addresses.  The d-i will need a different IP
address than the finished host system.  (This is by design.)
Therefore I configure the dhcp server with quite short lease times for
volatile systems such as d-i.  I don't post everything here but as a
hint this is part of my configuration:

class "volatile"  {
  match if substring (option vendor-class-identifier, 0, 3) = "d-i" or
           substring(option vendor-class-identifier, 0, 9) = "PXEClient" or
           substring(option vendor-class-identifier, 0, 9) = "Etherboot" or
           substring(option vendor-class-identifier, 0, 8) = "anaconda" or
           substring(option vendor-class-identifier, 0, 8) = "volatile";
}

And then volatile devices get a short lease time so that the pool of
addresses isn't depleted.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: