In VirtualBox 7.2.6, I tested two types of user data, but neither could achieve automated installation.
I want to reinstall the computer,Fix the user-data configuration.Thanks
client:
[root@client~]# lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
cl-root 253:0 0 70G 0 lvm /
cl-swap 253:1 0 4G 0 lvm
cl-home 253:2 0 1.8T 0 lvm /home
nvme0n1 259:0 0 1.9T 0 disk
nvme0n1p1 259:1 0 600M 0 part /boot/efi
nvme0n1p2 259:2 0 1G 0 part /boot
nvme0n1p3 259:3 0 1.9T 0 part
server:
[root@server autoinstall]# lsblk -l
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 3.1G 0 loop /mnt
sda 8:0 0 101.9T 0 disk /data/user
sdb 8:16 0 931G 0 disk /data/software
nvme1n1 259:0 0 3.7T 0 disk /data/scratch
nvme0n1 259:1 0 931.5G 0 disk
nvme0n1p1 259:2 0 500M 0 part /boot/efi
nvme0n1p2 259:3 0 1G 0 part /boot
nvme0n1p3 259:4 0 800G 0 part /
nvme0n1p4 259:5 0 120G 0 part /home
nvme0n1p5 259:6 0 8G 0 part [SWAP]
nvme0n1p6 259:7 0 2G 0 part /var
There are two errors:
1.autoinstall config did not create needed bootloader partition.
2. The late-commands command line cannot run
No solution found for this URL
https://canonical-subiquity.readthedocs-hosted.com/en/latest/reference/autoinstall-reference.html
user-data:1
#cloud-config
autoinstall:
version: 1
locale: en_US.UTF-8
keyboard:
layout: us
timezone: Asia/Shanghai
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: false
addresses: [192.168.2.195/24]
nameservers:
addresses: [192.168.2.1, 8.8.8.8]
routes:
- to: default
via: 192.168.2.1
identity:
hostname: ubuntu-server
username: lsfadmin
password: "$6$B7N1ffIZunV7qDMK$OxzPxHhc46Xq19p92v8/sy35MkxvVzVarpDRqD7lM0ifS.yBHrR91yEMSsDd8dkARB3xA7LR8L6OurjY7Qn421"
realname: "lsfadmin"
ssh:
install-server: true
allow-pw: true
bootloader:
type: uefi
install: true
target: /dev/sda
efi_partition: efi-fs
grub:
reorder_uefi: false
update_grub: true
storage:
config:
# 1.
- type: disk
id: disk0
path: /dev/sda
ptable: gpt
wipe: superblock-recursive
# 2. EFI
- type: partition
id: efi-part
device: disk0
size: 512MB
number: 1
flags: [boot, esp]
wipe: superblock
preserve: false
- type: format
id: efi-fs
fstype: vfat
volume: efi-part
preserve: false
- type: mount
id: efi-mount
device: efi-fs
path: /boot/efi
preserve: false
# 3. /boot
- type: partition
id: boot-part
device: disk0
size: 1GB
number: 2
wipe: superblock
preserve: false
- type: format
id: boot-fs
fstype: ext4
volume: boot-part
preserve: false
- type: mount
id: boot-mount
device: boot-fs
path: /boot
preserve: false
# 4. LVM
- type: partition
id: lvm-part
device: disk0
size: -1
number: 3
wipe: superblock
flags: [lvm]
preserve: false
# 5. LVM
- type: lvm_volgroup
id: vg0
name: vg0
devices: [lvm-part]
preserve: false
# 6. root
- type: lvm_partition
id: lv-root
volgroup: vg0
size: 10G
name: lv_root
preserve: false
- type: format
id: root-fs
fstype: ext4
volume: lv-root
preserve: false
- type: mount
id: root-mount
device: root-fs
path: /
preserve: false
# 7. swap
- type: lvm_partition
id: lv-swap
volgroup: vg0
size: 2G
name: lv_swap
preserve: false
- type: format
id: swap-fs
fstype: swap
volume: lv-swap
preserve: false
- type: swap
id: swap-mount
device: swap-fs
preserve: false
# 8. /home
- type: lvm_partition
id: lv-home
volgroup: vg0
size: 5G
name: lv_home
preserve: false
- type: format
id: home-fs
fstype: ext4
volume: lv-home
preserve: false
- type: mount
id: home-mount
device: home-fs
path: /home
preserve: false
# 9. /tmp
- type: lvm_partition
id: lv-tmp
volgroup: vg0
size: 2G
name: lv_tmp
preserve: false
- type: format
id: tmp-fs
fstype: ext4
volume: lv-tmp
preserve: false
- type: mount
id: tmp-mount
device: tmp-fs
path: /tmp
options: "defaults,noatime,nosuid,nodev"
preserve: false
# 10. /var
- type: lvm_partition
id: lv-var
volgroup: vg0
size: -1
name: lv_var
preserve: false
- type: format
id: var-fs
fstype: ext4
volume: lv-var
preserve: false
- type: mount
id: var-mount
device: var-fs
path: /var
preserve: false
packages:
- openssh-server
- lvm2
- htop
- unzip
- curl
late-commands:
- echo "Autoinstall completed on $(date)" >> /target/root/install.log
- curtin in-target --target=/target -- systemctl disable --now ufw
- echo '%lsfadmin ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/lsfadmin
- curtin in-target --target=/target -- bash -c "echo 'lsfadmin:Test@2026123456' | chpasswd"
- curtin in-target --target=/target -- sed -i 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config
- curtin in-target --target=/target -- sed -i 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config
- curtin in-target --target=/target -- systemctl enable ssh
- curtin in-target --target=/target -- bash -c 'IP=$(ip -4 addr show enp0s3 2>/dev/null | grep -oP "(?<=inet\s)\d+(\.\d+){3}") && LAST_OCTET=${IP##*.} && HOSTNAME="cn${LAST_OCTET}" && echo "$HOSTNAME" > /target/etc/hostname && sed -i "s/ubuntu-server/$HOSTNAME/g" /target/etc/hosts || true'
updates: security
shutdown: reboot
user-data:2
storage:
grub:
reorder_uefi: False
uefi: true
swap:
size: 0
config:
- { id: disk-sda, type: disk, ptable: gpt, path: /dev/sda, wipe: superblock, name: disk-sda }
- { id: sda-efi, type: partition, device: disk-sda, number: 1, size: 512MB, wipe: superblock, flag: [ boot, esp ] }
- { id: sda-boot, type: partition, device: disk-sda, number: 2, size: 1GB, wipe: superblock }
- { id: sda-lvm, type: partition, device: disk-sda, number: 3, size: -1, wipe: superblock }
- { id: dm_crypt-0, type: dm_crypt, volume: sda-lvm, dm_name: crypt-lvm, key: random }
- { id: vg00, type: lvm_volgroup, name: vg00, devices: [ dm_crypt-0 ] }
- { id: lvroot, type: lvm_partition, volgroup: vg00, name: lvroot, size: 10G }
- { id: lvswap, type: lvm_partition, volgroup: vg00, name: lvswap, size: 1G }
- { id: lvhome, type: lvm_partition, volgroup: vg00, name: lvhome, size: 1G }
- { id: lvtmp, type: lvm_partition, volgroup: vg00, name: lvtmp, size: 1G }
- { id: lvvar, type: lvm_partition, volgroup: vg00, name: lvvar, size: -1 }
- { id: sda-efi-fs, type: format, volume: sda-efi, fstype: fat32 }
- { id: sda-boot-fs, type: format, volume: sda-boot, fstype: ext4 }
- { id: lv-root-fs, type: format, volume: lvroot, fstype: ext4 }
- { id: lv-swap-fs, type: format, volume: lvswap, fstype: swap }
- { id: lv-home-fs, type: format, volume: lvhome, fstype: ext4 }
- { id: lv-tmp-fs, type: format, volume: lvtmp, fstype: ext4 }
- { id: lv-var-fs, type: format, volume: lvvar, fstype: ext4 }
- { id: m-efi, type: mount, device: sda-efi-fs, path: /boot/efi }
- { id: m-boot, type: mount, device: sda-boot-fs, path: /boot }
- { id: m-root, type: mount, device: lv-root-fs, path: / }
- { id: m-home, type: mount, device: lv-home-fs, path: /home }
- { id: m-tmp, type: mount, device: lv-tmp-fs, path: /tmp }
- { id: m-var, type: mount, device: lv-var-fs, path: /var }



