Autoinstallers for Debian Buster and Ubuntu Bionic mitchb precise-dev 0.1.56
authorMitchell E Berger <mitchb@mit.edu>
Thu, 2 Jan 2020 08:30:26 +0000 (03:30 -0500)
committerMitchell E Berger <mitchb@mit.edu>
Thu, 2 Jan 2020 08:30:26 +0000 (03:30 -0500)
    Buster is identical to Squeeze.
    Bionic requires significant reworking from the Xenial days:
    - The atomic partman-auto recipe ignores the boot partition
      when using LVM, and our pygrub can't read from LVM.  Switch
      to using an expert recipe that matches the atomic one in
      Debian Buster, but with Ubuntu's preferred sizes and filesystems.
    - The preseed value to avoid installing Grub2 instead of old Grub
      is no longer honored, and we can't handle it the way we do in
      Debian because grub-legacy doesn't exist in Ubuntu.  Instead,
      let it install Grub2 and then we'll install and use pv-grub-menu,
      which maintains a menu.lst from the parsed contents of grub.cfg.
    - pv-grub-menu contains a bug - it hardcodes "/boot" as the directory
      pygrub will expect to find kernels and initrds in; this is wrong
      when the system's /boot is on its own partition, and update-menu-lst
      doesn't provide configurable options either in its invocation, a
      parsed pre-existing menu.lst (where the root device and default
      kernel options can be persistently set in comments), or a config
      file.  However, it does source /etc/default/grub after it has set
      this hardcoded variable to "/boot".  We abuse /etc/default/grub
      to empty that variable back out.

code/static/preseed/bionic-amd64.preseed [new symlink]
code/static/preseed/bionic.preseed [new file with mode: 0644]
code/static/preseed/buster-amd64.preseed [new symlink]
code/static/preseed/buster.preseed [new file with mode: 0644]
debian/changelog

