Upgrading Fedora 18 to 19 using Fedup with Btrfs RAID1 /boot partition

Before reading, please be reminded that, the recommended partition layout is a 250M ext3/4 /boot partition.

Grub2 began to support booting from btrfs last year. I like to try new stuffs so I installed my fedora 18 using a btrfs raid1 /boot partition. But after several updates, I began to notice that whenever kernel is updated, the new kernel will not appear in grub boot menu.

grubby fatal error: unable to find a suitable template

After some googling, the problem is related to grubby and there is a workaround. Just run grub2-mkconfig -o /boot/grub2/grub.cfg  each time after kernel update. It is totally fine with just one more command after update. But the problem becomes more serious when doing distro upgrade using fedup because fedup requires writing a grub entry to continue.

After reading these two posts:
https://bugzilla.redhat.com/show_bug.cgi?id=904253
https://bugzilla.redhat.com/show_bug.cgi?id=902498

I made the upgrade by doing the following steps:

  1. run fedup then it will install a fedup kernel
  2. run grub2-mkconfig -o /boot/grub2/grub.cfg  , this will create an entry in grub for booting in fedup kernel
  3. open the file  /boot/grub2/grub.cfg , copy a whole block of menu entry to /etc/grub.d/40_custom, change the menuentry name to “system upgrade”. Actually,  you can directly edit the grub.cfg.
  4. add “upgrade systemd.unit=system-upgrade.target plymouth.splash=fedup enforcing=0” without quotes to the tail of the linux line.  If you do not have any old kernel left into the grub menu, you will need to add one more menu entry to here.  The new entry will use the new fc19 kernel to boot. The actual version is determined by the media from which you install. If you use network install, then it will be the latest kernel….
  5. reboot and choose “system upgarde” from grub menu, then the upgrade process will begin.
  6. After fedup finishes its job, the system will reboot. But you can no longer boot into fedup kernel because fedup will delete it from the upgrade process. Now you need to boot into some old kernel or the entry you added from step 4.  If still cannot boot, you may need to boot from rescue CD to edit grub.conf.
  7. After successful boot, you need to run grub2-mkconfig -o /boot/grub2/grub.cfg to get the new grub menu entries.

For example if your grub.conf menuentry block look like this:

menuentry ‘System Upgrade’ –class fedora –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-simple-/dev/sda1
/dev/sdb1′ {
load_video
insmod gzio
insmod part_msdos
insmod btrfs
set root=’hd0,msdos1′
if [ x$feature_platform_search_hint = xy ]; then
search –no-floppy –fs-uuid –set=root –hint-bios=hd0,msdos1 –hint-efi=hd0,msdos1 –hint-baremetal=ahci0,msdos1 –hint=’hd0,msdos1’ e0b0a9ca-2540-4ef8-87ec-967b372e6ee0
else
search –no-floppy –fs-uuid –set=root e0b0a9ca-2540-4ef8-87ec-967b372e6ee0
fi
echo ‘Loading Linux fedup …’
linux /root/boot/vmlinuz-fedup root=UUID=e0b0a9ca-2540-4ef8-87ec-967b372e6ee0 ro rootflags=subvol=root rd.md=0 rd.lvm=0 rd.dm=0 rd.luks=0 vconsole.keymap=us rhgb 
echo ‘Loading initial ramdisk …’
initrd /root/boot/initramfs-fedup.img
}

You will need to add “upgrade systemd.unit=system-upgrade.target plymouth.splash=fedup enforcing=0” to the linux line like this:

menuentry ‘System Upgrade’ –class fedora –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-simple-/dev/sda1
/dev/sdb1′ {
load_video
insmod gzio
insmod part_msdos
insmod btrfs
set root=’hd0,msdos1′
if [ x$feature_platform_search_hint = xy ]; then
search –no-floppy –fs-uuid –set=root –hint-bios=hd0,msdos1 –hint-efi=hd0,msdos1 –hint-baremetal=ahci0,msdos1 –hint=’hd0,msdos1’ e0b0a9ca-2540-4ef8-87ec-967b372e6ee0
else
search –no-floppy –fs-uuid –set=root e0b0a9ca-2540-4ef8-87ec-967b372e6ee0
fi
echo ‘Loading Linux fedup …’
linux /root/boot/vmlinuz-fedup root=UUID=e0b0a9ca-2540-4ef8-87ec-967b372e6ee0 ro rootflags=subvol=root rd.md=0 rd.lvm=0 rd.dm=0 rd.luks=0 vconsole.keymap=us rhgb upgrade systemd.unit=system-upgrade.target plymouth.splash=fedup enforcing=0
echo ‘Loading initial ramdisk …’
initrd /root/boot/initramfs-fedup.img
}

Finally, again…  using a ext4 /boot partition will save you much time.

 

 

Leave a Reply