Ubuntu 20.04 server autoinstallation HowTo - gbl - 03-02-2021
Ventoy has a plugin to work with the debian autoinstaller. Unfortunately, Ubuntu 20 comes with a new auto install method (cloud-init), which works differently. At first, I wasn't able to get it to work with Ventoy, so I made an account to ask for help; in the time it took the account to get activated, I solved the problem however. So here's how to do it in case anyone else has the same problem.
A working auto installer needs two files, one `meta-data` and one `user-data`. These need to be on a partition that has `cidata` as the partition label.
These files can not be put into the same partition that has the iso files, because that partition is locked while the booted software is running.
So, to get it to work:
- When running Ventoy for the first time to install it on the USB drive, leave some space for a 3rd partition. On linux, that's `-r 16` to leave 16 MB at the end of the medium.
Code: ventoy-1.0.36/Ventoy2Disk.sh -I /dev/sdX -r 16
- Create a new partition on the medium
Code: fdisk /dev/sdX
n (new)
p (partition)
3 (partition number)
press return twice to confirm the sector numbers
t (type)
3 (partition number)
7 (vfat partition type)
w
- format it to vfat, and name it `cidata`.
Code: mkfs.vfat -n cidata /dev/sdX3
- copy the ubuntu installer iso to the first partition, and your user-data and meta-data to the third partition
More information about user-data is at https://ubuntu.com/server/docs/install/autoinstall. meta-data can be left empty unless you know what you're doing and want to have some version control for different configs.
RE: Ubuntu 20.04 server autoinstallation HowTo - Pizzathehutt - 01-05-2022
Under "Create a new partition on the medium"
The part that says "7 (vfat partition type)".
I guess you mean ExFAT here not vfat, because "7" is ExFAT in my fdisk version.
or do you mean the partition type "W95 FAT32 (LBA)" ?
I tried this with Ubuntu Server 21.10, but no luck.
Can you provide a working example user-data file?
RE: Ubuntu 20.04 server autoinstallation HowTo - liaoya - 01-14-2022
Use /var/log/installer/autoinstall-user-data according to https://ubuntu.com/server/docs/install/autoinstall. Please remove the following two lines
Code: kernel:
kernel: {package: linux-generic}
RE: Ubuntu 20.04 server autoinstallation HowTo - liaoya - 01-14-2022
Give a example
Code: #cloud-config (the real generated user-data config)
autoinstall:
apt:
geoip: true
preserve_sources_list: false
primary:
- arches: [amd64, i386]
uri: http://mirrors.ustc.edu.cn/ubuntu
- arches: [default]
uri: http://ports.ubuntu.com/ubuntu-ports
identity: {hostname: optiplex-3080, password: $6$Y6L.IeTT5Q2I5GyK$12vthGNN5n37COpgr.M6gnfa71VjbngbJixmfLqxm05l1SIM5j1s3UwK0QeJE4UdLcAO83DQMze.lZLThYUFk0,
realname: vagrant, username: vagrant}
interactive-sections:
- network
- storage
kernel:
kernel: {package: linux-generic}
keyboard: {layout: us, toggle: null, variant: ''}
locale: en_US.UTF-8
network:
ethernets:
enp2s0:
dhcp4: true
version: 2
wifis: {}
ssh:
allow-pw: true
authorized-keys: []
install-server: true
storage:
config:
- {ptable: gpt, serial: SAMSUNG MZVLW256HEHP-000L7_S35ENA1J872082, wwn: eui.002538b87103b701,
path: /dev/nvme0n1, wipe: superblock-recursive, preserve: false, name: '', grub_device: false,
type: disk, id: disk-nvme0n1}
- {device: disk-nvme0n1, size: 536870912, 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-nvme0n1, size: 255521193984, wipe: superblock, flag: '', number: 2,
preserve: false, grub_device: false, type: partition, id: partition-1}
- {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-1}
- {path: /, device: format-1, type: mount, id: mount-1}
- {path: /boot/efi, device: format-0, type: mount, id: mount-0}
updates: security
version: 1
RE: Ubuntu 20.04 server autoinstallation HowTo - longpanda - 02-04-2022
Ventoy 1.0.65 release with ubuntu server cloud-init support. You can make a try.
RE: Ubuntu 20.04 server autoinstallation HowTo - liaoya - 02-20-2022
Thank you, I have confirmed it works. I can paste a much complex version
Code: #cloud-config
autoinstall:
apt:
geoip: true
preserve_sources_list: false
primary:
- arches: [default]
uri: http://mirrors.ustc.edu.cn/ubuntu
early-commands:
# otherwise packer tries to connect and exceed max attempts
- systemctl stop ssh
interactive-sections:
- network
- storage
keyboard: {layout: us, toggle: null, variant: ''}
late-commands:
# never put "mkdir -p /etc/cloud && touch /etc/cloud/cloud-init.disabled" here
- echo "600g2" >/target/etc/hostname
- 'sed -i -e "s/dhcp4: false/dhcp4: true/" /target/etc/netplan/00-installer-config.yaml'
- rm -f /target/etc/systemd/system/snapd.service.d/snap_proxy.conf
- sed -i -e "/^GatewayPorts no$/d" /target/etc/ssh/sshd_config
- touch /target/etc/ssh/sshd_config.d/custom.conf
- echo "PermitRootLogin yes" >>/target/etc/ssh/sshd_config.d/custom.conf
- echo "GatewayPorts yes" >>/target/etc/ssh/sshd_config.d/custom.conf
locale: en_US.UTF-8
network:
bonds:
bond0:
dhcp4: false
interfaces:
- eno1
parameters:
mode: active-backup
ethernets:
eno1: {}
version: 2
wifis:
wlp1s0:
access-points:
XAP3007GC: {password: 1234567890}
dhcp4: true
refresh-installer: {update: no}
ssh:
allow-pw: true
authorized-keys: []
install-server: true
updates: security
user-data:
disable_root: false
power_state: {condition: true, delay: '+1', mode: poweroff}
runcmd:
- [mkdir, -p, /etc/cloud]
- [touch, /etc/cloud/cloud-init.disabled]
- [systemctl, enable, ssh]
users:
- name: vagrant
gecos: vagrant
primary_group: users
groups: [adm, cdrom, sudo, dip, plugdev, lxd]
lock_passwd: false
# The password is ubuntu
passwd: $6$55MZmOQiyc.l6/K2$vkC8y.YECFHz9lRI/wq8ZPkfU/2DFxjYygWIn8XVFWEsUOr.nfbpGDVDiS/wt07dIaRV//5XAxH1JVYU99TDs/
shell: /bin/bash
ssh_authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
sudo: ALL=(ALL) NOPASSWD:ALL
version: 1
|