diff --git a/code/static/preseed/bionic-amd64.preseed b/code/static/preseed/bionic-amd64.preseed
new file mode 120000 (symlink)
index 0000000..710b852
--- /dev/null
@@ -0,0 +1 @@
+bionic.preseed
\ No newline at end of file
diff --git a/code/static/preseed/bionic.preseed b/code/static/preseed/bionic.preseed
new file mode 100644 (file)
index 0000000..7d10b1a
--- /dev/null
@@ -0,0 +1,79 @@
+# Download packages from mirrors.mit.edu
+d-i mirror/country string manual
+d-i mirror/http/countries string manual
+d-i mirror/http/hostname string mirrors.mit.edu
+d-i mirror/http/directory string /ubuntu/
+d-i mirror/http/proxy string 
+
+# Use time.mit.edu for NTP syncing
+d-i clock-setup/ntp-server string time.mit.edu
+
+# Guided partitioning with LVM
+d-i partman-auto/disk string /dev/xvda
+d-i partman-auto/method string lvm
+
+# The atomic recipe in Bionic ignores the boot partition when using the
+# lvm method; our pygrub can't read /boot on LVM, so we get to provide
+# an entire recipe.  This is the atomic recipe from Debian Buster,
+# modified to avoid name collision and to use Ubuntu's preferred sizes
+# and filesystem for /boot.
+d-i partman-auto/expert_recipe string \
+boot-root ::                          \
+                                      \
+1 1 1 free                            \
+ $iflabel{ gpt }                      \
+ $reusemethod{ }                      \
+ method{ biosgrub } .                 \
+                                      \
+512 1024 768 ext4                     \
+ $defaultignore{ }                    \
+ method{ format }                     \
+ format{ }                            \
+ use_filesystem{ }                    \
+ filesystem{ ext4 }                   \
+ mountpoint{ /boot } .                \
+                                      \
+900 10000 -1 $default_filesystem      \
+ $lvmok{ }                            \
+ method{ format }                     \
+ format{ }                            \
+ use_filesystem{ }                    \
+ $default_filesystem{ }               \
+ mountpoint{ / } .                    \
+                                      \
+100% 512 200% linux-swap              \
+ $lvmok{ }                            \
+ $reusemethod{ }                      \
+ method{ swap }                       \
+ format{ } .                          \
+
+d-i partman-lvm/device_remove_lvm boolean true
+d-i partman-lvm/confirm boolean true
+d-i partman-lvm/confirm_nooverwrite boolean true
+d-i partman/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+# Use the linux-virtual kernel
+d-i base-installer/kernel/image string linux-virtual
+
+# Create just a root account
+d-i passwd/root-login boolean true
+d-i passwd/root-password string fake_value
+d-i passwd/root-password-again string fake_value
+d-i passwd/make-user boolean false
+
+# Remove the root password so users can log in on the console
+# Our pygrub can't read grub2 configs, and grub-legacy isn't in
+# Ubuntu, but they've provided a tool to help
+d-i preseed/late_command string in-target passwd -d root; \
+    apt-install pv-grub-menu; \
+    echo "" >>/target/etc/default/grub ; \
+    echo "# Prevent update-menu-lst from prepending /boot to menu.lst kernels and initrds" >>/target/etc/default/grub ; \
+    echo "kernel_dir=" >>/target/etc/default/grub ; \
+    in-target sed -i -e 's/# groot=.*/# groot=(hd0,0)/' /boot/grub/menu.lst; \
+    in-target /usr/sbin/update-menu-lst
+
+# Avoid that last message about the install being complete.
+d-i finish-install/reboot_in_progress note
diff --git a/code/static/preseed/buster-amd64.preseed b/code/static/preseed/buster-amd64.preseed
new file mode 120000 (symlink)
index 0000000..717ac95
--- /dev/null
@@ -0,0 +1 @@
+buster.preseed
\ No newline at end of file
diff --git a/code/static/preseed/buster.preseed b/code/static/preseed/buster.preseed
new file mode 100644 (file)
index 0000000..e2c75df
--- /dev/null
@@ -0,0 +1,51 @@
+# Configure the "keyboard"
+d-i keyboard-configuration/xkb-keymap string us
+
+# Download packages from mirrors.mit.edu
+d-i mirror/country string manual
+d-i mirror/http/countries string manual
+d-i mirror/http/hostname string mirrors.mit.edu
+d-i mirror/http/directory string /debian/
+d-i mirror/http/proxy string 
+
+# Use time.mit.edu for NTP syncing
+d-i clock-setup/ntp-server string time.mit.edu
+
+# Guided partitioning with LVM
+d-i partman-auto/method string lvm
+d-i partman-auto/choose_recipe select atomic
+d-i partman-lvm/confirm boolean true
+d-i partman-lvm/confirm_nooverwrite boolean true
+d-i partman/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+# Use the linux-virtual kernel
+d-i base-installer/kernel/image string linux-virtual
+
+# Create just a root account
+d-i passwd/root-login boolean true
+d-i passwd/root-password string fake_value
+d-i passwd/root-password-again string fake_value
+d-i passwd/make-user boolean false
+
+# Only install the base system
+tasksel tasksel/first multiselect Standard system utilities
+
+# Use GRUB 1 so PyGrub can read the menu.lst
+d-i grub-installer/grub2_instead_of_grub_legacy boolean false
+# Unfortunately, squeeze's d-i doesn't honor the above key, so we have
+# to do it by hand:
+d-i grub-installer/skip boolean true
+d-i lilo-installer/skip boolean true
+
+# Remove the root password so users can log in on the console
+d-i preseed/late_command string in-target passwd -d root; \
+    apt-install grub-legacy; \
+    mkdir /target/boot/grub; \
+    in-target grub-set-default default; \
+    in-target update-grub
+
+# Avoid that last message about the install being complete.
+d-i finish-install/reboot_in_progress note
index 3c18b0f..e87bf0f 100644 (file)
@@ -1,3 +1,29 @@
+invirt-web (0.1.56) precise; urgency=medium
+
+  * Autoinstallers for Debian Buster and Ubuntu Bionic
+    Buster is identical to Squeeze.
+    Bionic requires significant reworking from the Xenial days:
+    - The atomic partman-auto recipe ignores the boot partition
+      when using LVM, and our pygrub can't read from LVM.  Switch
+      to using an expert recipe that matches the atomic one in
+      Debian Buster, but with Ubuntu's preferred sizes and filesystems.
+    - The preseed value to avoid installing Grub2 instead of old Grub
+      is no longer honored, and we can't handle it the way we do in
+      Debian because grub-legacy doesn't exist in Ubuntu.  Instead,
+      let it install Grub2 and then we'll install and use pv-grub-menu,
+      which maintains a menu.lst from the parsed contents of grub.cfg.
+    - pv-grub-menu contains a bug - it hardcodes "/boot" as the directory
+      pygrub will expect to find kernels and initrds in; this is wrong
+      when the system's /boot is on its own partition, and update-menu-lst
+      doesn't provide configurable options either in its invocation, a
+      parsed pre-existing menu.lst (where the root device and default
+      kernel options can be persistently set in comments), or a config
+      file.  However, it does source /etc/default/grub after it has set
+      this hardcoded variable to "/boot".  We abuse /etc/default/grub
+      to empty that variable back out.
+
+ -- Mitchell Berger <mitchb@mit.edu>  Thu, 02 Jan 2019 03:28:00 -0500
+
 invirt-web (0.1.55) precise; urgency=medium
 
   * Allow users to keep existing large disks while modifying machines