Fedora Silverblue 39 automatic installation (scripted)

Good morning,

I’m new here and wanted to do an automatic installation for Fedora Silverblue 39 (scripted), just like with Debian.

I read that this is done using “kickstart”.

Unfortunately, that doesn’t really work.
I wanted to install the gui for kickstart. The system-config-kickstart package is not found.

What exactly do I have to do so that the automatic installation is carried out from my USB install stick?

I hope someone here is able to help me.

You should be able to pass a kickstart to the Anaconda installer for Silverblue.

Here are some docs:

To make it easier, you can do an installation manually first, then take the kickstart file generated by Anaconda in /root/anaconda-ks.cfg.

Then you can take a look at GitHub - ublue-os/isogenerator: An action to generate custom ISOs of OCI images for an example on how to generate an ISO with the kickstart file included.

See also the previous topics:

3 Likes

I successfully completed the installation with Kickstart (ks.cfg).

I would like to pass the hostname via variable.
The syntax (network --hostname=$var-hostname) does not support the $ character. How can variables be used in kickstart?

Maybe linux - Passing variables in kickstart - Server Fault ?

I don’t think you can use environment variables in Kickstarts, only in the %re/%post scripts.

Thanks for the info. Then I have to do this via script after the installation.
Do you happen to know how I can copy data from the USB install stick to the finished installation in the post script? How is the USB stick addressed?

The name didn’t work

"cp -rf /USB-Stick-Name/Folder /etc/folder/"

I tested the following paths:

/dev/run/install/repo/folder
/run/install/repo/folder

mount doesn’t work either.

mkdir /mnt/tmp
usbblkid=$(blkid -L "VOLNAME")
mount $usbblkid /mnt/tmp
cp -rf /mnt/tmp/folder /etc/folder/
umount /mnt/tmp

mount point already mounted or mount point busy.

The USB stick is likely already mounted somewhere. Use findmnt to list all mount points.

I’m in a fully automatic installation. Where can I enter the findmnt command?

Place it in your pre/post script with a sleep 1000 and try it?

Good morning,

Unfortunately, no content of the script is listed. All that is displayed is:
Post-installation scripts are executed.

So I don’t receive any information. I opened the cmd and here I was able to execute various commands.
df -h

The following command worked in the terminal.
cp -rf /run/install/repo/Folder /mnt/sysimage/home/user/

This doesn’t work in Post Script. Here I get the message “Path not found”.

Creating new folders also works in Post Script.

mkdir /etc/test /etc/test/scripts /etc/test/tmp /etc/test/mnt
chown -R user:user /etc/test
chmod -R 777 /etc/test/
chmod -R 755 /etc/test/*
chmod -R 777 /etc/test/tmp

I would like to use Post Script to create services in the following paths.

/etc/profile.d/
/etc/systemd/system/

You might need the no-chroot option: linux - Passing variables in kickstart - Server Fault

1 Like

perfect! That worked.

%post --nochroot --erroronfail
cp -rf /run/install/repo/Folder1 /mnt/sysroot/etc/Folder2/
%end

If you can share a full example that would be great for future folks asking about how to do it. Thanks!

I have stored the entry for the kickstart cfg in the file “E:\EFI\BOOT\grub.cfg”.

inst.ks=hd:LABEL=FEDORA-SB

menuentry 'Install Fedora 39' --class fedora --class gnu-linux --class gnu --class os {
	linuxefi /images/pxeboot/vmlinuz inst.repo=hd:LABEL=FEDORA-SB inst.ks=hd:LABEL=FEDORA-SB quiet
	initrdefi /images/pxeboot/initrd.img 
}

After booting, the ks.cfg is used automatically. This must be saved in the root directory of the USB stick. Here is the content of my ks.cfg file:

# Generated by Anaconda 39.32.6
# Generated by pykickstart v3.48
#version=DEVEL
# Use graphical install
graphical

%post --erroronfail
cp /etc/skel/.bash* /root
%end

%post --erroronfail
###MY CONFIG - CREATE FOLDER
mkdir /etc/TestFolder /etc/TestFolder/scripts /etc/TestFolder/tmp /etc/TestFolder/mnt
chown -R sad:sad /etc/TestFolder
chmod -R 777 /etc/TestFolder/
chmod -R 755 /etc/TestFolder/*
chmod -R 777 /etc/TestFolder/tmp
%end

%post --nochroot --erroronfail
cp -rf /run/install/repo/MyScriptFolder /mnt/sysroot/etc/TestFolder/scripts/
%end

# Keyboard layouts
keyboard --vckeymap=de-nodeadkeys --xlayouts='de (nodeadkeys)'
# System language
lang de_DE.UTF-8

# Firewall configuration
firewall --use-system-defaults

# OSTree setup
ostreesetup --osname="fedora" --remote="fedora" --url="file:///ostree/repo" --ref="fedora/39/x86_64/silverblue" --nogpg

# Run the Setup Agent on first boot
firstboot --enable

### MY CONFIG ###
network --hostname="test"
network --device="eno1" --bootproto="static" --ip="192.168.0.100" --netmask="255.255.255.0" --nameserver="192.168.0.1" --gateway="192.168.0.1"

# Generated using Blivet version 3.8.1
ignoredisk --only-use=sda
# Partition clearing information
# clearpart --none --initlabel
clearpart --drives=sda --all
# Disk partitioning information
part /boot/efi --fstype="efi" --ondisk=sda --size=600 --fsoptions="umask=0077,shortname=winnt"
part btrfs.2851 --fstype="btrfs" --ondisk=sda --size=196608
part /boot --fstype="ext4" --ondisk=sda --size=1024
btrfs none --label=fedora_fedora --data=single btrfs.2851
btrfs /home --subvol --name=home LABEL=fedora_fedora
btrfs / --subvol --name=root LABEL=fedora_fedora

timesource --ntp-server=_gateway
# System timezone
timezone Europe/Berlin --utc

# Root password
rootpw --lock

## MY-USER
user --name=NewUser --iscrypted --password=CryptoKey --groups=admin,wheel --uid=1000 --gid=1000 

reboot
3 Likes

Awesome! Thanks!

this really saved my day, thank you!