System upgrade is only officially supported and tested over 2 releases at most (e.g. from 38 to 40).
When upgrading across more than two releases, you may need to import the GPG key for the release you want to update to. You can do this with: sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-N-primary
# Update GRUB bootloader on BIOS systems sudo mount | grep "/boot " sudo grub2-install /dev/sda
# Clean-up retired packages, Upgrades across more than two releases are not supported. sudo dnf install remove-retired-packages remove-retired-packages