2017-10-26 21:20:01 +00:00
= Upgrading Fedora using package manager
This page contains information explaining how to upgrade Fedora online
2020-10-05 05:41:08 +00:00
using `dnf` (without the DNF system upgrade plugin).
2017-10-26 21:20:01 +00:00
[[upgrading-fedora-using-dnf-directly]]
2018-07-29 11:01:46 +00:00
== Upgrading Fedora using dnf directly
2017-10-26 21:20:01 +00:00
[[participate]]
2018-07-29 11:01:46 +00:00
== Participate
2017-10-26 21:20:01 +00:00
2020-10-05 05:41:08 +00:00
If you are upgrading using link:https://fedoraproject.org/wiki/DNF?rd=Dnf[Dnf] and it shows any general dependency
2017-10-26 21:20:01 +00:00
issues, please file them in http://bugzilla.redhat.com[Bugzilla]. But
please read this page, all references pages and search the mailing list
archives before filing bugs. And of course, please help keep this page
updated.
If you want to help make live upgrades work smoothly, join the
2020-10-05 05:41:08 +00:00
link:SIGs/LiveUpgrade[Live Upgrade Special Interest Group].
2017-10-26 21:20:01 +00:00
[[upgrading-across-multiple-releases]]
2018-07-29 11:01:46 +00:00
== Upgrading across multiple releases
2017-10-26 21:20:01 +00:00
If you need to upgrade across several releases, it is generally
recommended to go one release at a time: for example, rather than going
2020-10-05 05:41:08 +00:00
directly from Fedora 31 to Fedora 33, first go to Fedora 32 and then to Fedora 33. This tends to
2017-10-26 21:20:01 +00:00
reduce the number of package dependency issues you may encounter. If you
are upgrading from an link:End_of_life[End of life] release, please also
see link:#eol[the end-of-life section].
[[instructions-to-upgrade-using-dnf]]
2018-07-29 11:01:46 +00:00
== Instructions to upgrade using dnf
2017-10-26 21:20:01 +00:00
[[backup-your-system]]
2018-07-29 11:01:46 +00:00
=== 1. Backup your system
2017-10-26 21:20:01 +00:00
Backup any personal data to an external hard drive or to another
machine. If there is some unrecoverable error that requires a fresh
install, you don't want to lose any data.
[[read-about-common-problems]]
2018-07-29 11:01:46 +00:00
=== 2. Read about common problems
2017-10-26 21:20:01 +00:00
Further down in this page there is a list of common problems specific to
dnf upgrades for specific versions. Some of them require attention
before the upgrade.
2020-10-05 05:41:08 +00:00
General advice on upgrading Fedora can be found on the link:https://docs.fedoraproject.org/en-US/quick-docs/upgrading/[Upgrading] page.
2017-10-26 21:20:01 +00:00
You should also read the
http://docs.fedoraproject.org/install-guide/[Installation Guide] and
http://docs.fedoraproject.org/release-notes/[Release Notes] for the
version you plan to upgrade to - they contain important information
regarding upgrading issues. Finally, check the list of
link:Common_bugs[Common bugs].
[[clean-stuff]]
2018-07-29 11:01:46 +00:00
=== 3. Clean Stuff
2017-10-26 21:20:01 +00:00
Review and remove all .rpmsave and .rpmnew files before and after
upgrading. (And if you have selinux enabled then remember to check
security context if you move config files around.)
2020-10-05 05:41:08 +00:00
TIP: *Find unused config files* + Merge and resolve the changes found by the following script: `dnf install rpmconf; rpmconf -a`. Now find and remove old config which nobody owns: `rpmconf -c`.
2017-10-26 21:20:01 +00:00
Now is a good time to remove packages you don't use - especially
non-standard packages.
2020-10-05 05:41:08 +00:00
TIP: *Find and review "unused" packages* + You can find packages not required by other packages with the tool `package-cleanup` from the `yum-utils` package: `dnf install yum-utils; package-cleanup --leaves`. These packages could be candidates for removal, but check to see whether you use them directly or if they are used by applications not backed by rpm packages. Remove them with `dnf remove package-name-and-version`.
Another useful tool for cleaning up unused packages is `rpmreaper`. It's an ncurses application that lets you view rpm dependency graph and mark packages for deletion. Marking one package can make other packages leaf, which you can see immediately, so you don't have to run the tool several times to get rid of a whole sub-tree unused packages. Install with `dnf install rpmreaper`.
TIP: *Find and review "lost" packages* + You can find orphaned packages (i.e. packages not in the repositories anymore) with `package-cleanup --orphans`. This will also show packages which have been partially uninstalled but where the "%postun" script failed.
2017-10-26 21:20:01 +00:00
[[do-the-upgrade]]
2018-07-29 11:01:46 +00:00
=== 4. Do the upgrade
2017-10-26 21:20:01 +00:00
If you have 3rd party repositories configured, you may need to adjust
them for the new Fedora version. If you switch from one Fedora release
to another there is often nothing that needs to be done. If you switch
to Rawhide from a standard Fedora release (or vice versa) then most of
the time you will need to install the Rawhide release RPMs from the 3rd
party repository as well (or the standard ones, if switching back).
Note that the upgrade is likely to fail if there are outdated
dependencies from packages not backed by a dnf repository or backed by a
repository which isn't ready for the new version.
It is a good idea to do the upgrade outside the graphical environment.
Log out of your graphical desktop and then
[[fedora-upgrade]]
2018-07-29 11:01:46 +00:00
==== fedora-upgrade
2017-10-26 21:20:01 +00:00
A small script named fedora-upgrade is available which aims to automate
the process outlined below. To run it, do the following
....
2019-03-20 22:42:41 +00:00
$ sudo dnf install fedora-upgrade
2017-10-26 21:20:01 +00:00
$ sudo fedora-upgrade
....
2020-10-05 05:41:08 +00:00
When performing upgrade via remote shell, it is a good idea to use screen
2017-10-26 21:20:01 +00:00
or tmux utility to be able to get back to running transaction in case
your connection drops.
Alternatively, follow the manual steps:
[[go-to-a-text-console]]
2018-07-29 11:01:46 +00:00
==== Go to a text console
2017-10-26 21:20:01 +00:00
....
ctrl + alt + F2
....
(or)
log in as root, and go into multi-user.target
....
systemctl isolate multi-user.target
....
[[fully-update-your-current-fedora-install]]
2018-07-29 11:01:46 +00:00
==== Fully update your current Fedora install
2017-10-26 21:20:01 +00:00
....
# dnf upgrade
....
[[install-the-package-signing-key-for-the-release-you-are-upgrading-to]]
2018-07-29 11:01:46 +00:00
==== Install the package signing key for the release you are upgrading to
2017-10-26 21:20:01 +00:00
If you are upgrading across two releases or fewer from Fedora 20 or
later, this step should be unnecessary. If you are upgrading from an
older Fedora or upgrading across three or more releases, you may need to
import the signing key for the target release.
If it turns out not to be, you should be able to import keys like so:
....
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-23-x86_64
....
, replacing "23" and "x86_64" with the new Fedora version and your
architecture, respectively.
You can also find package signing keys for currently-supported releases
https://getfedora.org/keys/[here]. Keys for EOL releases can be found
https://getfedora.org/keys/obsolete.html[here]. Click _Primary_ (or
_Secondary_, if you are using a secondary architecture), and you will
see _Get it from: Fedora Project_, where _Fedora Project_ is a link.
Copy that URL, and run:
....
# rpm --import (url)
....
2020-10-05 05:41:08 +00:00
to install the key. On old releases, `rpm` may have trouble doing this; if
that happens, download the file with `curl -o` or `wget` and import the downloaded file.
2017-10-26 21:20:01 +00:00
[[clean-the-cache]]
2018-07-29 11:01:46 +00:00
==== Clean the cache
2017-10-26 21:20:01 +00:00
Then remove all traces of the version you are leaving from the dnf cache
in `/var/cache/dnf`.
....
# dnf clean all
....
[[upgrade-all-packages]]
2018-07-29 11:01:46 +00:00
==== Upgrade all packages
2017-10-26 21:20:01 +00:00
2020-10-05 05:41:08 +00:00
CAUTION: *Never upgrade on battery power* + Never run the upgrade operation on battery power! Always connect to the mains, if using a laptop. However, if your system does have a battery, it's a good idea to ensure it's charged and connected in case of a power outage during the upgrade.
CAUTION: *Do not interrupt an upgrade for any reason* + Once a live upgrade is started, do not stop the upgrade by rebooting, killing the process, or by any other method until it is complete. Interrupting an upgrade will cause the affected system to be in a mixed state -- partially the old release and partially the new release. In this state, the system will not be reliable and will not operate as expected. You can try running `dnf distro-sync` and `package-cleanup --problems` to try and fix the problems.
2017-10-26 21:20:01 +00:00
Run the upgrade command:
....
# dnf --releasever=<target_release_number> --setopt=deltarpm=false distro-sync
....
2020-10-05 05:41:08 +00:00
NOTE: *Dependency issues* + If you experience any dependency problems, you have to solve them manually. These are often caused by packages being retired in the newer release, but not properly obsoleted. Often it is enough to remove several problematic package(s).
You may find that a package you care about depends on a package that must be removed for the upgrade to proceed. Usually you will be able to reinstall the important package once the upgrade is complete.
If it seems like you must remove a package with many dependencies, especially ones that look important, please be careful. If you are attempting to upgrade across multiple releases, try a smaller jump to see if that avoids the problem.
If you are at all unsure in any way, ask for help on a mailing list, forum or IRC before removing packages.
2017-10-26 21:20:01 +00:00
[[make-sure-fedora-is-upgraded]]
2018-07-29 11:01:46 +00:00
=== 5. Make sure Fedora is upgraded
2017-10-26 21:20:01 +00:00
Distro-sync will usually take care of upgrades for the third party
2020-10-05 05:41:08 +00:00
repositories you have enabled as well. Confirm with `dnf repolist` after the upgrade
2017-10-26 21:20:01 +00:00
process is over. `dnf` might complain about conflicts or requirements.
That is probably because you have used non-standard repositories or
installed non-standard packages manually. Try to guess which packages
cause the problem (or at least is a part of the dependency chain) -
uninstall them and try again. Remember to install the packages again if
they are essential.
Ensure that all (new) essential packages from the new version are
installed with
....
# dnf groupupdate 'Minimal Install'
....
You might want to update other groups too, see
....
# dnf grouplist
....
For example
....
# dnf groupupdate "GNOME Desktop" \
"Development Tools" "Sound and Video" \
"Games and Entertainment" "Administration Tools" \
"Office/Productivity" "System Tools"
....
[[preparing-for-reboot]]
2018-07-29 11:01:46 +00:00
=== 6. Preparing for reboot
2017-10-26 21:20:01 +00:00
Before booting you should usually install the bootloader from your new
grub by running
....
/usr/sbin/grub2-install BOOTDEVICE
....
2020-10-05 05:41:08 +00:00
- where BOOTDEVICE is often `/dev/sda` or `/dev/vda` for some virtual machine installs. If
2020-04-18 21:27:08 +00:00
you have more than one hard disk, make sure you use the correct device!
2017-10-26 21:20:01 +00:00
2020-10-05 05:41:08 +00:00
If you get an error (e.g. `/dev/sda does not have any corresponding BIOS drive`) from that, then try `/usr/sbin/grub2-install --recheck BOOTDEVICE`.
2017-10-26 21:20:01 +00:00
It might also be necessary to update the grub config file:
....
cp --backup=numbered -a /boot/grub2/grub.cfg{,.bak} # create backup copy
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg # update config file
....
[[cleanup-your-system]]
2018-07-29 11:01:46 +00:00
=== 7. Cleanup your system
2017-10-26 21:20:01 +00:00
Again, cleanup your system as described in section 2. Also you might
want to remove some cache files that are no longer used, for example
files from older Fedora releases in the following directories:
* /var/cache/dnf
* /var/cache/mock
* /var/lib/mock
[[release-specific-notes]]
2018-07-29 11:01:46 +00:00
== Release specific notes
2017-10-26 21:20:01 +00:00
Note: the release-specific notes for link:End_of_life[End of life]
releases are on the
link:Upgrading_from_EOL_Fedora_using_package_manager[EOL packager
manager upgrade page].
[[from-pre-release]]
2018-07-29 11:01:46 +00:00
=== From pre-release
2017-10-26 21:20:01 +00:00
If you are upgrading to a final release from an Alpha, Beta, or release
candidate, please see link:Upgrading_from_pre-release_to_final[Upgrading
from pre-release to final].
[[to-rawhide]]
2018-07-29 11:01:46 +00:00
=== To Rawhide
2017-10-26 21:20:01 +00:00
See the link:Releases/Rawhide[Rawhide] release page for more information
on Rawhide.
....
# dnf upgrade
# dnf install dnf-plugins-core fedora-repos-rawhide
# dnf config-manager --set-disabled fedora updates updates-testing
# dnf config-manager --set-enabled rawhide
# dnf clean -q dbcache packages metadata
# dnf --releasever=rawhide --setopt=deltarpm=false distro-sync --nogpgcheck
## Optional: it is generally advised to do a selinux autorelabel and reboot
# touch /.autorelabel
....
2020-10-05 05:41:08 +00:00
[[fedora-31]]
=== Fedora 31
Before running
....
dnf distro-sync
....
you must run
....
dnf module reset libgit2 exa bat
....
See link:https://bugzilla.redhat.com/show_bug.cgi?id=1747408[Bug 1747408].
[[fedora-30]]
=== Fedora 30
2017-10-26 21:20:01 +00:00
No special instructions. Follow the above instructions.
2020-10-05 05:41:08 +00:00
[[fedora-29]]
=== Fedora 29
2017-10-26 21:20:01 +00:00
No special instructions. Follow the above instructions.
[[upgrading-from-legacy-end-of-life-eol-fedora-releases]]
2018-07-29 11:01:46 +00:00
=== Upgrading from legacy end of life (EOL) Fedora releases
2017-10-26 21:20:01 +00:00
Note that Fedora strongly recommends against ever running an end-of-life
release on any production system, or any system connected to the public
internet, in any circumstances. You should never allow a production
Fedora deployment to reach end-of-life in the first place.
With that in mind, if you do have an end-of-life release installed on a
system you cannot just discard or re-deploy, you can attempt to upgrade
it, though this is a less-tested and less-supported operation.
For detailed instructions on upgrades from EOL releases, please read
link:Upgrading_from_EOL_Fedora_using_package_manager[Upgrading from EOL
Fedora using package manager].
Category:FAQ Category:How_to[Category:How to] Category:Documentation
'''
See a typo, something missing or out of date, or anything else which can be
2017-11-10 15:16:19 +00:00
improved? Edit this document at https://pagure.io/fedora-docs/quick-docs.