Let me tell you a story.
This is not a sad story, but a geeky one.
A story about a developer that was told it’s impossible to migrate his Fedora OS from BIOS to UEFI, and against all odds, succeeded.
A few months ago I started working at a new place and got a shiny Dell XPS 9560.
The spec was amazing: Top of the line CPU, GPU, 4k screen and even 32gb of RAM!
But the issues.. oh… the issues. Thank god most of them are solvable by a simple firmare upgrade. The rest are GPU issues which led me to disable the embedded NVIDIA GPU (which I don’t need anyway).
Ok, so how do I upgrade the firmware?
fwupd comes to the rescue:
“fwupd is an open source daemon for managing the installation of firmware updates on Linux-based systems, developed by GNOME maintainer Richard Hughes…” - Wikipedia.
What?! but why?!
fwupdmgr recognizes my devices:
So what’s wrong? I’m connected to AC, I’m running as root, I got UEFI Capsule Updates turned on.
Oh wait. I’m not using UEFI. No problem! let’s migrate!
My first thought: “Oh shit. I’m f\cked”. My second thought: “that doesn’t make any sense!*.
All I need is a simple
grub-mkconfig while booted in UEFI mode, but how?
- Convert my paritition table to GUID Partition Table
- Free up some space for an EFI Partition
- Update GRUB to use UEFI
Before we continue, I want to share we you my own partition table:
I have two OS’s installed. Arch & Fedora -
/bootis mounted at
/is mounted at
/is mounted at
/dev/sda2 for swap, and
/dev/sda5 has some other data.
I don’t need Arch anymore, and would like to migrate Fedora to UEFI.
I know that most of the changes I had to do couldn’t be done on mounted volumes, ,so I had to use a LiveCD. But nobody uses LiveCD’s nowadays - LiveUSB is the word on the streets.
Then, change my BIOS configuration to boot up in UEFI mode and boot it up.
I got the LiveUSB installed on a company thumb drive. Now I need to convert my paritition table from dos to GUID (GPT).
This step is rather simple. I Used
I actually had another OS installed at the beginning of the partition table which I didn’t use anymore, so I just deleted it and recreated a new one from the LiveCD.
If you don’t have one, install GParted and use it to free up ~10gb at beginning of the partition table.
Why 10GB? well, instead of trying to figure out how to install UEFI correctly, I decided to install another Fedora instance and delete it once I’m done. That way I know for sure everything will work correctly.
Ok, so now - install Fedora. It should prompt you to create an EFI partition. Create a 1GB partition at the beginning, and use the rest for the new Fedora installation.
Installed? Yay. Now reboot. Don’t worry, you won’t see your “old” Fedora installation on boot. Get it your new shiny installation, but don’t get too attached, we’ll destroy it in a few minutes!
Again, I have two OS’s installed. Fedora’ & Fedora’’ -
- Fedora’, the temporary one, has
- Fedora’’, the “old” one, has
/dev/sda7 for swap.
Fedora'' to mount
/boot/efi) on boot, and configured to use UEFI. chroot to the rescue!
For those of you that have never heard of change root, Wikipedia provides a good explanation:
Chroot is an operation that changes the apparent root directory for the current running process and their children.
A program that is run in such a modified environment cannot access files and commands outside that environmental directory tree. This modified environment is called a chroot jail.
So back to where we were… Let’s chroot and get this over with.
Awesome. I’m in
Fedora''. Now I need to follow Fedora’s Updating GRUB 2 configuration on UEFI systems.
grub2-mkconfig told me it found
I’m basically done! A few minor steps remain -
First, Restart and boot into
Second, Open GParted, remove
/dev/sda6 and probably re-arrange other partitions.
Third, re-create my grub config so
Fedora' would disappear (like we did before):
I know it sounds stupid, because the OS already booted, but why not?
See? that wasn’t too hard!
After I did all that, I reran
Done. By the way, ALL the issues I previously had were gone after upgrading!