Skip to content

Revise default kernel setup instructions in README#97

Open
mikaeldui wants to merge 1 commit into
masterfrom
default-kernel-fix
Open

Revise default kernel setup instructions in README#97
mikaeldui wants to merge 1 commit into
masterfrom
default-kernel-fix

Conversation

@mikaeldui

@mikaeldui mikaeldui commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

The current instructions in the README for keeping the CachyOS kernel as the default kernel after updates to the official Fedora kernel are no longer working in Fedora 44 as the official kernel makes itself default using a %post script, which runs after kernel/postinst.d scripts. Thank you @Hekel1989 for figuring it out!

By using a DNF5 post_transaction action we can run the command after the %post script.

Fixes #94

Should there be instructions for removing the previous postinst.d/99-default script?

Preview


Default Kernel

By default Fedora will use the kernel that was most recently updated by dnf which will lead to inconsistent behaviour if you have multiple kernels installed, but we can tell Fedora to always boot with the latest CachyOS kernel by running a command after all kernel updates.

# Install the DNF5 actions plugin
sudo dnf install libdnf5-plugin-actions

# Create the actions directory
sudo mkdir -p /etc/dnf/libdnf5-plugins/actions.d

# Create the post_transaction action for kernel* packages
sudo tee /etc/dnf/libdnf5-plugins/actions.d/cachy-default.actions << 'EOF'
# After installing any kernel* package, set the latest CachyOS kernel as the default boot entry
post_transaction:kernel*:in::/usr/bin/sh -c /usr/bin/grubby\ --set-default=/boot/$(ls\ /boot\ |\ grep\ vmlinuz.*cachy\ |\ sort\ -V\ |\ tail\ -1)
EOF

The next time any installed kernel (e.g. the official Fedora kernel) gets an update, the system will change default kernel back to the latest CachyOS kernel. This way you can keep the official kernel as a backup in case an update goes wrong and you need to temporarily switch to the official kernel.

Updated instructions for setting the default CachyOS kernel after kernel updates, including new command syntax and file paths.

Fixes #94
@mikaeldui mikaeldui self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postinst.d/99-default script doesn't seem to work - Fedora kernel become the default one after update

1 participant