Translate

Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Image of Operating System Concepts
Image of Modern Operating Systems (3rd Edition)
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)

Using EFI Stub Mechanism to Upgrade to Fedora 20

The Fedora 20 (codename Heisenbug) Beta has been available for a couple of weeks now and is fairly stable according to all reports and so I decided to upgrade my main Linux development system from Fedora 19 to Fedora 20 using Fedup.

FedUp consists of two components – a client used to download packages and prepare for the upgrade, and a pre-boot environment which does the actual upgrade using systemd and yum. Files are downloaded to /var/tmp/fedora-upgrade (or the directory specified by the cachedir command line option) and are automatically deleted after the upgrade completes. In my case nearly 2000 packages were downloaded so ensure that you have sufficient space for the Fedup package cache.

Fedup is easy to use if you are using GRUB2 as must people are. However I do not use a bootloader such as GRUB2 as I have an EFI platform and do not need to use a bootloader. Instead I use the kernel’s EFI Stub mechanism.

I have access to a UEFI v2.0 shell prompt on my platform and normally boot directly from the UEFI shell into whatever operating system I wish to run. Yes, such a UEFI shell is easy to install and is very useful. Just do an Internet search for how to install a UEFI shell onto your ESP (EFI System Partition) if you do not know how to do it.

Here is the contents of my fedup.nsh shell script:

# cat fedup.nsh
vmlinuz-fedup.efi root=UUID=1d3092fc-265e-4860-a609-d6a16c1a6458 rd.lvm=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.md=0 rd.luks=0 ro LANG=en_US.UTF-8 rhgb quiet upgrade systemd.unit=system-upgrade.target plymouth.splash=fedup selinux=0 initrd=.initramfs-fedup.img


As you can see, it is a single line containing a single command ( vmlinuz-fedup.efi) followed by a large number of command line options.

How do you create this command line? You can quickly generate it from the Fedup GRUB2 configuration stanza. Just compare the above line with the GRUB2 Fedup stanza and it will be apparent to you. The EFI stub mechanism allows a user to specify an initrd file using the initrd= command line option. This is the only EFI Stub-specific command line option, everything else on the command line is simply passed to the kernel when it boots. Note that you have to copy the kernel image into /boot/efi/EFI and add the .efi extension to the image filename. You also have to copy the initramfs file into the same directory.

Finally, once the upgrade is completed, you need to create a UEFI shell script to boot into Fedora 20. Here is the contents of my f20.nsh shell script:

# cat /boot/efi/f20.nsh
vmlinuz-3.11.9-300.fc20.efi root=UUID=1d3092fc-265e-4860-a609-d6a16c1a6458 rd.lvm=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.md=0 rd.luks=0 ro LANG=en_US.UTF-8 rhgb quiet initrd=.initramfs-3.11.9-300.fc20.x86_64.img


As you can see, again it is a single line containing a single command ( vmlinuz-3.11.9-300.fc20.efi) followed by a large number of options. Again you can easily construct this script from the new stanza in your GRUB2 configuration file. Here, for example, is the corresponding stanza from /boot/efi/EFI/redhat/grub.conf:

title Fedora (3.11.9-300.fc20.x86_64) 20 (Heisenbug)
        root (hd0,1)
        kernel /vmlinuz-3.11.9-300.fc20.x86_64 root=UUID=1d3092fc-265e-4860-a609-d6a16c1a6458 rd.lvm=0 rd.dm=0  KEYTABLE=us SYSFONT=True rd.md=0 rd.luks=0 ro LANG=en_US.UTF-8 rhgb quiet
        initrd /initramfs-3.11.9-300.fc20.x86_64.img

Incidently, my Fedup upgrade worked perfectly.

Comments are closed.