Try Fedora 44

Cover Image for Try Fedora 44
Tomas
Tomas

The first article on this site installed Fedora 32 on a virtual machine without a single prompt. This is the same idea on Fedora 44: a kickstart file describes the install, one virt-install command runs it, and the machine comes up ready to log in. A few things have changed since 2020, mostly for the better, and they're noted along the way.

This VM, f44-min, is also where the rest of the series starts, so it's worth getting right.

What you need

A Fedora machine with KVM. The virtualization group brings virt-install, libvirt, QEMU and passt:

$ sudo dnf install @virtualization

Everything below runs as a normal user, against your own libvirt session (qemu:///session). No root, no system-wide network setup.

The kickstart file

A kickstart file answers every question the installer would otherwise ask. This one installs a minimal Fedora 44:

#version=DEVEL

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'

# Use text mode install
text

# System language
lang en_US.UTF-8

# System timezone
timezone UTC --utc

# Network information
network  --hostname=fedora-min --bootproto=dhcp --device=link --activate

# Firewall configuration
firewall --enabled --service=ssh

# Do not configure the X Window System
skipx

# System services
services --enabled=sshd,chronyd

# Disable root account
rootpw --lock

# Regular user, password locked, ssh key login only
user --name=fedora --groups=wheel --lock
sshkey --username=fedora "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPEBEPdH4p6zFVxm/Sajh3i3VDlYiMXQ4ePYFyg2HgHq fedora@try-fedora"

# Only use vda disk
ignoredisk --only-use=vda

# Partition clearing information
clearpart --all --initlabel --drives=vda

# System bootloader configuration
bootloader --location=mbr --boot-drive=vda --append="net.ifnames=0 biosdevname=0"

# Auto partition table
autopart --type=plain

# Use net install
url --url="https://download.fedoraproject.org/pub/fedora/linux/releases/44/Everything/x86_64/os/"

# Enable repos
repo --name=updates --baseurl="https://download.fedoraproject.org/pub/fedora/linux/updates/44/Everything/x86_64/"

# Packages
%packages
@^custom-environment
%end

# Passwordless sudo for the key-only user
%post
echo "fedora ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/fedora
chmod 0440 /etc/sudoers.d/fedora
%end

# Power off after installation
poweroff

What changed since the 2020 version:

The root account is locked. Instead there's a user called fedora, with a locked password and an SSH key, so the only way in is with that key. The key in the file above is a demo key, published on purpose so the recordings below work. Make your own with ssh-keygen -t ed25519 -f id_ed25519 and put the contents of id_ed25519.pub on the sshkey line instead.

The fedora user can use sudo without a password. That's set in the %post section, which runs inside the new system at the end of the install.

The install ends with poweroff rather than halt. On Fedora 44, halt leaves the installer waiting at "Press ENTER to quit", which isn't what you want from an unattended install.

The timezone line uses --utc. The old --isUtc option is deprecated.

Running the install

virt-install creates the VM, fetches the installer from the Fedora mirror network, hands it the kickstart file and boots it:

$ virt-install \
--name f44-min \
--ram 3072 \
--vcpus 2 \
--os-variant fedora-unknown \
--graphics none \
--noreboot \
--network passt,portForward=2222:22 \
--disk=./f44-min.vda.x86_64.qcow2,bus=virtio,format=qcow2,size=7 \
--location \
https://download.fedoraproject.org/pub/fedora/linux/releases/44/Everything/x86_64/os/ \
--initrd-inject ./ks-min.cfg \
--extra-args="inst.ks=file:/ks-min.cfg console=ttyS0 net.ifnames=0 biosdevname=0"

A few of these options are new:

--ram 3072: the installer unpacks its own image into memory, about 860 MB of it, so 2 GB is no longer enough. 3 GB is.

--os-variant fedora-unknown: virt-install picks good defaults per operating system, and there's no entry for Fedora 44 yet. The old --os-type option is gone.

--noreboot: when the kickstart powers the machine off, virt-install simply returns, instead of booting straight into the new system.

--network passt,portForward=2222:22: passt gives the VM networking without root, and forwards port 2222 on your machine to the VM's SSH port. That's how you'll log in.

The install runs by itself. The kernel and installer image download first, then the installer starts, reads the kickstart file and gets on with it:

First boot

Start the VM with its console attached, to watch it boot:

$ virsh start f44-min --console

At the login prompt there's nothing to type: the password is locked. Leave the console with Ctrl+], and log in over SSH with the key instead:

$ ssh -i id_ed25519 -p 2222 fedora@localhost

Fedora 44 comes up on a 7.2 kernel. The 7 GB disk is split into a 2 GB /boot and a root filesystem with plenty of room left, and NetworkManager has eth0 up through passt. sudo dnf update then checks the Fedora repositories for anything newer than what the installer put down.

When you're done, sudo poweroff shuts it down, and virsh start f44-min brings it back.

Further reading

Getting started with virtualization is a good libvirt and KVM reference, and the Fedora documentation covers everyday tasks on Fedora systems.

Next, f44-min becomes a hypervisor of its own.

back