The time has once again arrived to upgrade Fedora. As detailed in another article, I installed Fedora on WSL 2. Now I want to upgrade to Fedora version 34. I could do a clean install of course, using the steps detailed in that article, but I want to upgrade in place.
How do we do that?
Here are the steps I use, based on official Fedora instructions.
Just in case, yes?
First, clean up downloaded packages, etc. within Fedora:
sudo dnf clean all
Then, exit WSL and export the whole installation to a tarball (this assumes your distro name is "fedora"):
wsl --export fedora $HOME\Downloads\fedora-wsl.tar
You may want a different folder than
Downloads; specify the location you desire.
Depending on what packages you installed, it may be as small as a quarter GB, or it could be far larger. You could gzip it if you want the storage size to be even smaller. Next time you want to start fresh, you can do something like this:
mkdir $HOME\wsl\freshfedora wsl --import freshfedora $HOME\wsl\freshfedora $HOME\Downloads\fedora-wsl.tar
It is important to have a refreshed package index, and upgrade all packages to the latest. You can do so with
sudo dnf upgrade --refresh
We will need DNF System Upgrade in order to make the leap, so let's install it now.
sudo dnf install dnf-plugin-system-upgrade
To prepare and download for a system upgrade to Fedora 35, the following should do the trick:
sudo dnf system-upgrade download --releasever=35
This will take a bit of time.
Yes, you should feel fine about importing the new GPG for Fedora 35, so you can answer "y" to that.
If using WSL, this is where it gets a little strange, but only a little.
I first set a flag to indicate reboots are not necessary.
Not sure how necessary that is, but it doesn't hurt. We can restart WSL ourselves, if we need to, but I have not found that to be required. If you are doing this on a full Fedora system (not WSL), please do not set this flag; you need to do an actual reboot.
Now we trigger the update, strangely, with the upgrade and reboot command (pass the
-E flag to
sudo in order to utilize the
DNF_SYSTEM_UPGRADE_NO_REBOOT variable defined earlier):
sudo -E dnf system-upgrade reboot
You will get some systemd errors, such as
System has not been booted with systemd as init system (PID 1). Can't operate. and
Failed to connect to bus: Host is down. You can safely ignore these.
Enter to get a prompt again. Then trigger the actual upgrade with
sudo dnf system-upgrade upgrade
Yes, we will get those systemd errors again, but no worries. You can trust that the right stuff is happening.
You should now have a fresh Fedora 35 system.
In case you upgraded from Fedora 32 or earlier, the RPM database backend has changed somewhat. Refresh it with
sudo rpmdb --rebuilddb
Then refresh and upgrade all the packages.
sudo dnf upgrade --refresh
For your reference, here are all the steps in one block:
sudo dnf upgrade --refresh sudo dnf install dnf-plugin-system-upgrade sudo dnf system-upgrade download --releasever=35 export DNF_SYSTEM_UPGRADE_NO_REBOOT=1 sudo dnf system-upgrade reboot sudo dnf system-upgrade upgrade sudo dnf upgrade --refresh
Enjoy your shiny new Fedora!
Even if you have a prerelease, there should be no need to reinstall. Just keep upgrading, as often as you like; the process is pretty seamless:
sudo dnf upgrade
Using Fedora 34, upgrade as often as you like with the above command, and you will eventually (by the end of April 2021) be at release.