Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bearice
Created August 8, 2019 07:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bearice/331a954d86d890d9dbeacdd7de3aabe8 to your computer and use it in GitHub Desktop.
Save bearice/331a954d86d890d9dbeacdd7de3aabe8 to your computer and use it in GitHub Desktop.
ubuntu preseed file for EFI booted software RAID1 rootfs
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US.UTF-8
# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
### Network configuration
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto
# Just in case our DHCP server is busy.
d-i netcfg/dhcp_timeout string 60
# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string ubuntu
d-i netcfg/get_domain string local
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# Added by @analytically: always install the server kernel
#d-i base-installer/kernel/override-image string linux-server
### Mirror settings
# Alternatively: by default, the installer uses CC.archive.ubuntu.com where
# CC is the ISO-3166-2 code for the selected country. You can preseed this
# so that it does so without asking.
d-i mirror/http/mirror select jp.archive.ubuntu.com
d-i mirror/http/proxy string
### Clock and time zone setup
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Asia/Shanghai
# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
### Partitioning
d-i partman/unmount_active boolean true
#----------------------------------------------------------------------#
# Partitioning
d-i partman/early_command string \
umount /media ; \
mdadm --stop /dev/md0 ; \
mdadm --remove /dev/md0 ; \
mdadm --stop /dev/md127 ; \
mdadm --remove /dev/md127 ; \
mdadm --zero-superblock /dev/sda2 ; \
mdadm --zero-superblock /dev/sdb2 ; \
dd if=/dev/zero of=/dev/sda2 bs=1M count=10 ; \
dd if=/dev/zero of=/dev/sda2 bs=1M count=10 ; \
dd if=/dev/zero of=/dev/sda bs=1M count=10 ; \
dd if=/dev/zero of=/dev/sdb bs=1M count=10 ; \
echo 1 > /sys/block/sda/device/rescan ; \
echo 1 > /sys/block/sdb/device/rescan ; \
ls -C /dev; \
sleep 5; \
exit 0; \
# this only makes partman automatically partition without confirmation:
d-i partman-partitionining/confirm_write_new_label boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman-md/confirm boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i mdadm/boot_degraded boolean true
d-i partman-auto/method string raid
d-i partman-auto/disk string /dev/sda /dev/sdb
d-i partman-auto/expert_recipe string multiraid :: \
256 512 512 free $bootable{ } method{ efi } format{ } . \
1024 10000 -1 raid method{ raid } . \
256 512 200% linux-swap method{ swap } format{ } .
# specify how the previously defined partitions will be
# used in the RAID setup.
d-i partman-auto-raid/recipe string \
1 2 0 ext4 / /dev/sda2#/dev/sdb2 .
d-i partman/choose_partition select Finish partitioning and write changes to disk
d-i partman-efi/non_efi_system boolean true
# Partitioning
#----------------------------------------------------------------------#
### Base system installation
### Account setup
# To create a normal user account.
d-i passwd/user-fullname string ubuntu
d-i passwd/username string ubuntu
d-i passwd/user-password password ubuntu
d-i passwd/user-password-again password ubuntu
#d-i passwd/user-password-crypted password HASHHERE
# The installer will warn about weak passwords. If you are sure you know
# what you're doing and want to override it, uncomment this.
d-i user-setup/allow-password-weak boolean true
# Set to true if you want to encrypt the first user's home directory.
d-i user-setup/encrypt-home boolean false
### Apt setup
# You can choose to install restricted and universe software, or to install
# software from the backports repository.
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/backports boolean true
# Uncomment this if you don't want to use a network mirror.
#d-i apt-setup/use_mirror boolean false
# Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
#d-i apt-setup/services-select multiselect security
#d-i apt-setup/security_host string security.ubuntu.com
#d-i apt-setup/security_path string /ubuntu
# Additional repositories, local[0-9] available
#d-i apt-setup/local0/repository string \
# http://local.server/ubuntu squeeze main
#d-i apt-setup/local0/comment string local server
# Enable deb-src lines
#d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
#d-i apt-setup/local0/key string http://local.server/key
d-i base-installer/kernel/altmeta string hwe-16.04
### Package selection
#tasksel tasksel/force-tasks string server
tasksel tasksel/first multiselect standard
# Individual additional packages to install
d-i pkgsel/include string openssh-server python
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select full-upgrade
# Language pack selection
d-i pkgsel/language-packs multiselect en
# No language support packages
d-i pkgsel/install-language-support boolean false
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select unattended-upgrades
# Verbose output and no boot splash screen
d-i debian-installer/quiet boolean false
d-i debian-installer/splash boolean false
### Boot loader installation
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the MBR if it also finds some other
# OS, which is less safe as it might not be able to boot that other OS.
d-i grub-installer/with_other_os boolean true
# Wait for two seconds in grub
d-i grub-installer/timeout string 0
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
d-i debian-installer/add-kernel-opts string console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 vga=normal nomodeset intel_idle.max_cstate=0 processor.max_cstate=1 cgroup_enable=memory swapaccount=1 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off
### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment