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.

{ 40 } Comments

  1. sleeping pills | February 20, 2019 at 1:43 pm | Permalink

    Can I simply say what a relief to uncover somebody who really knows what they are discussing on the internet.
    You actually understand how to bring an issue to light and make it important.
    More people have to read this and understand this side of your story.
    It’s surprising you’re not more popular given that you surely possess the gift. If anyone is looking for weight loss medicines at cheaper price you can immediately call on +1-661-2217635 and get the best prescription by the experts.

  2. App Developers in De | February 21, 2019 at 6:28 am | Permalink

    I want to say that this post is awesome, nice written.

  3. college interviews | February 21, 2019 at 8:21 am | Permalink

    Thank you so much for this post! I’ve already tried some Linux distros (Mint fits me the best). But now I’m going to try Debian. 10 minutes for installation? Really? Now I have flashbacks, because it takes at least two hours to install Windows. Also, that’s a reason, why I want to use Debian. Because it takes to long to install Windows updates, and we have to install them regularly.

  4. Mobile app Developme | February 21, 2019 at 8:22 pm | Permalink

    Nice and interesting post,I appreciate your hard work,keep uploading more, Thank you for sharing valuable information.

  5. my assignment help | February 22, 2019 at 5:45 am | Permalink

    why it is not a wise decision to work with The firm has certain flaws and major drawbacks that can put potential students in trouble, making their academic career unfavorable.

  6. Assignment Help | February 22, 2019 at 7:47 am | Permalink

    Thanks for this informative content. It’s really good. Actually, I want to share some thoughts and reviews about an Australian assignment help company and the brand name is SAMPLE ASSIGNMENT.

  7. Assignment Help | February 25, 2019 at 4:25 am | Permalink

    I`m very delighted in for this blog. I appreciate the effort you made to share. We, at Livewebtutors.Com, can provide you with the professional Assignment Help that you require to solve your complicated assignment papers.

  8. ru-chan | February 25, 2019 at 5:52 am | Permalink


  9. programming help | February 27, 2019 at 2:57 am | Permalink

    we offer programming help for C, C++, Java and different Assignments. Our site is number 1 for Programming Assignment Help in USA, Australia and UK.

  10. Custom-Essay UK | February 27, 2019 at 3:51 am | Permalink

    In this day and age, it has become quite common to find students grappling with their essay writing tasks, as they’re necessitated to deal with not just one component of stress. Instead they’re required to deal with multiple layers of distress that are barraged onto them simultaneously. Hence, for this reason, it is of paramount importance for students to uncloak and unmask the underlying sentiment of misery from their being, and thus make use of the Best essay writing service UK which is Write My Custom-essay. This facility has garnered and has pooled in such eminence and reputation in the industry, as they are consistent and dedicated.

  11. commercial law | February 28, 2019 at 3:51 am | Permalink

    I read your blog and find it very informative and keep going like you do.

  12. neena salvotore | March 1, 2019 at 10:22 pm | Permalink

    Sometimes students have face problem to write assignment. we have many experts. Those have decades years knowledge. you can send an email

  13. academic writing | March 1, 2019 at 10:24 pm | Permalink

    Sometimes students have face problem to academic writing assignment. we have many experts. Those have decades years knowledge. you can send an email

  14. five nights at fredd | March 4, 2019 at 1:53 am | Permalink

    So how could I go. When you are my destination, pls.
    geometry dash

  15. piphiker ea review | March 4, 2019 at 4:25 pm | Permalink

    This Is Really Great Work. Thank You For Sharing Such A Good And Useful Information Here In The Blog

  16. Assignment help | March 5, 2019 at 3:04 am | Permalink

    Wonderful points altogether, you just gained a new reader. Thanks for this stuff.

  17. best essay writing | March 5, 2019 at 2:14 pm | Permalink

    Begin by ensuring that you have everything that you will need to study. Having to wander somewhere else to collect your notes or important textbooks is an easy way to distract yourself from what you should be doing.

    If you can’t mentally switch off to television or music, make certain that your study area is in a place where you can’t hear these distractions.

  18. Kim | March 6, 2019 at 2:07 am | Permalink

    Wao excellent! Glad to find such great blog with lots of wonderful information.

    musandam dhow cruise

  19. Dissertation help | March 6, 2019 at 2:10 am | Permalink

    Excellent and nice post. It will beneficial for everyone. Thanks for sharing such a wonderful post. Avail No 1 Dissertation writing services Help UK from certified PhD writers. It is extremely helpful for me. You can email us at or Phone Number – 020 8144 9988

  20. Harvard referencing | March 6, 2019 at 6:18 am | Permalink

    Common MLA citation generator style types along with examples of how they are laid. Start the Works Cited list on a new page at the end of your assignment. Harvard generator covers all basic explanations and examples for the most common types of citations used by students.

  21. Assignment Help | March 7, 2019 at 4:13 am | Permalink

    A high-standard post with all imperative information about Assignment Help UK services. Looking forward to availing the premium services.

  22. john smith | March 7, 2019 at 7:54 am | Permalink

    I am happy to visit your distinguished way of writing in this post. Now it is easy to understand and implement the concept for me. Keep writing these types of posts.
    frank castle coat for sale

  23. andrea rose | March 7, 2019 at 5:40 pm | Permalink

    I read your blog post and this is nice blog post.. thanks for taking the time to share with us. have a nice day
    forex fury

  24. Essay help | March 8, 2019 at 12:30 am | Permalink

    Students Assignment Help offers the essay help services by their skilled assignment writers who cater quality writing help services without missing the deadlines.

  25. Patronage Institute | March 8, 2019 at 2:18 am | Permalink

    Patronage Institute for Best Business, Management & Science Degree is a distinct name amongst top MBA, MCA, BCA, B.Sc & B.Ed. courses in Noida & Delhi NCR. You can choose the best UG/PG, B.Ed. & certificate program in Artificial Intelligence as per your interest. Top Management Colleges Ghaziabad, Delhi NCR, India.

  26. Celeb Jacket | March 11, 2019 at 1:51 pm | Permalink

    Extraordinary discourse and I got the dialog about this point; I was discovering this data numerous days acknowledgment to the author as far as anyone is concerned.

  27. lukas baran | March 11, 2019 at 1:52 pm | Permalink

    Extraordinary discourse and I got the dialog about this point; I was discovering this data numerous days acknowledgment to the author as far as anyone is concerned. Timothy Olyphant Coat

  28. promote blog | March 12, 2019 at 1:24 am | Permalink

    It is the web portal that provides sample information on various topics to help the people.

  29. SEO Services | March 12, 2019 at 6:02 am | Permalink

    Nice information, thanks for sharing your information.

  30. | March 14, 2019 at 4:34 am | Permalink

    Problems solved! Thanks

  31. College Assignments | March 14, 2019 at 7:45 am | Permalink

    Professional College Assignments Help online is available at Best team of masters and Ph.D. degree professionals that understand students requirement and complete all the task properly. We are working with a team of native writers from the USA, Ireland, Australia, Singapore, UK, New Zealand, etc.

  32. Assignment Help | March 14, 2019 at 8:22 am | Permalink

    Are you demanding for Assignment Help? Turn towards LiveWebTutors and stay tension free. We have professional and experienced subject experts offering you the most favourable assignment help services and ensure quality solutions and delivery in time.

  33. usi tech reviews fro | March 14, 2019 at 4:49 pm | Permalink

    Thanks For Sharing this Great article

  34. Shopping Store | March 15, 2019 at 12:01 am | Permalink

    Keep it up guys…..

  35. app toronto | March 15, 2019 at 5:39 am | Permalink

    We are the best provide mobile app development service in Toronto And Canada please visit here my website more information.

  36. Mobile App Developme | March 18, 2019 at 4:56 am | Permalink

    Thanks for sharing valuable Information, I really very impressive on your blog. I hope you continue on blogging job.

  37. Makemyassignments | March 18, 2019 at 7:39 am | Permalink

    Are you demanding for Assignment Help? Turn towards Makemyassignments and stay tension free. We have professional and experienced subject experts offering you the most favourable assignment help services and ensure quality solutions and delivery in time.

  38. Assignmenthelp | March 19, 2019 at 7:50 am | Permalink

    Many thanks for sharing such blog. keep up sharing this type of blog.

  39. NZ assignment help | March 20, 2019 at 12:44 am | Permalink

    Get assignment writing help from students assignment in New Zealand from the professional of all over the world that has deep knowledge of the subject and all are expert in their field. If you are really seeking of help then get it on NZ assignment help.

  40. Interior Designers | March 25, 2019 at 12:15 am | Permalink

    I can only express a word of thanks! Nothing else. Because your topic is nice, you can add knowledge. Thank you very much for sharing this information.
    Find the Interior Designers in Madhurawada

Post a Comment

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