The following is summarised from https://docs.fedoraproject.org/en-US/quick-docs/upgrading-fedora-offline/
- Install dependencies:
sudo dnf install clean-rpm-gpg-pubkey dracut-config-rescue remove-retired-packages rpmconf symlinks- Most of these will be used after the upgrade step next.
dracut-config-rescuewill automate updating the rescue kernel in the future during adnf upgrade.
- Update existing system
sudo dnf upgrade --refreshsudo rebootsudo dnf system-upgrade download --releasever=$VERSION, where$VERSIONis the new Fedora version to use.sudo dnf5 offline reboot, which schedules the upgrade during the next reboot. Cancel this withsudo dnf5 offline clean.
- Upgrade system config:
sudo rpmconf -a - Remove retired packages:
sudo remove-retired-packages $OLD_VERSIONwhere$OLD_VERSIONis the previous Fedora version. If you upgraded across more than one release, then the oldest version should be provided. - Remove duplicate packages:
sudo dnf4 repoquery --duplicatesto view the list, andsudo dnf4 remove --duplicatesto remove them. - Autoremove unneeded packages:
sudo dnf autoremove - Remove old kernels if you wish:
sudo dnf remove $(sudo dnf repoquery --installonly --latest-limit=-1 -q)-- note that the lack of quotes around the subshell here is intentional, and we are querying a--latest-limitof-1, not1, which would remove the current kernel! - Remove old GPG keys:
sudo clean-rpm-gpg-pubkey - Remove dangling symbolic links:
sudo symlinks -r /usr | grep dangling | sortto view them;sudo symlinks -r -d /usrto remove them.