I have read through the curtin and autoinstall documentation and can't wrap my head around why this autoinstall script is working on my development laptop but not my vbox install (ver 7.0.8 on Ubuntu host). At first I thought the problem was references to /dev/mmcblk0
(virtualbox uses /dev/sda
) but after making a number of different configs I don't think this is actually the problem because of the error message this gives. The is autoinstall config did not create needed bootloader partition
My theory is that this autoinstall works on the laptop because the laptop is UEFI but not on Virtualbox because it is not. I have found some suggestions elsewhere on how to make an autoinstall that works for UEFI work on MBR, but none that are able to do both.
Is that the problem with this autoinstall partitioning layout? Is there any solution? I can't use the built-in layouts (lvm etc) due to this project's specific requirements. I realize I could change the Virtualbox settings to EFI boot, but this ISO will have to be installed on a wide variety of machines some of which may not support EFI.
Here is my current partitioning layout, which is working on a laptop with a device at /dev/mmcblk0
How does this script need to be modified to work on any system? And yes, the /boot partition really does need to be that large for this setup.
autoinstall:
version: 1
storage:
config:
- ptable: gpt
wipe: superblock-recursive
preserve: false
name: ''
grub_device: false
type: disk
id: disk-mmcblk0
match:
size: largest
- device: disk-mmcblk0
size: 1127219200
wipe: superblock
flag: boot
number: 1
preserve: false
grub_device: true
type: partition
id: partition-0
- fstype: fat32
volume: partition-0
preserve: false
type: format
id: format-0
- device: disk-mmcblk0
size: 5GB
wipe: superblock
number: 2
preserve: false
type: partition
id: partition-1
- fstype: ext4
volume: partition-1
preserve: false
type: format
id: format-1
- device: disk-mmcblk0
size: -1
wipe: superblock
number: 3
preserve: false
type: partition
id: partition-2
- volume: partition-2
key: password
path: /dev/mapper/dm_crypt-0
preserve: false
type: dm_crypt
id: dm_crypt-0
- name: ubuntu-vg
devices:
- dm_crypt-0
preserve: false
type: lvm_volgroup
id: lvm_volgroup-0
- name: ubuntu-lv
volgroup: lvm_volgroup-0
size: -1
wipe: superblock
preserve: false
path: /dev/ubuntu-vg/ubuntu-lv
type: lvm_partition
id: lvm_partition-0
- fstype: btrfs
volume: lvm_partition-0
preserve: false
type: format
id: format-2
- path: /
device: format-2
type: mount
id: mount-2
options: 'noatime,discard,compress=zstd:1'
- path: /boot
device: format-1
type: mount
id: mount-1
- path: /boot/efi
device: format-0
type: mount
id: mount-0
As @AndrewLowther pointed out in the answer his comment points to:
So you have two options:
user-data
with the workaround Andrew suggesteduser-data
files. One for BIOS and one for UEFII'll outline the first option below, which is what you want. This means it'll work for either a BIOS or UEFI computer.
First off, your
user-data
file supplied is missing#cloud-config
as the first line as well as theidentity
section. Both are required, so I added them in the example below. Theidentity
section is defined with a default username ofubuntu
and password ofubuntu
. Furthermore, the encrypted drive is configured with a password ofubuntu
. Change accordingly.There are several things with the
user-data
file below that are different than yours.grub_device: true
is set for the disk instead ofgrub_device: false
A small un-formatted partition with
flag: bios_grub
is added.From the curtin documentation regarding
bios_grub
:grub_device: false
is set for all partitions with the exception of the ESP partition used by an UEFI installion. For this partition,grub_device: UEFI
is set instead. This is really just a place-holder at the moment and will be edited withearly-commands
, as outlined next.The use of
early-commands
in theuser-data
file will modify theautoinstall.yaml
file based on whether the computer is UEFI or BIOS. This will modify thegrub_device: UEFI
setting defined above.Take a look at the following:
What this is doing is editing the
autoinstall.yaml
file based on a conditional. From what I understand, theautoinstall.yaml
file is created during the installation and resides in the root directory of the Live Installation. This is a combination of youruser-data
file and the default autoinstall unanswered/unconfigured questions that the installer fills in.This checks if the file
/sys/firmware/efi
exists:if [ -e "/sys/firmware/efi" ]; then
If true:
Indicates the system is UEFI
Replaces
grub_device: UEFI
withgrub_device: true
usingsed
:sed -i -e "s/grub_device: UEFI/grub_device: true/" /autoinstall.yaml
Otherwise:
Indicates the system is BIOS
Replaces
grub_device: UEFI
withgrub_device: false
usingsed
:sed -i -e "s/grub_device: UEFI/grub_device: false/" /autoinstall.yaml
And that's it. After the
early-commands
are run, the installation will continue.Here's the complete
user-data
file:If you install on both a UEFI and BIOS computer and then compare, you'll notice that the partition scheme will be the same. The UEFI installation will have an unused
bios_grub
partition, and the BIOS installation will have an unused ESP partition mounted at/boot/efi
. The/boot/efi
will be empty in a BIOS installation and will have files in an UEFI installation.The following installations were done with ISO: ubuntu-22.04.3-live-server-amd64.iso. This was unpacked with the above
user-data
file added to/nocloud
and then re-packed.EFI installation:
BIOS installation: