Skip to content

Unattended Debian Installations (or How I Learned to Stop Worrying and Love the preseed.cfg)

A CMR project recently bought 12 new Dell PowerEdge SC1435 servers to replace some of our aging compute cluster systems. In previous server rollouts, I’d generally get one system installed and configured, image it with SystemImager, and then PXE-boot the rest of the systems to pull that image. However, it’s tough to audit exactly what got installed, and how. It’s also arguably a waste of space to keep images of all the types of cluster systems we have (PowerEdge 2650, PowerEdge 1850, PowerEdge 1855, Dimension 9200, etc.). So enter Debian Preseeding. With preseeding, I can make a text file that describes what packages I want installed, debconf configurations that vary from the default, how I want the partitioning done, copy configuration files from web or ftp servers to the target drive, etc. It took a few days to get going, but the long-term payoff should be enormous.

The resulting installation timeline for a PowerEdge SC1435 (relative to power-on in HH:MM:SS):

  • 00:00:25 – Power-on self tests have completed enough to allow me to hit F12 for PXE boot.
  • 00:01:20 – Rest of power-on self tests have completed, PXE boot process starts. All installation parameters are passed in from the pxelinux.cfg file on the DHCP server or the preseed.cfg file on a nearby ftp server.
  • 00:04:50 – Base and standard task packages installed. openssh-server and puppet packages are installed. puppet defaults file is downloaded. System starts formatting a 500GB SATA drive for /tmp space.
  • 00:08:20 – System finishes formatting /tmp, and reboots since that was the last step of the unattended install.
  • 00:09:30 – System is at login prompt. Root password works. puppet will take over installing miscellaneous packages and other post-installation configuration tasks. Once puppet has finished copying over root@adminserver’s public key, I can log in from adminserver without being prompted for a password.

Total number of keypresses from power-up to login: 1. Annotated preseed and pxelinux files after the jump.

PXELinux config file (amd64 version, i386 would be nearly identical — the contents of the “append” line should be all on one line. It’s broken here for readability.)

default preseed
label preseed
kernel debian-installer/amd64/linux
append initrd=debian-installer/amd64/initrd.gz ramdisk_size=10800 root=/dev/rd/0 rw auto
  url=http://REDACTED/./preseed.cfg console-keymaps-at/keymap=us locale=en_US interface=eth0
  hostname=x domain=x netcfg/dhcp_timeout=60 --
prompt 1
timeout 1

Changes versus the default configuration:

  1. Removed display command for splash screen. At one point, I was running out of parameter space on the append line, and removing ‘vga=normal’ was one space saver. I didn’t expect the splash screen to work once that was removed, so I dumped it as well.
  2. Removed F1, F2, … , F9, F0 commands for online help. Optional.
  3. Changed ‘default install’ to ‘default preseed’.
  4. Added preseed stanza, with default kernel, but much different append options.
  5. At the time I started this, the default pxelinux config file had entries for the ramdisk size and root device; these do not appear in the current Debian config file, and I’ll remove mine once I verify that they’re unneeded.
  6. Added append option ‘auto url=http://REDACTED/./preseed.cfg’ to define location of preseed configuration file.
  7. Added append options ‘console-keymaps-at/keymap=us’ and ‘locale=en_US’ to define basic localization for the installation.
  8. Addd append options ‘interface=eth0’, ‘hostname=x’, ‘domain=x’, and ‘netcfg/dhcp_timeout=60’ to get the networking configured. The ‘hostname=x’ and ‘domain=x’ parameters were one of the last tricky bits. I had wrongly assumed that specifying that I’d be using DHCP to get my address would make it pass over asking for a hostname and domain. Preseeding dummy values for each gets past the questions, and DHCP overrides the dummy values as soon as the DHCP negotiation is done.
  9. Changed ‘timeout 0’ to ‘timeout 1’ to allow the installer to proceed without me manually selecting any configurations. Obviously, you may want to increase the timeout to some larger value if you need more time to hit a key to override something for testing.

preseed.cfg (the contents of the “d-i preseed/late_command” line should be all on one line. It’s broken here for readability.):

### References:

### This file needs to be at
### http://REDACTED/preseed.cfg and
### referenced via boot arguments as
### http://REDACTED/./preseed.cfg

### Generic settings applicable to all CAE Debian systems

