Auto-installation of Ubuntu Focal Fossa via ubuntu-20.04.3-live-server-amd64.iso
. Here is my user-data
file:
#cloud-config
autoinstall:
version: 1
locale: en_US.UTF-8
keyboard:
layout: fr
variant: ""
proxy: http://aptproxy.virt.priv:3142
apt:
preserve_sources_list: false
primary:
- arches: [amd64]
uri: "http://archive.ubuntu.com/ubuntu"
geoip: false
network:
network:
version: 2
ethernets:
enp0s3:
dhcp4: true
storage:
layout:
name: direct
swap:
size: 1G
config:
- id: disk_system
type: disk
ptable: gpt
path: /dev/sda
wipe: superblock
preserve: false
name: disk_system
- id: partition_system
type: partition
number: 1
device: disk_system
size: 100%
wipe: superblock
preserve: false
name: partition_system
- id: fs_system
type: format
fstype: ext4
preserve: false
#extra_options: []
volume: partition_system
label: fs_system
- id: mount_system
type: mount
path: /
device: fs_system
options: "noatime,errors=remount-ro"
identity:
hostname: focal-vbox
realname: packer
username: packer
password: $6$e70e7d9a7b031659$ID9RRN/tqPeis32k3GEsXluR1FNIR5RuyhVdJfZXUZ/H2de6p3D4sIChX8YCdOOfRIpCVWkDQBadBNjr7Y3Yn1
ssh:
install-server: yes
user-data:
#disable_root: false
timezone: "Europe/Paris"
late-commands:
- curtin in-target --target=/target -- sh -c 'printf "root:root\n" | chpasswd'
- sed -i -r 's/^#?PermitRootLogin .*$/PermitRootLogin yes/' /target/etc/ssh/sshd_config
- curl --noproxy '*' -sq http://10.111.222.1:8080/http/postinstall.sh -o /target/root/postinstall.sh
My user-data
is well downloaded by the installer, because I have this during the installation session:
ubuntu-server@ubuntu-server:~$ sudo cat /autoinstall.yaml
---
apt:
geoip: false
preserve_sources_list: false
primary:
- arches:
- amd64
uri: http://archive.ubuntu.com/ubuntu
identity:
hostname: focal-vbox
password: $6$e70e7d9a7b031659$ID9RRN/tqPeis32k3GEsXluR1FNIR5RuyhVdJfZXUZ/H2de6p3D4sIChX8YCdOOfRIpCVWkDQBadBNjr7Y3Yn1
realname: packer
username: packer
keyboard:
layout: fr
variant: ''
late-commands:
- curtin in-target --target=/target -- sh -c 'printf "root:root\n" | chpasswd'
- sed -i -r 's/^#?PermitRootLogin .*$/PermitRootLogin yes/' /target/etc/ssh/sshd_config
- curl --noproxy '*' -sq http://10.111.222.1:8080/http/postinstall.sh -o /target/root/postinstall.sh
locale: en_US.UTF-8
network:
network:
ethernets:
enp0s3:
dhcp4: true
version: 2
proxy: http://aptproxy.virt.priv:3142
ssh:
install-server: true
storage:
config:
- id: disk_system
name: disk_system
path: /dev/sda
preserve: false
ptable: gpt
type: disk
wipe: superblock
- device: disk_system
id: partition_system
name: partition_system
number: 1
preserve: false
size: 100%
type: partition
wipe: superblock
- fstype: ext4
id: fs_system
label: fs_system
preserve: false
type: format
volume: partition_system
- device: fs_system
id: mount_system
options: noatime,errors=remount-ro
path: /
type: mount
layout:
name: direct
swap:
size: 1G
user-data:
timezone: Europe/Paris
version: 1
...
But the storage
part seems to not be well used by curtin. Indeed, after the installation, here the file /var/log/installer/autoinstall-user-data
:
root@focal-vbox:~# cat /var/log/installer/autoinstall-user-data
#cloud-config
autoinstall:
apt:
geoip: false
preserve_sources_list: false
primary:
- arches: [amd64]
uri: http://archive.ubuntu.com/ubuntu
identity: {hostname: focal-vbox, password: $6$e70e7d9a7b031659$ID9RRN/tqPeis32k3GEsXluR1FNIR5RuyhVdJfZXUZ/H2de6p3D4sIChX8YCdOOfRIpCVWkDQBadBNjr7Y3Yn1,
realname: packer, username: packer}
kernel:
kernel: {package: linux-generic}
keyboard: {layout: fr, toggle: null, variant: ''}
locale: en_US.UTF-8
network:
ethernets:
enp0s3: {dhcp4: true}
version: 2
proxy: http://aptproxy.virt.priv:3142
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
config:
- {ptable: gpt, serial: VBOX_HARDDISK_VB6fee8d0c-40f4e9bf, path: /dev/sda, wipe: superblock-recursive,
preserve: false, name: '', grub_device: true, type: disk, id: disk-sda}
- {device: disk-sda, size: 1048576, flag: bios_grub, number: 1, preserve: false,
type: partition, id: partition-0}
- {device: disk-sda, size: 5365563392, wipe: superblock, flag: '', number: 2,
preserve: false, type: partition, id: partition-1}
- {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-0}
- {path: /, device: format-0, type: mount, id: mount-0}
updates: security
user-data: {timezone: Europe/Paris}
version: 1
As you can see, the storage
has changed. So, for instance:
- the size of the swap is wrong
- no
noatime
mount option.
root@focal-vbox:~# ls -lh /swap.img
-rw------- 1 root root 730M Oct 8 17:19 /swap.img
root@focal-vbox:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/a68b0bb7-9530-4229-98a1-ebabbc46972e / ext4 defaults 0 1
/swap.img none swap sw 0 0
Another example.
The
/autoinstall.yaml
file during the installation with 1 partition/
and 1 partition/var/log/
:The file
/target/var/log/installer/curtin-install-cfg.yaml
during the installation. The/var/log/
partition and mountpoint have been removed: