Debian Netinst Installer ignores network and locale preseed.cfg settings upon PXE/TFTP boot

Posted by: admin  :  Category: Debian GNU/Linux, Operating Systems

As you came along I suppose you stubled accross the same issue as me, didn’t you?

As far as I’m concerned, I can only tell that this issue rises when netbooting Debian-Installer through PXE/TFTP in combination with a preseed.cfg file, while the latter one being downloaded from a HTTP web-server.
This bevahiour has been observed with Debian Lenny and older versions and can cause quiet some headache upon setup automation if not taken into account.

To summarize the situation before we dig into more details:

  • I want to netboot Debian-Installer (the Debian “netinst” image) through PXE/TFTP.
  • Debian netinst is launched through pxelinux, as supposed by all common documentation out there
  • I want a preseed.cfg to be dynamically downloaded from a web-server during installation to achieve an automatic installation
  • Issue Observed: Despite of having set the “debian-installer/locale”, “console-keymaps-at/keymap” and other settings within the preseed.cfg, Debian-Installer keeps asking you for language, keyboard and other values straight after bootup

This article won’t dig into the details of setting up the required boot environment and it’s particular configuration.
I assume you have all of that in place already.

Your current configuration will most likely look like this in your pxelinux.cfg/default file:


label debian507
MENU INDENT 1
MENU LABEL -> Debian GNU 5.0.7
kernel /images/Debian/5.0.7/i386/linux
append vga=normal initrd=/images/Debian/5.0.7/i386/initrd.gz ramdisk_size=65536 \
root=/dev/rd/0 devfs=mount,dall rw auto \
url=http://some.webserver/configs/Debian/5.0.7/i386/preseed.cfg --

Within your preseed.cfg you define some settings with the intend of a full automation. Here’s an excerpt of mine:


# keyboard and locale settings
####################################################################

d-i debian-installer/locale string en_US
d-i console-keymaps-at/keymap select sg-latin1

# networking
####################################################################

d-i netcfg/disable_dhcp boolean false
d-i netcfg/get_hostname string localhost
d-i netcfg/get_domain string localdomain
d-i netcfg/choose_interface select eth0

You now would propably expect that having these lines in your preseed.cfg would cause Debian-Installation to stop prompting you after bootup. Instead you still end up being bugged with these prompts:

Now to the question, what causes this behaviour.

Essentially this is sort of a chicken-and-egg problem within Debian-Installer.
Due to it’s internal architecture, the installer consists of multiple parts as lined out in the Debian-Installer internals documentation, which take care about the various stages.

First we have the debian-installer-startup and debian-installer binaries, which care about all the init stuff.
Second we have the main-menu component, which does all the questioning and installation using the underlying debconf framework.

Well, so far so good. debian-installer will take care about a preliminary network setup so it can actually download the preseed.cfg file and will launch menu-menu afterwards.
If will however only do so AFTER questioning for system locale, keyboard and basic network settings – just at a stage, where it simply didn’t (and in fact couldn’t) download the preseed.cfg file.

So, here’s the chicken: We want to get rid of the questioning by using a preseed.cfg, which cannot be download before answering some initial questions.
Here’s the egg: To get rid of the questioning, we need the help of a preseed.cfg.

Well, there’s of course the possibility, to include the preseed.cfg to the initrd image.
This imposes however a problem, as it may harden upgrades and especially automatic installation with different configurations.

Luckily, there is a way to work around this is by includubg these settings with the kernel append parameters through PXELinux as shown below:


label debian507
MENU INDENT 1
MENU LABEL -> Debian GNU 5.0.7
kernel /images/Debian/5.0.7/i386/linux
append vga=normal initrd=/images/Debian/5.0.7-2.6.32-bpo/i386/initrd.gz ramdisk_size=65536 \
root=/dev/rd/0 devfs=mount,dall rw auto \
url=http://some.webserver/configs/Debian/5.0.7/i386/preseed.cfg \
locale=en_US console-keymaps-at/keymap=sg-latin1 \
interface=eth0 hostname=localhost domain=localdomain --

This would indeed cause debian-installer to not prompt for the initial settings, continue with the network initialization, download the preseed.cfg and proceed to main-menu, which would then use the downloaded preseed configuration.

So, you’re here reading this. Maybe just because you slipped this little information in the official documentation?
Ahem … it’s right there:

quote
An important difference between the preseeding methods is the point at which the preconfiguration file is loaded and processed. For initrd preseeding this is right at the start of the installation, before the first question is even asked. For file preseeding this is after the CD or CD image has been loaded. For network preseeding it is only after the network has been configured.

Obviously, any questions that have been processed before the preconfiguration file is loaded cannot be preseeded (this will include questions that are only displayed at medium or low priority, like the first hardware detection run). Section B.2.2, “Using boot parameters to preseed questions” offers a way to avoid these questions being asked.
end quote

My point for writing this topic: If you’re just getting started with preseeding using on of the many HowTo’s out there, without reading the official docs as well, this particular issue is very likely to slip 😉

3 Responses to “Debian Netinst Installer ignores network and locale preseed.cfg settings upon PXE/TFTP boot”

  1. Cousteau34 Says:

    THanks for this article ! It help me very much !

  2. Keshav Says:

    I have a similar issue but a step further than this. I’m able to get past the questions on locale, keyboard etc. by using the kernel boot parameters (as specified above). At the end of the list on ‘append’ line, I also have a ‘preseed/url=http://mywebserver/path/to/preseed.cfg’ param to get my preseed.cfg from an internal web server.
    The issue I’m having is, after the installer correctly sets the locale, keyboard etc, it just appears to ignore my ‘preseed/url’ parameter and moves ahead to display the menu to choose a mirror site (‘ftp.us.debian.org’, etc.). I can see the preseed.cfg being fetched by the installer (as seen in httpd/access.log on the pxeboot server) but it is not really used.
    I wonder if the reason is some kind of network delay in GET’ting the file by when the installer decides to just move on and show the menu to choose the mirror (?).
    Any ideas or suggestions? I highly appreciate any feedback that you may have.

  3. Keshav Says:

    That was due to a debian bug. I resolved the issue by commenting the following line:

    # d-i mirror/country string us

    and adding:

    d-i mirror/country string manual