Notes to self

Fixing Fedora distro-sync upgrade

It can happen to anyone. You went with yum distro-sync transaction that got interrupted and your system is broken. And you want to know how to fix it.

The most obvious step to try is to tell yum to finish what it started:

# yum-complete-transaction

or try to roll-back with:

# # See the ID of the distro-sync
# yum history list
# yum history undo ID

If that does not take you to the happy end or you suspect something is still wrong, keep on reading.

When you do a Fedora upgrade, yum wants to replace all your packages from the old version to the new one. And when you interrupt the transaction, your system ends in a mixed state having the packages from both version. The idea how to fix that is simple.

First you want yum to know the right $releasever. Know that even if newer fedora-release packages are installed and system show the right (desired) version when you run:

$ cat /etc/redhat-release

yum might still think you are on the old one. You need to delete any fedora-release packages that does not come from your disired Fedora version.

For instead imagine a broken update from f20 to f21:

$ rpm -qa *release*
fedora-release-20-3.noarch
fedora-release-notes-21.08-1.fc21.noarch
rpmfusion-nonfree-release-21-1.noarch
rpmfusion-free-release-21-1.noarch
fedora-release-21-2.noarch
fedora-release-nonproduct-21-2.noarch

As you can see you need to yum remove the old fedora-release packages. Once that is done, you don’t need to supply --releasever option to yum and yum should still correctly determine the version you are running.

And since it is more than likely that they are more duplicate packages like that, you want to remove them to:

# package-cleanup --cleandupes

If that fails you, install yum-utils first.

Afterwards you should be able to do yum distro-sync and yum update just fine.

But what about the kernel you ask? Chances are you still run the old one:

$ rpm -qa kernel
kernel-3.17.7-200.fc20.x86_64
kernel-3.17.7-300.fc21.x86_64
kernel-3.15.6-200.fc20.x86_64
$ uname -r
3.17.7-200.fc20.x86_64

In my example we have 3 kernels installed and the latest kernel for f20 running. That is certainly not what we want.

If you need to tell grub to use different kernel, look at the approved answer by Jamie Nguyen on Ask Fedora. I am including the answer here for convenience:

Open /etc/default/grub and ensure this line exists:

GRUB_DEFAULT=saved

Apply the change to grub.cfg by running:

$ grub2-mkconfig -o /boot/grub2/grub.cfg

List all possible menu entries:

$ grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2

Set the desired default menu entry:

$ grub2-set-default <menu entry title>

Verify the default menu entry:

$ grub2-editenv list

At this point most of the things should be in order and if you hit a problem with a broken package, just reinstall it.

Work with me

I have some availability for contract work. I can be your fractional CTO, a Ruby on Rails engineer, or consultant. Write me at strzibny@strzibny.name.

RSS