Issue with rpm install on bootup with kickstart file


I have created a custom iso with kickstart and custom repo

mkksiso --add $NEW/isolinux --add $NEW/customrepo --ks $NEW/ks.cfg Rocky-9.2-x86_64-minimal.iso $ISONAME

In kickstart file, I have added below so that the custom repo is loaded.

repo --name=“customrepo” --baseurl=file:///run/install/sources/mount-0000-cdrom/customrepo

Once the rpm installation starts. it ends up failing for installation of mlocate rpm with below error:

DNF error: Error in POSTIN scriptlet in rpm package mlocate

If I comment out the repo line in kickstart file, the installation goes through fine without any issues. Even mlocate rpm gets installed.

Any thoughts on this? Have been stuck on this issue.

Also is there any more verbose that can be turned on when installing through kickstart which will help us to get trace of exact error.



Have you ran createrepo on the customrepo folder?

Regards Tom.

Yes. Already ran the same and it contains the packages folder with around 1K rpms.

createrepo -g $NEW/customrepo/repodata/comps.xml -q $NEW/customrepo

Is that the postinstall scriptlet (using /bin/sh) that can be seen with:

rpm -q --scripts mlocate

What in that script could fail?


Could you please post your kickstart file?

Regards Tom.

Its failing in below line from postinstall script of mlocate

. /etc/os-release || exit

man bash writes:

. filename [arguments]
source filename [arguments]
The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read.

exit [n]
Cause the shell to exit with a status of n. If n is omitted, the exit status is that of the last command executed.

The source of ‘/etc/os-release’ apparently fails then. Is it the content of that file, or the lack of the file?

Below is the kickstart:


lang en_US.UTF-8
keyboard us
firstboot --disabled

rootpw --iscrypted $1$feWsdFD$fdffgdggh

# user accounts
user --name=admin --groups=wheel --password=qwer
user --name=jkl

firewall --service=ssh
selinux --disabled
timezone --utc Etc/UTC

bootloader --location=mbr --driveorder=sda --append="crashkernel=auto"

repo --name="customrepo"  --baseurl=file:///run/install/sources/mount-0000-cdrom/customrepo

%include /tmp/partmap.ks


# Redirect output to console
exec < /dev/console > /dev/console

if [ ! -e /tmp/partmap.ks ]; then
    cat > /tmp/partmap.ks <<EOOPM
clearpart --all --initlabel
part swap --fstype swap --asprimary --size=64000
part /boot --label=/boot --fstype ext4 --size=500 --asprimary --fsoptions=noatime,defaults
part pv.01 --size=1 --grow
volgroup jmpvgnocf pv.01
logvol / --fstype ext4 --name=lvroot --vgname=jmpvgnocf --size=50000 --fsoptions=noatime,defaults
logvol /tmp --fstype ext4 --name=lvtmp --vgname=jmpvgnocf --size=75000 --fsoptions=noatime,nodev,noexec,nosuid
logvol /var --fstype ext4 --name=lvvar --vgname=jmpvgnocf --size=235000 --grow --fsoptions=noatime,defaults
logvol /var/log --fstype ext4 --name=lvlog --vgname=jmpvgnocf --size=50000 --fsoptions=noatime,defaults

# core and base are implicitly added by anaconda
@ Core
@ Base

exec < /dev/console > /dev/console


#disable root
/usr/bin/passwd -l root


if [ ! -e "/mnt/source" ]
  mkdir /mnt/source || myexit "Error: mkdir source"
  mount /dev/disk/by-label/$SCLLabel /mnt/source || myexit "Error: mount SCL Install Disc"

cat > /etc/yum.repos.d/custom.repo <<EOF
name=local custom repo

#Create .ssh folder (if not exists) in the root directory
if [ ! -d /root/.ssh ]; then
    mkdir -p /root/.ssh
    chmod 700 /root/.ssh

# Use updated parted if it exists
echo -e "\rUse updated parted if it exists"
mkdir -p /tmp/parted
cd /tmp/parted
/usr/bin/rpm2cpio /tmp/parted-3.0-1.x86_64.rpm | /bin/cpio -idmv

echo "Finishing setup..."

echo "kernel.printk=3 4 1 3" >> /etc/sysctl.conf

sed -i '/PATH\=/d'  /root/.bash_profile
sed -i '/export PATH/d' /root/.bash_profile

/bin/cat >> /home/admin/.bash_profile <<\EOBPRSS

echo "kernel.panic = 10" >> /etc/sysctl.conf

# clean up
rm -rf /tmp/kmod-mpt2sas-
rm -rf /tmp/igb-5.0.6-1.x86_64.rpm
rm -rf /tmp/i2c-i801-na-na.x86_64.rpm
rm -rf /tmp/w83627ehf-na-na.x86_64.rpm
rm -rf /tmp/jmp-hw-tools-na-na.x86_64.rpm
rm -rf /tmp/parted-3.0-1.x86_64.rpm
rm -rf /tmp/kmod-megaraid_sas-

# end of anaconda %post

########## DONE ##########

I did add the preformatted text formatting to your post for easier reading.

Looks like it was an issue due one of our custom rpm where we made rocky-release rpm as obsolete. rocky-release rpm is responsible for /etc/os-release and it would not have been present due to this.

Thanks for the help!!

1 Like