Fail to Switch Root Error

I posted about this a while back and when no one replied I just decided to wait a little bit before sending the question again.

Hey guys, I’ve updated my computer 2 times as of now and both times after updating I have gotten a failure with the switch root. The first time this happened (updating to 5.13.7), I had to keep using 5.13.5 and then one day it had just happened to boot onto the new kernel. I had also tried using the terminal upgrade and the same issue occurred. As of now, I tried to upgrade my kernel to 5.13.9 and everything turned out successful except for the grub boot into it where it once again failed at the switch root. Why does this happen? What do I need to do? Is there a way to fix this so that in the future I won’t have to deal with this occurring every single time I update? I’ve tried looking up solutions but I’m still not too sure what to do, and I’ve seen other people with the same problem but I’m not sure how they turned out. I just kinda need some help with my specific situation

I should also mention that I have updated my laptop twice since then and now I only have one working grub entry (surprisingly, still 5.13.7) and I’m scared to update again in fear of losing this last working kernel version.

fedora does not remove the currently running kernel so as long as you are booted to that kernel when you update it will remain.

With that said, what version of fedora are you using? Doing an update of fedora 34 today will install kernel 5.14.10. I am not sure what the last kernel version on fedora 33 is, but 33 goes EOL about mid-december or before (~30 days after the final release of fedora 35)

I’m on Fedora 34, kernel 5.13.7 at the moment. I have updated twice to higher kernels (i think 5.14.x and 5.13.9 but that doesn’t really matter) but both of them have had a switch root issue which has been posted on other bugzilla forums, reddit, etc. This one from what I can tell is the most similar to mine, but I can’t get the issue to fix and I’m not sure what to do. It appears that this issue has been ongoing for quite some time now.

Reference: Fedora 32 switch root won’t start after upgrade, boots to emergency mode - Unix & Linux Stack Exchange

My strong suggestion, and likely fix, is to (while booted to the 5.13.7 kernel) do a full “sudo dnf upgrade”. When that is done see if the system boots properly with the new 5.14 kernel.

Grub has also seen several updates, and since grub manages the actual boot the problem does not seem likely to still be hanging after more than a year and half since the article you referenced was put out there. VERY few posts on that issues have shown up.

There have been a lot of changes in the kernel and in other things all across the system so it seems likely your issue is solved but the reluctance to take a chance has prevented investigation.

I also did a search on this forum for “failed to switch root” and found several posts. One caught my eye from March and I link it here, but suggest that you look at how others have solved the issue. It does not seem kernel related.

Sorry for taking so long to get back to you. I know very few posts have shown up for this issue, but the most recent one that I have seen was about 4 months ago, which I’m pretty sure was F34 at the time. I’ve seen this go all the way back to 2015 if I’m not mistaken. Like you said, I understand that a reluctance of upgrading is a scary thing, but did try to sudo DNF upgrade at one point in time after upgrading via gnome software and had the same fail to switch root issue. The last time I tried updating was not too long ago, and that was to 5.14.9

It appears to me that the link that you sent seems to be a different issue, as mine has the same error message as the one in this post.

I decided to take a leap of faith and sudo dnf upgrade. I deleted one grub entry just in case it decided to fail to switch root once again on the new kernel, and surely enough it did. I upgraded to 5.14.11-200.fc34, but the same issue persists. I’m not sure what I need to do to fix the issue. I should also mention that the kernel that does work, 5.13.7, was at one point a broken kernel with the same issue. It just randomly decided to work one day for me. Iirc, it was this kernel, if not it was another (but the point still stands)

Edit: grammar

Potentially try the “dnf distro-sync” since that is supposed to make sure everything matches version wise.

Just tried that, and didn’t get anything new.

How did you upgrade? What steps did you perform?

For future reference, here’s the official procedure for an upgrade: DNF System Upgrade.

You can remove old kernels with the following code. Be sure to boot into the latest kernel before running the command.

#!/usr/bin/env bash

old_kernels=($(dnf repoquery --installonly --latest-limit=-1 -q))
if [ "${#old_kernels[@]}" -eq 0 ]; then
    echo "No old kernels found"
    exit 0
fi

if ! dnf -y remove "${old_kernels[@]}"; then
    echo "Failed to remove old kernels"
    exit 1
fi

echo "Removed old kernels"
exit 0

FYI
It is not necessary to run this script to delete old kernels.

By default dnf retains only 3 kernel versions, the newest and 2 older ones. Each kernel update removes the oldest that is not currently running leaving only 3 installed.

Also FYI

The OP has never shown any of the info he sees on screen, just complains that the kernel update fails with the switch root error.

I cannot fathom that problem as in over 25 years using RedHat & Fedora I have never seen a similar issue. The updates always work.

Without specific data from the OP it is impossible to identify what may be going wrong or why. He does not respond with details even when requested, only generic info.

1 Like

I did not realize that there was such a detailed way to upgrade. I typically just use the GUI, but when it the first fail to switch root occurred, I decided to upgrade again using sudo dnf upgrade