d-i debian-installer/locale string en_US
d-i console-tools/archs select at
d-i console-keymaps-at/keymap select American English
d-i debian-installer/keymap string us
d-i netcfg/choose_interface select eth0
d-i netcfg/dhcp_timeout string 60
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_hostname seen true
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/get_domain seen true
d-i netcfg/dhcp_options select Retry network autoconfiguration
d-i mirror/codename string etch
d-i mirror/country string enter information manually
d-i mirror/http/countries select enter information manually
d-i mirror/http/directory string /debian/
d-i mirror/http/hostname string
d-i mirror/http/proxy string
d-i clock-setup/utc boolean false
d-i time/zone string US/Central
d-i apt-setup/security_host string
d-i apt-setup/local0/repository string etch/updates main

d-i debian-installer/allow_unauthenticated string true

d-i passwd/make-user boolean false
d-i passwd/root-password-crypted password $1$REDACTED
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
tasksel tasksel/first multiselect standard
d-i pkgsel/include string puppet lsb-release openssh-server
d-i finish-install/reboot_in_progress note

popularity-contest popularity-contest/participate boolean false

### Less generic settings

# Partitioning:
# sda1: 40-100MB for /boot
# sda2: majority of remaining space for /
# sda3: 64MB-(2*RAM) for swap
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/expert_recipe string 
  boot-root :: 
    40 50 100 ext3 
      $primary{ } $bootable{ } 
      method{ format } format{ } 
      use_filesystem{ } filesystem{ ext3 } 
      mountpoint{ /boot } 
    500 10000 1000000000 ext3 
      method{ format } format{ } 
      use_filesystem{ } filesystem{ ext3 } 
      mountpoint{ / } 
    64 512 200% linux-swap 
      method{ swap } format{ } 
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman/confirm boolean true

# Some systems may vary on /tmp -- many have separate disks for it
# (/dev/sdb1), some may have a separate partition on the sda
# drive. This needs to be split out into a system-specific file and
# chained in via class tmp_on_sdb1
# Only applicable for hosts with separate /tmp disk on /dev/sdb1 --
# PE1855 blades (ch226-11...-19), SC1435 servers (ch226-21...-32), old
# ch208a
d-i preseed/late_command string wget -O /target/etc/default/puppet http://REDACTED/puppet ; 
  wget -O /target/root/caeftp_key.asc http://REDACTED/caeftp_key.asc ;
  in-target apt-key add /root/caeftp_key.asc ; echo ';' | sfdisk /dev/sdb ; mke2fs -j -q /dev/sdb1 ;
  echo '/dev/sdb1 /tmp ext3 defaults 0 2' >> /target/etc/fstab; cp /var/log/syslog /target/root

I’m not going to run through every change made in the preseed.cfg file, since the options are well-documented and what’s useful in one environment won’t necessarily translate to another. But I am mildly proud of the late_command at the end: this does two things that were minor pains on a normal preseed installation:

  1. Bootstraps a basic puppet defaults file over to the target drive. Grabbing /etc/default/puppet from a remote site before rebooting makes sure that when puppetd starts up, that it can contact the central server for key signing, and work normally afterwards.
  2. Partitions and formats /dev/sdb to be my /tmp directory. Debian-installer’s partman can’t partition more than one disk automatically, but each of these new systems had a second drive I had planned on using for /tmp. Sfdisk comes to the rescue. The input format description in the sfdisk man page indicates that if you give it a line with no values specified, it will make a partition from the first nonassigned sector to the maximum size, and set the ID to 83 for a Linux partition. So the first time I run this, I go from a drive with an empty partition table to one with a giant partition 1, exactly what I wanted. Subsequent times I run this, it should leave the partition table unmodified, which is also fine. I can’t find the original hint I found for this use of sfdisk.

My /etc/default/puppet is:

# Puppet doesn't like starting before it can contact the puppetmaster.
# Wait up to 30 seconds before continuing.

for n in `seq 1 30`; do
  ping -c 1 REDACTED >& /dev/null && break
  echo -n " $n"
  sleep 1
DAEMON_OPTS="--server REDACTED --factsync"

