Ubuntu and Debian preseeding tips

May 18, 2020 

Over the years I've had to automate installation of Ubuntu and Debian installers a number of times. The primary motivation has always been to avoid all the questions about timezone, locale, partitioning and which packages to install and to not have to babysit the installation. In theory automating the installation is as simple as writing a preseed file. In practice it is much harder for a number of reasons:

  • Documentation on the Internet around custom installation media and preseeding setup is anecdotal at best - it gets you going and then lets you fall on your face. The official documentation is pretty good, though.
  • The exact format of the preseed questions varies by operating system version, not just by operating system (Debian, Ubuntu).
  • In most cases questions about locale and keyboard layout must have answers before the installer preseed is even loaded. This is misleading, because the preseed file does have those questions, even though the answers have zero practical effect for the installer.
  • There are many ways to accomplish preseeding, most notably by creating a custom installation medium with the preseed file, or by getting the preseed from an URL ("auto mode").
  • The default keyboard layout in most Ubuntu/Debian installer is en-US. This is fine, except when you don't have an American keyboard: then you will be struggling to find characters such as ":" or "/", which are relatively essential when loading the preseed file from an URL.
  • It is impossible to remember how to start "automated install" from a vanilla installer menu, let alone figure out what the keyboard and locale settings should look like on the kernel command-line.
  • The installer is happy to produce unworking configurations (e.g. no bootloader or no kernel) without giving any hints why things are not working.
  • Each mistake is costly in time, especially if it affects something like Grub configuration which happens at the end of the install.
  • Because of above, you tend to try to make as many changes to the kernel command line and/or preseeding as possible in one go. This means that when you get things working you don't know what the proper fix was, and don't feel like repeating the process to find out.

In order not to be completely negative here is the general recipe for success:

  • Always start from the official sample preseed for you operating system version.
  • Read the official preseeding documentation for your particular operating system version. This is something I should learn to do as well.
  • Forget about fetching the preseed file from an URL, unless you are also fetching it from a custom installer medium or are installing in an environment with properly configured DHCP/DNS. This is because of non-US keyboard challenges ("https://...") the wonky kernel keyboard layout command-lines that change on a per-OS -basis, differences in OS installers, etc.
  • Create a custom installer media with custom menu entries if possible.
  • If you run into odd issues, like a black screen when the OS boots, it might have nothing to do with preseeding.

This blog post won't give any easy answers or recipes because there aren't any. Just follow the "general recipe for success" above and you will avoid lots of headaches. Also, here's a list of links I've found useful:

Samuli Seppänen
Samuli Seppänen
Author archive
menucross-circle