From ace10d59d0d69ef4585e575c020331cbb2276e67 Mon Sep 17 00:00:00 2001 From: Brian Candler Date: Sat, 14 May 2016 13:37:55 +0000 Subject: [PATCH] Partitioning for zfs. Include libvirt xml. --- README.md | 38 +++++++++++++++++++++++++++++++++- preseed.cfg | 32 +++++++++++++++++++++------- vtp-libvirt.xml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 9 deletions(-) create mode 100644 vtp-libvirt.xml diff --git a/README.md b/README.md index 31ec8fa..59d752a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ The VTP virtual machine is built using a scripted install process. This results in an image which can be distributed to trainers and either run on their local hardware or in a third-party cloud. +The final flow is expected to be something like this: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | v @@ -63,7 +65,7 @@ level of this repo and unzip it. Then run using: * `-only=qemu` is if there are multiple [builders](https://www.packer.io/docs/templates/builders.html) defined and you only want to run one. For example, in future we could include - configs for building images on EC2 and GCE) + additional builders for EC2 and GCE. * `-var headless=true` is required if you are running on a system with no graphics (e.g. ssh to remote box without -X for X11 forwarding) @@ -137,6 +139,40 @@ The kickstart files are simpler and can be created using [system-config-kickstart](http://packages.ubuntu.com/xenial/system-config-kickstart) on an Ubuntu 16.04 desktop machine. However the Ubuntu kickstart implementation offers only a subset of features and is really just a frontend to selected preseed variables. +Hence we are using preseeding directly. + +## Preseeding + +If a question pops up during the installation, answer it manually to allow +the installation to continue. Then when you have booted into the system, +run: + + debconf-get-selections --installer >installer.log + +(from package `debconf-utils`) to find the preseed option name; then you can +update preseed.cfg to answer the question automatically. + +Example: after adding the empty zfs partition, I got the following dialog: + +~~~ + [!!] Partition disks + +No file system is specified for partition #3 of Virtual disk 1 (vda). + +If you do not go back to the partitioning menu and assign a file +system to this partition, it won't be used at all. + +Go back to the menu? +~~~ + +The desired behaviour is to enter ``. This one actually required going +through the debian-installer [source code](https://wiki.debian.org/DebianInstaller/CheckOut) to find: + +~~~ +d-i partman-basicmethods/method_only boolean false +~~~ + +## Filesystems Installing Ubuntu with zfs root filesystem is not yet supported by the installer: [1](https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Ubuntu-16.04-to-a-Native-ZFS-Root-Filesystem) diff --git a/preseed.cfg b/preseed.cfg index a2e611e..6bf5aa0 100644 --- a/preseed.cfg +++ b/preseed.cfg @@ -2,6 +2,7 @@ # https://github.com/puppetlabs/puppetlabs-packer/blob/master/templates/ubuntu-16.04/files/preseed.cfg # https://help.ubuntu.com/lts/installation-guide/example-preseed.txt # https://help.ubuntu.com/lts/installation-guide/amd64/apb.html +# /usr/share/doc/debian-installer/devel/partman-auto-recipe.txt.gz choose-mirror-bin mirror/http/proxy string #d-i base-installer/kernel/override-image string linux-virtual @@ -14,22 +15,37 @@ d-i finish-install/reboot_in_progress note d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i grub-installer/bootdev string /dev/vda -d-i partman-auto-lvm/guided_size string max -d-i partman-auto/choose_recipe select atomic -d-i partman-auto/method string lvm -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true -d-i partman-lvm/device_remove_lvm boolean true +d-i partman-auto/disk string /dev/vda +d-i partman-auto/expert_recipe string \ + root-swap-zfs :: \ + 10000 10000 10000 ext3 \ + $primary{ } $bootable{ } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1000 1000 1000 linux-swap \ + $primary{ } \ + method{ swap } format{ } \ + . \ + 4000 4000 1000000000 zfs \ + $primary{ } \ + method{ keep } \ + . + +d-i partman-auto/choose_recipe select root-swap-zfs +d-i partman-auto/method string regular d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i partman/confirm_write_new_label boolean true +d-i partman-basicmethods/method_only boolean false d-i passwd/root-login boolean true d-i passwd/root-password password nsrc d-i passwd/root-password-again password nsrc d-i passwd/make-user boolean false d-i user-setup/allow-password-weak boolean true -d-i pkgsel/include string python ntp +d-i pkgsel/include string python ntp zfsutils-linux lxd d-i pkgsel/install-language-support boolean false d-i pkgsel/update-policy select none d-i pkgsel/upgrade select full-upgrade @@ -39,5 +55,5 @@ d-i preseed/late_command string \ sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1\"\"/g' /target/etc/default/grub; \ in-target bash -c 'update-grub2'; \ in-target sed -i 's/PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config ; \ -in-target apt-get -y upgrade +in-target apt-get -y upgrade ; \ in-target apt-get clean diff --git a/vtp-libvirt.xml b/vtp-libvirt.xml new file mode 100644 index 0000000..0187e63 --- /dev/null +++ b/vtp-libvirt.xml @@ -0,0 +1,55 @@ + + + vtp + 15728640 + 15728640 + 8 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/kvm + + + + +
+ + +
+ + + + + + +
+ + + + + + + + + + + + +