You may be able to avoid putting in the 30-second sleep, but at one point, with some puppet version, it was helpful on DHCP-managed systems. The critical thing to override on Debian, though, is the -w 0 flag in the default DAEMON_OPTS in /etc/init.d/puppetd. Removing it ensures that puppetd will start up, contact the gold server for key signing, and wait for the signing to happen, rather than immediately exit.

{ 47 } Comments

  1. Luis Bruno | October 22, 2008 at 11:19 am | Permalink

    Thank you for this!

    FYI, from my preseed:
    # prevents the questions from being shown, even if values come from dhcp.
    d-i netcfg/get_hostname string unassigned-hostname
    d-i netcfg/get_domain string unassigned-domain

  2. paykasa | May 22, 2016 at 1:58 pm | Permalink

    hi. good share. thanks.

  3. Hemşire Nasıl Olunur | January 10, 2017 at 1:16 am | Permalink

    Good news

  4. Survivor Başvuru | January 10, 2017 at 1:27 am | Permalink

    Thank you

  5. Zabıta Maaşları | January 28, 2017 at 12:10 pm | Permalink

    Good job

  6. Mercimek Köftesi | January 30, 2017 at 12:28 pm | Permalink

    Good Article

  7. Öğretmen Maaşları | January 30, 2017 at 12:29 pm | Permalink

    Thank you

  8. gmail sign in | February 20, 2017 at 8:57 pm | Permalink

    This is great, That’s a great website, it really is what I was looking for, thank you for sharing!

  9. Teğmen Maaşları | March 7, 2017 at 12:51 pm | Permalink

    Thank you.

  10. | March 24, 2017 at 5:29 am | Permalink

    SSLC Results 2017 will be releasing this april

  11. mobdro apk | March 26, 2017 at 2:33 am | Permalink

    Mobdro is an application that searches for the web for best videos, music, and games for free. You can enjoy live streaming of your favorite shows and matches with the help of Mobdro

  12. animal jam | April 2, 2017 at 10:34 pm | Permalink

    This is great, That’s a great website, it really is what I was looking for, thank you for sharing!

  13. animal jam | May 12, 2017 at 4:00 am | Permalink

    The blog or and best that is extremely useful to keep I can share the ideas of the future as this is really what I was looking for, I am very comfortable and pleased to come here. Thank you very much.

  14. When does iPhone 8 c | May 14, 2017 at 11:47 pm | Permalink

    This article simplified the whole process. Loved the way this article is explained.

  15. maaşlar | May 28, 2017 at 1:05 am | Permalink

    Thank you.

  16. read more | July 4, 2017 at 3:10 am | Permalink

    Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information.

  17. read more | July 4, 2017 at 3:11 am | Permalink

    i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me.

  18. i loved this | July 4, 2017 at 3:21 am | Permalink

    I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.

  19. like it | July 10, 2017 at 3:03 am | Permalink

    Thanks for the best blog. it was very useful for me.keep sharing such ideas in the future as well.

  20. useful source | July 18, 2017 at 2:22 am | Permalink

    I read that Post and got it fine and informative.

  21. hotmail login | July 22, 2017 at 12:02 am | Permalink

    Power-on self tests have completed enough to allow me to hit F12 for PXE boot. HI

  22. skype | July 22, 2017 at 12:02 am | Permalink

    Power-on self tests have completed enough to allow me to hit F12 for PXE boot. Hi

  23. play school in chenn | August 3, 2017 at 7:28 am | Permalink

    I truly expected to write a quick comment remembering the right content to offer on account of you for these surprising information you are putting on your site. You are persistently driving an explosive work. I should state you have created mind blowing article.

  24. bloons tower defense | August 18, 2017 at 12:18 pm | Permalink

    I don’t know who you are. Don’t even know your name I wish we could talk but I don’t have a number to call.

  25. super smash flash 2 | August 18, 2017 at 12:19 pm | Permalink

    I’m starting to wonder if you’ve lost your way I’ve been right here waiting patiently, Your lane should be right here next to me I need you tonight, think of you all of the time. thank you

  26. ryntrng | August 30, 2017 at 7:48 am | Permalink

    Bende öğretmen maaşalrını merak ediyorum baktım ama doğru mu bilmiyorum aydınlatabilirmisiniz beni teşekkürler

  27. Polis Maaşaları | August 30, 2017 at 7:58 am | Permalink

    İyi bakmak gerek

  28. paykasakart | September 6, 2017 at 5:28 am | Permalink

    Paykasa, tıpkı kredi kartlarında olduğu gibi 16 haneli bir numaraya sahip olan, güvenlik kodu bulunan ve aynı zamanda da son kullanım tarihine sahip olan bir karttır. İnternet üzerinden alışveriş yaparken uygulayacağınız ödeme şekli aynen kredi kartında olduğu gibidir ve bu yöntem kredi kartından çok daha güvenilirdir. Kredi kartından ayrılan yönü, ön ödemeli olmasıdır ve en güzel yanı da herhangi bir faiz ödeme gibi bir durumun söz konusu olmamasıdır.

  29. Top 10 Rated Reviews | September 13, 2017 at 12:46 am | Permalink

    Thank you for adding this debian installations detailed article..

  30. happy wheels | September 26, 2017 at 2:11 am | Permalink

    I would like to thank you for the efforts you have made in. The game is best known for its dark sense of humor and its graphic violence . I am hoping the same best work from you in the future as well. I really appreciate your work. Thanks for you agree for me. =>geometry dash

  31. home automation | September 27, 2017 at 1:27 am | Permalink

    This blog is really informative for us. I have read your whole blog you have mentioned points deeply. Thanks for write this kind of informative blog.

  32. Patrick Wilson | November 2, 2017 at 2:23 pm | Permalink

    Great post as always and I must say you’re a really great writer. and I’ve recommend you to some of my colleagues so they will may contact you.

  33. manpreet | November 3, 2017 at 2:13 pm | Permalink

    impressive blog post thanks for sharing this with us

  34. Call girls of delhi | November 12, 2017 at 2:38 am | Permalink

    I have been looking at a couple of your stories and I can state entirely well done. I will bookmark your blog.

  35. Delhi Escorts | November 14, 2017 at 2:01 am | Permalink

    Enjoy with the online dating services by following sites –

  36. sign | November 23, 2017 at 9:11 pm | Permalink

    thank you post quite useful

  37. sign | November 23, 2017 at 9:12 pm | Permalink

    thank you post quite useful

  38. pembedirek | November 24, 2017 at 12:24 am | Permalink

    Thanks for the beautiful post

  39. make up attractive f | November 25, 2017 at 2:07 am | Permalink

    Your article is very interesting, maybe I will regularly visit this site.

  40. Independent Escorts | December 12, 2017 at 10:42 am | Permalink

    Very good article. It’s so useful blog thanks for info.

  41. order hash online | January 16, 2018 at 12:30 am | Permalink

    Thanks for sharing valuable content, this is what I need to know. Thank you once again, it’s very interesting. I wish you all the best for your next blog in future.

  42. Andheri Escorts | January 31, 2018 at 12:32 pm | Permalink

    I have an intimacy Also developing portfolio for my hot What’s more secondary free profile for you to pick with endeavor that all

  43. Escortss Mumbai | January 31, 2018 at 12:34 pm | Permalink

    good-looking females would prepare on serve you day-and-night and settle on you feel like never in front of. Our customers

  44. Mumbai Call Girls | January 31, 2018 at 12:35 pm | Permalink

    get. Our experts would refer to for serving their astounding administrations. They guarantee will do each conceivable relic that

  45. Gemstone Online | February 5, 2018 at 3:28 am | Permalink

    this article gives me mellow in which I can take away at the truth. this is top notch one and offers inside and out measurements. much obliged to you for this top notch article.

  46. hotmail sign in | February 7, 2018 at 3:36 am | Permalink

    How I Learned to Stop Worrying and Love the preseed. Yes, i readed your post. And I think I’m so happy. thank you. bro.

  47. HBS Case Study Solut | February 8, 2018 at 11:30 pm | Permalink

    Hi buddy, your blog’ s design is simple and clean and i like it. Your blog posts about Online writing Help are superb. Please keep them coming. Greets!

{ 3 } Trackbacks

  1. […] Host install tools […]

  2. […] My original preseed.cfg contains the vast majority of what I needed for this server. The biggest difference is in the partitioning scheme: […]

  3. Ubuntu netinstall - Todo | Stuff... | April 29, 2009 at 3:34 pm | Permalink

    […]… […]

Post a Comment

Your email is never published nor shared. Required fields are marked *