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:
###  http://d-i.alioth.debian.org/manual/en.amd64/install.en.pdf
###  http://d-i.alioth.debian.org/manual/example-preseed.txt
###  http://www.hands.com/d-i/etch/classes/

### 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 ftp.cae.tntech.edu
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 http://ftp.cae.tntech.edu/debian-security etch/updates main

# XXX -- TEMPORARY HACK UNTIL WE GET A SIGNED LOCAL REPOSITORY
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
done
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. arabian adventures | July 11, 2018 at 5:13 am | Permalink

    Nice Post.

  3. Dubai Business Set U | July 13, 2018 at 1:59 am | Permalink

    I’m Really Impressed With Your Article, Such Great & Usefull Knowledge You Mentioned Here

  4. iMessage App | July 16, 2018 at 6:26 pm | Permalink

    Thanks For Sharing.

  5. Titanium key | July 19, 2018 at 12:29 am | Permalink

    Thanks for sharing …

  6. Titanium key | July 19, 2018 at 12:30 am | Permalink

    Thanks for sharing article.

  7. Titanium key | July 19, 2018 at 12:31 am | Permalink

    Thanks for sharing article. and nice article

  8. Telstra Customer Ser | July 26, 2018 at 3:51 am | Permalink

    We are providing support for a couple of decade currently. Thousands of glad Telstra support customers.we’ve got been impeccable with our Telstra business contact services and every one support is provided.

  9. mumbai andheri | August 2, 2018 at 9:25 pm | Permalink

    tightened from their shoppers that square measure from the various moods.

  10. bloxorz | August 6, 2018 at 3:55 am | Permalink

    I feel it interesting, your post gave me a new perspective! I have read many other articles about the same topic, but your article convinced me! Thanks your share!

  11. Assignment Help | August 9, 2018 at 1:59 am | Permalink

    This content is very informative for me. Thank you so much for sharing. Need My Assignment Help ? Allassignmenthelp Provide best all Assignment Help to the student at cheapest cost.

  12. Michelle Johnson | August 14, 2018 at 3:28 am | Permalink

    hello

  13. Assignment Help | August 17, 2018 at 3:16 am | Permalink

    I really enjoy and read your blog. it is very nice . keep it up

  14. handicraft | August 23, 2018 at 1:44 pm | Permalink

    Great site and a great topic as well I really get amazed to read this. It’s really good. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. brass handicrafts online

  15. Essay Writing Servic | August 25, 2018 at 12:00 am | Permalink

    The leading assignment help UK firm offers state of the art services to its clients with a promise of delivering all the required work well within the deadline.

  16. happy wheels | August 25, 2018 at 1:27 am | Permalink

    Chill with me: geometry dash

  17. dubai desert safari | August 25, 2018 at 4:36 am | Permalink

    I’m still learning from you, while I’m improving myself. I definitely enjoy reading everything that is posted on your blog.Keep the tips coming. I loved it!

    abu Dhabi desert safari deals

  18. Divine Vibe | August 26, 2018 at 7:04 am | Permalink

    Are you caught up in the celebrity world and fascinated with Hermès Birkin bags in basic black? There is the perfect place to find what you are looking for – HermesSale.ee for the best in Hermes Birkin bags in black and every other color.

    Let’s be frank. There are too many of you that lust after the Hermès mini Birkin bag. The supple texture of the leather and the hand crafted design is to die for. Too bad Hermès prices are well out of your range. Go to HermesSale.ee instead. Shop for the perfect Hermès mini Birkin bag at a fraction of the cost.

  19. Divine Vibe | August 26, 2018 at 7:04 am | Permalink

    Are you caught up in the celebrity world and fascinated with Hermès Birkin bags in basic black? There is the perfect place to find what you are looking for – HermesSale.ee for the best in Hermes Birkin bags in black and every other color.

    Let’s be frank. There are too many of you that lust after the Hermès mini Birkin bag. The supple texture of the leather and the hand crafted design is to die for. Too bad Hermès prices are well out of your range. Go to HermesSale.ee instead. Shop for the perfect Hermès mini Birkin bag at a fraction of the cost.

  20. DivineVibe | August 26, 2018 at 7:11 am | Permalink

    Are you caught up in the celebrity world and fascinated with Hermès Birkin bags in basic black? There is the perfect place to find what you are looking for – HermesSale.ee for the best in Hermes Birkin bags in black and every other color.

    Let’s be frank. There are too many of you that lust after the Hermès mini Birkin bag. The supple texture of the leather and the hand crafted design is to die for. Too bad Hermès prices are well out of your range. Go to HermesSale.ee instead. Shop for the perfect Hermès mini Birkin bag at a fraction of the cost.

  21. Sajid Khan | August 27, 2018 at 4:19 am | Permalink

    Are you caught up in the celebrity world and fascinated with Hermès Birkin bags in basic black? There is the perfect place to find what you are looking for – HermesSale.ee for the best in Hermes Birkin bags in black and every other color.

    Let’s be frank. There are too many of you that lust after the Hermès mini Birkin bag. The supple texture of the leather and the hand crafted design is to die for. Too bad Hermès prices are well out of your range. Go to HermesSale.ee instead. Shop for the perfect Hermès mini Birkin bag at a fraction of the cost.

  22. Ritika Kapoor | August 27, 2018 at 9:12 am | Permalink

    I am Ritika an independent model service girl in Mumbai. I provide services to my clients to satisfy their needs

  23. paperhelp | August 30, 2018 at 1:56 am | Permalink

    I love to visit your site repeatedly because; here I find all information is very useful and educational for me.

  24. My Assignment Help | September 1, 2018 at 2:17 am | Permalink

    This is one of the finest post i have ever seen. The information is genuine and relatable and i am looking forward to avail the services of My Assignment Help.

  25. Assignment help | September 6, 2018 at 7:25 am | Permalink

    It is good to read such a valuable information and thanks for sharing it. Livewebtutors is striving towards creating a great learning platform and hence, provide authentic assignment help to make it more informative.

  26. happy wheels | September 6, 2018 at 9:41 pm | Permalink

    ! I feel it interesting, your post gave me a new perspective! I have read many other articles about the same topic, but your article convinced me! I hope you continue to have high quality articles like this to share with veryone!

  27. English Assignment H | September 7, 2018 at 1:37 am | Permalink

    Do multiple layers of meaning in a text, vague concepts (like nihilism, existential crisis, postmodernism, etc), witty quotes (hard to comprehend) and intricate English stylistics keep buzzing in your head? In addition, do the heap of English assignments makes your life miserable? Well, then only MyAssignmenthelp.com can help you get out of this unmanageable situation by offering you top-notch English assignment help online in the U.S.

  28. law assignment help | September 7, 2018 at 7:11 am | Permalink

    Real content with 100% satisfaction guaranteed with expert writers.

  29. online assignment he | September 8, 2018 at 1:52 am | Permalink

    I am David Taylor. I am an academic content writer and editor, associated with GotoAssignmentHelp.com for a decade. GotoAssignmentHelp.com is leading plagiarism free assignment writing help in Australia.

  30. Do My Essay Writing | September 11, 2018 at 1:29 am | Permalink

    I’m getting excited about this kind of beneficial information of your stuff in the future

  31. kamran malik | September 12, 2018 at 2:32 am | Permalink

    Nice and informative post, thank you such a nice sharing, we can hope find more from you on this thank you.

  32. Operations Managemen | September 13, 2018 at 1:55 am | Permalink

    Things Are Very Open And Intensely Clear Explanation Of Issues. Was Truly Information. Your Website Is Very Beneficial.

  33. Pay Me To Do Marketi | September 13, 2018 at 4:24 am | Permalink

    This Is Really A Great Stuff For Sharing. Keep It Up .Thanks For Sharing.

  34. Jiya Oberoi | September 15, 2018 at 4:34 am | Permalink

    I am Jiya an independent model in Mumbai. If you want to enjoy my services in Mumbai. I will be your companion. Visit Borivali call girls to book me

  35. Jiya Oberoi | September 15, 2018 at 4:34 am | Permalink

    I am Jiya an independent model in Mumbai. If you want to enjoy my services in Mumbai. I will be your companion. Visit Borivali call girls to book me

  36. Riya Bhatt | September 15, 2018 at 4:39 am | Permalink

    If you are looking High Class Call Girls In Andheri then contact us. These services are available for you to 24*7. RiyaBhatt waiting you call contact by whatsapp and email, direct call fo RiyaBhatt.

  37. mattress gurgaon | September 18, 2018 at 5:44 am | Permalink

    Gurgaon mattress shop

  38. Shanawar | September 24, 2018 at 2:34 am | Permalink

    Nice article.

  39. Mumbai Escorts | September 25, 2018 at 9:36 pm | Permalink

    Mumbai Escort Service offers you with a sleek offer. Beautiful and highly effective Mumbai Escort girls are here to give you the complete consent. In our VIP collection, Mumbai’s best escort services and escort girls are selected best. Experiencing freedom from the Mumbai Escort Service can chooseMumbai Escorts

  40. wajahat khan | September 26, 2018 at 4:03 am | Permalink

    This article is indeed worth reading . I think this was just an amazing information regarding an important issue You should also read this out to check how to free fb hacks can be done

  41. Speedypaper | September 27, 2018 at 2:35 am | Permalink

    To write A-worthy essays, reports, term papers, theses and use winning techniques – it’s about Speedypaper.

  42. Managerial Economics | September 27, 2018 at 6:40 am | Permalink

    If you are facing challenges in preparing your Managerial Economics assignment and require guidance. If assignment questions are beyond your conceptual knowledge and you are not capable of solving those. If you want to secure better grade in the managerial economic course then our Managerial Economics assignment help is the best option for you in such circumstances.

  43. Managerial Economics | September 27, 2018 at 6:42 am | Permalink

    If you are facing challenges in preparing your Managerial Economics assignment and require guidance.

  44. Managerial Economics | September 27, 2018 at 6:48 am | Permalink

    Thanks for sharing such informative article . If you are facing challenges in preparing your Managerial Economics assignment and require guidance.

  45. mumbai escorts | September 30, 2018 at 2:58 am | Permalink

    down at any facet of your energy thus positively you’ll be a lot of happy when tormented by our companion services.

  46. Students Assignment | October 2, 2018 at 5:33 am | Permalink

    Our best and top experts continue working and guiding you toward finishing your tricky assignments easily. If you are a student in Singapore and want a professional assistance then simply visit at StudentsAssignmentHelp.com and take our Students Assignment Help Singapore services at a reasonable cost.

  47. musandam tours | October 4, 2018 at 12:30 am | Permalink

    Khasab is the regional centre of Musandam Sultanate of Oman. It is located very close to the Strait of Hormuz and about 60 km away from Ras-Al-Khaimah in the United Arab Emirates, about 2 and half hours from Dubai. It is known for fishing, diving, mountain safari, snorkelling and swimming, fishing and dolphin watch. Khasab is currently evolving as a tourist destination and attract thousands of tourist form around the world.

{ 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

    […] http://blogs.cae.tntech.edu/mwr/2007/04/17/unattended-debian-installations-or-how-i-learned-to-stop-… […]

Post a Comment

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