It's an automated system install and image-creation tool for situations where provisioning machines via a PXE server is not an option, or is not an option yet. It's ideal for small-scale greenfielding, proofs-of-concept, and general management of on-prem compute infrastructure in a cloud-native way without the cloud. PXEless is based on covertsh/ubuntu-autoinstall-generator, and generates a customized Ubuntu…
It’s an automated system install and image-creation tool for situations where provisioning machines via a PXE server is not an option, or is not an option yet. It’s ideal for small-scale greenfielding, proofs-of-concept, and general management of on-prem compute infrastructure in a cloud-native way without the cloud.
Downloading the ISO of your choice - a daily build, or a release.
Extracting the EFI, MBR, and File-System from the ISO
Adding some kernel command line parameters
Adding customised autoinstall and cloud-init configuration files
Copying arbitrary files to / running scripts against the squashfs (Optional)
Repacking the data into a new ISO.
The resulting product is a fully-automated Ubuntu installer. This serves as an easy stepping-off point for configuration-management tooling like Ansible, Puppet, and Chef or personalization tools like jessebot/onboardme. Please note that while similar in schema, the Autoinstall and Cloud-Init portions of the user-data file do not mix. The user-data key marks the transition from autoinstall to cloud-init syntax as seen HERE
Application Flow
Docker Quickstart
It is advised to run PXEless in a docker container due to it’s reliance on Linux-only packages.
Skip 1 and 2 if you already have a cloud-init file
Take note that we do not specify a user here. Adding extra files to the ISO via
the -x or --extra-files flag requires root access in order to chroot the squashfs.
The contents of the extras directory will be copied to the /media dir of the image’s filesystem. The extra-files are mounted as /data/<directory> when running in a docker conatiner because we mount $(pwd) as /data/
Running an offline installer script to customize image during build procedure. Adding a bash script as content of the extras directory. The script should be passed to image-create using -o or --offline-installer.
# /dev/sdb is assumed for the sake of the example
export IMAGE_FILE="ubuntu-autoinstall.iso"
sudo fdisk -l |grep "Disk /dev/"
export DISK_NAME="/dev/sdb"
sudo umount "$DISK_NAME"
sudo dd bs=4M if=$IMAGE_FILE of="$DISK_NAME" status=progress oflag=sync
Boot your ISO file on a physical machine for VM and log-in. If you used my user-data.basic file the user is vmadmin, and the password is password. You can create your own credentials by running mkpasswd --method=SHA-512 --rounds=4096 as documented on THIS page at line 49.
Command-line options
Short
Long
Description
-h
–help
Print this help and exit
-v
–verbose
Print script debug info
-n
–code-name
The Code Name of the Ubuntu release to download (bionic, focal, jammy etc…)
-a
–all-in-one
Bake user-data and meta-data into the generated ISO. By default you will need to boot systems with a CIDATA volume attached containing your autoinstall user-data and meta-data files. For more information see: https://ubuntu.com/server/docs/install/autoinstall-quickstart
-e
–use-hwe-kernel
Force the generated ISO to boot using the hardware enablement (HWE) kernel. Not supported by early Ubuntu 20.04 release ISOs.
-u
–user-data
Path to user-data file. Required if using -a
-m
–meta-data
Path to meta-data file. Will be an empty file if not specified and using the -a flag. You may read more about providing a meta-data file HERE
-x
–extra-files
Specifies a folder with files and folders, which will be copied into the root of the iso image. If not set, nothing is copied. Requires use of --privileged flag when running in docker
-k
–no-verify
Disable GPG verification of the source ISO file. By default SHA256SUMS- and SHA256SUMS-.gpg files in the script directory will be used to verify the authenticity and integrity of the source ISO file. If they are not present the latest daily SHA256SUMS will be downloaded and saved in the script directory. The Ubuntu signing key will be downloaded and saved in a new keyring in the script directory.
-o
–offline-installer
Run a bash script to customize image, including install packages and configuration. It should be used with -x, and the bash script should be avilable in the same extras directory.
-r
–use-release-iso
Use the current release ISO instead of the daily ISO. The file will be used if it already exists.
-s
–source
Source ISO file. By default the latest daily ISO for Ubuntu 20.04 will be downloaded and saved as script directory/ubuntu-original-current date.iso That file will be used by default if it already exists.
-t
–timeout
Set the GRUB timeout. Defaults to 30.
-d
–destination
Destination ISO file. By default script directory/ubuntu-autoinstall-current date.iso will be created, overwriting any existing file.
Sources
This project is made possible through the open-source work of the following authors and many others. Thank you all for sharing your time, effort, and knowledge freely with us. You are the giants upon whos shoulders we stand. :heart:
PXEless currently only supports creating ISO’s using Ubuntu Server (Focal and Jammy). Users who’s needs ae not met by PXEless may find these other FOSS projects useful:
A partition or disk clone tool similar to Norton Ghost®. It saves and restores only used blocks in hard drive. Two types of Clonezilla are available, Clonezilla live and Clonezilla SE (Server Edition)
Testing your ISO with QEMU
Click to expand
You will need to have a VNC client (tigerVNC or Remmina etc…) installed as well as the following packages:
Select “Try or install Ubuntu” from the grub pop-up
Connect to the VM using VNC so we can watch the grub process run.
After the install process completes and the VM reboots, select the “Boot from next volume” grub option to prevent installing again
I was then able to log into he machine using vmadmin and password for the credentials
Finally i tried to SSH to the machine (since the vm I created is using SLIRP networking I have to reach it via a forwarded port)
The most common issues I run into with this process are improperly formatted yaml in the user-data file, and errors in the process of burning the ISO to a USB drive.
In those cases, the machine will perform a partial install but instead of seeing pxeless login: as the machine name at login it will still say ubuntu login:.
评论