Add/set repo on kickstart post

Hi all,

trying to set an automated kickstart install using the full iso dvd, on the post command i want to make sure the system is updated to latest versión of Rocky 8 but the command “yum update” or “dnf update” sends this output.

Unable to detect release version (use ‘–releasever’ to specify release version)
Error: There are no enabled repositories in “/etc/yum.repos.d”, “/etc/yum/repos.d”, “/etc/distro.repos.d”

The /etc has not got any of the files it says and don’t know how to add them. If i specify --releasever i only get the second line with the error.

Where are you running dnf update -y in your kickstart? All of my kickstarts have that command in %post and there has been no issues doing this (going as far back as the CentOS 5 and 6 days).

Here:

%post --log=/root/ks-post.log
dnf update -y

Using a Rocky Linux 8.7 dvd iso, will try on a 8.9 and update results.

If you are removing the rocky-release/rocky-repos packages or replacing them with your own, or potentially modifying dnf in some manner with custom packages, this can easily cause your issue.

The error you are getting is about repositories. This tells me you are removing/replacing rocky-repos when you shouldn’t be.

Not my intention at all, what i want is to install ansible. Also i’m not an expert on kickstart. The only place i see the repo command is in here:

repo --name=“AppStream” --baseurl=file:///run/install/sources/mount-0000-hdd-device/AppStream

If i try making use of this command with the following commands:

repo --name="BaseOS" --baseurl=http://dl.rockylinux.org/pub/rocky/8/BaseOS/$basearch/os/ --cost=200
repo --name="AppStream" --baseurl=http://dl.rockylinux.org/pub/rocky/8/AppStream/$basearch/os/ --cost=200
repo --name="PowerTools" --baseurl=http://dl.rockylinux.org/pub/rocky/8/PowerTools/$basearch/os/ --cost=200
repo --name="extras" --baseurl=http://dl.rockylinux.org/pub/rocky/8/extras/$basearch/os --cost=200
repo --name="epel" --baseurl=https://dl.fedoraproject.org/pub/epel/8/Everything/$basearch/ --cost=200
repo --name="epel-modular" --baseurl=https://dl.fedoraproject.org/pub/epel/8/Modular/$basearch/ --cost=200

The result is a command not found error. Don’t know if i need to use --nochroot when trying to install or what is the problem…

repo would go at the top of a kickstart, where items like clearpart, text, and others exist. It should not be in any section (e.g. %post, %pre, %packages).

2 Likes

Just a question: Are you able to do a remote server install using URL --url=http/https
I have not been able to get this working using a kickstart

Doing a manual install and setting a repo url and adding additional repo works perfectly fine.

Assuming that you’re starting with the DVD image, you need the accompanying .treeinfo file and various image directories. Without them, url generally will not work as you expect it to.

# Download the ISO
% wget https://dl.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9-latest-x86_64-dvd.iso

# Mount
% mount -o loop Rocky-9-latest-x86_64-dvd.iso /mnt

# for my PXE setup, I copy the appropriate images
% mkdir /var/lib/tftpboot/rocky-9-x86_64
% cp /mnt/images/pxeboot/* /var/lib/tftpboot/rocky-9-x86_64

# Copy the entire ISO contents to the web directory
% mkdir -p /var/www/html/os/rocky/9/x86_64
% rsync -vrlptDSH --delete /mnt/ /var/www/html/os/rocky/9/x86_64
% umount /mnt

# treeinfo
% cat /var/www/html/os/rocky/9/x86_64/.treeinfo
[checksums]
images/efiboot.img = sha256:1d708b4ad14008293841b75eb8959cb65de2fd2f6c841046b797b5bbc78c3498
images/install.img = sha256:3616c7854ac7bc040936105d86f89a0d71504c104b2733ca65a1030f1f27bce1
images/pxeboot/initrd.img = sha256:b0c79d21b4d80aca65ae624ef467658adff112c334f7a27ae004884147da2704
images/pxeboot/vmlinuz = sha256:7fe2da512ffa4feb54e6dbeb26c2e0c0035ef897b5d5bada627da0a67f97419f

[general]
; WARNING.0 = This section provides compatibility with pre-productmd treeinfos.
; WARNING.1 = Read productmd documentation for details about new format.
arch = x86_64
family = Rocky Linux
name = Rocky Linux 9.3
packagedir = AppStream/Packages
platforms = x86_64,xen
repository = AppStream
timestamp = 1699824768
variant = AppStream
variants = AppStream,BaseOS
version = 9.3

[header]
type = productmd.treeinfo
version = 1.2

[images-x86_64]
efiboot.img = images/efiboot.img
initrd = images/pxeboot/initrd.img
kernel = images/pxeboot/vmlinuz

[images-xen]
initrd = images/pxeboot/initrd.img
kernel = images/pxeboot/vmlinuz

[media]
discnum = 1
totaldiscs = 1

[release]
name = Rocky Linux
short = Rocky
version = 9.3

[stage2]
mainimage = images/install.img

[tree]
arch = x86_64
build_timestamp = 1699824768
platforms = x86_64,xen
variants = AppStream,BaseOS

[variant-AppStream]
id = AppStream
name = AppStream
packages = AppStream/Packages
repository = AppStream
type = variant
uid = AppStream

[variant-BaseOS]
id = BaseOS
name = BaseOS
packages = BaseOS/Packages
repository = BaseOS
type = variant
uid = BaseOS

I am using the Rocky-9-latest-x86_64-boot.iso and setting the kickstart: “inst.ks=http://192.168.50.3/kickstart/rocky9.ks

Here is the Kickstart file:

# Generated by Anaconda 34.25.3.8
# Generated by pykickstart v3.32
#version=RHEL9
# Use graphical install

graphical
repo --name="BaseOS2" --baseurl=http://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os
repo --name="AppStream" --baseurl=https://download.rockylinux.org/pub/rocky/9/AppStream/x86_64/os

%post
dnf config-manager --set-enabled devel
%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_ZA.UTF-8

# Use network installation
url --url="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os"

%packages
@^minimal-environment
@development

%end

# Generated using Blivet version 3.6.0
ignoredisk --only-use=sda
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --all --initlabel --drives=sda
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=1024
part pv.01 --fstype="lvmpv" --ondisk=sda --size=1 --grow
volgroup rl --pesize=4096 pv.01
logvol swap --fstype="swap" --size=2098 --name=swap --vgname=rl
logvol / --fstype="xfs" --grow --size=1024 --name=root --vgname=rl

# System timezone
timezone Africa/Johannesburg --utc

If I disable

#url --url="https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os"

everything else in the kickstart works, I just have to manually input the source url and the install takes place.

Not my intention to install via URL, but guess you need to make sure the access points are reachable somehow.

Thanks for this info, i will take a try on this.

Still have not been able to run command:

dnf update -y

If i add the repo lines next to:

repo --name=“AppStream” --baseurl=file:///run/install/sources/mount-0000-hdd-device/AppStream

The install downloads the files instead of getting them from the USB but nothing more happens.

Can i add the repos in this folders “/etc/yum.repos.d”, “/etc/yum/repos.d”, “/etc/distro.repos.d” and how?