Kickstart rocky 9 issue (dnf update)

Hi.
In my Rocky8 kickstart file towards the end of the post installation I run “dnf update -y”
Everything peachy there. It updates from the public repos, it reboots, all good to go.

When I do the same in Rocky9, there is an issue for me with the kernel update.
It takes the boot parameters I used for kickstarting e.g. inst.ks=http://kickstart.local/ks.cfg and so on and puts them in the loader .conf files for that new kernel.

A quick workaround is to boot on the original kernel and run “dnf reinstall kernel*” or to update manually later I guess.

So this is in /boot/loader/entries for the kernel update

title Rocky Linux (5.14.0-70.17.1.el9_0.x86_64) 9.0 (Blue Onyx)
version 5.14.0-70.17.1.el9_0.x86_64
linux /vmlinuz-5.14.0-70.17.1.el9_0.x86_64
initrd /initramfs-5.14.0-70.17.1.el9_0.x86_64.img
options inst.stage2=hd:LABEL=Rocky-9-0-x86_64-dvd linux inst.text ip=192.168.0.66::192.168.0.1:255.255.255.0:mgptmp.local::none nameserver=192.168.0.44 nameserver=192.168.0.2 inst.ks=http://kickstart.local/ks/rocky9.ks crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M
grub_users $grub_users
grub_arg --unrestricted
grub_class rocky

Its driving me nuts :smile: any pointers anyone?

Just had to bulid a new Rocky9 machine and its still the same behaviour.
So why would it have the stage2 options in there?
So dracut is taking the kernel command line parameters used for kickstart and using them in the updated kernel for some reason. I guess if it wasn’t kickstart it could have wanted them preserved.

There is a file rdsosreport.txt

1 + cat /lib/dracut/dracut-055-45.git20220404.el9
2 dracut-055-45.git20220404.el9
3 + echo /proc/cmdline
4 /proc/cmdline
5 + sed -e ‘s/(ftp://.):.@/\1:@/g;s/(cifs://.):.@/\1:@/g;s/cifspass=[^ ]/cifspass=/g;s/iscsi:.@/iscsi:@/g ;s/rd.iscsi.password=[^ ]/rd.iscsi.password=/g;s/rd.iscsi.in.password=[^ ]/rd.iscsi.in.password=*/g’ /proc/cmdline
6 BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-70.26.1.el9_0.x86_64 inst.stage2=hd:LABEL=Rocky-9-0-x86_64-dvd linux inst.text ip=147.197.138.58::147.197 .138.1:255.255.255.0:vuh-la-logos2.herts.ac.uk::none nameserver=147.197.200.44 nameserver=147.197.200.2 inst.ks=http://vuh-lb-kck01.herts.ac.uk/ ks/rocky9.ks crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M

[ 0.012561] vuh-la-logos2.herts.ac.uk kernel: Kernel command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-70.26.1.el9_0.x86_64 inst.stage2=hd:LABEL=Rocky-9-0-x86_64-dvd linux inst.text ip=147.197.138.58::147.197.138.1:255.255.255.0:vuh-la-logos2.herts.ac.uk::none nameserver=147.197.200.44 nameserver=147.197.200.2 inst.ks=http://vuh-lb-kck01.herts.ac.uk/ks/rocky9.ks crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M
[ 0.012662] vuh-la-logos2.herts.ac.uk kernel: Unknown kernel command line parameters “linux BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.14.0-70.26.1.el9_0.x86_64 ip=147.197.138.58::147.197.138.1:255.255.255.0:vuh-la-logos2.herts.ac.uk::none nameserver=147.197.200.2”, will be passed to user space.

So its passed the cdline kickstart commands into the a BOOT_IMAGE variable which its passing onto grub to compose the boot options. Seems fair enough tbh. Don’t know why this worked in Rocky8.

After booting off the older kernel, I can “dnf remove kernel26” and then “dnf update” to remove then add the new kernel and proceed.

OK give me a shout if someone can help.

I was able to get a system with the latest packages and kernel by putting some repo commands into my kickstart file.
It is not the solution for the problem you are facing , but can be a workaround.

repo --name=baseos --baseurl=http://dl.rockylinux.org/$contentdir/$releasever/BaseOS/$basearch/os/ --cost=1000
repo --name=appstream --baseurl=http://dl.rockylinux.org/$contentdir/$releasever/AppStream/$basearch/os/ --cost=1000
repo --name=extras --baseurl=http://dl.rockylinux.org/$contentdir/$releasever/extras/$basearch/os/ --cost=1000

Well thank-you, yes indeed that worked around it nicely.
Before I tried this just now, I downloaded the latest DVD of Rocky9 in case my boot DVD had an issue. But it still failed in the manner I described. So yes using these repo lines was a workaround.

Thank-you longhid …

You should put this (or similar) in your %post

CURKER=$(grubby --default-kernel)
grubby --info=${CURKER} > /tmp/args
yum update -y
NEWKER=$(grubby --default-kernel)
source /tmp/args
grubby --args="root=/dev/mapper/rockyvg-root ${args}" --update-kernel="${NEWKER}"
grubby --remove-args="inst.repo inst.stage2 ip inst.ks" --update-kernel="${NEWKER}"

It should get you around the issue.

Gosh that was a clever workaround - yes indeed that worked also - thanks for taking the time to think about that.