Atomic host upgrade/rollback does not set grub default correctly

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux Atomic Host (RHEL Atomic) 7.1.2

Issue

  • After running atomic host rollback or atomic host upgrade on hosts running Red Hat Enterprise Linux Atomic Host 7.1.2, the host still boots into the current version.
  • The previous version can be manually selected at boot time, but by default the current version boots

Resolution

This issue has been resolved for RHEL Atomic Host versions 7.1.3 and beyond. For RHEL Atomic Host 7.1.2, please follow these steps after every upgrade or rollback:

  • Download the grub2-entries-fix.py.txt script attached to this solution.
  • Rename it to grub2-entries-fix.py.
  • Put it in /tmp on the RHEL Atomic Host.
  • Run python /tmp/grub2-entries-fix.py as root from the RHEL Atomic Host. If the grub configuration requires modification, the output will resemble this:
# python /tmp/grub2-entries-fix.py 
--- /boot/loader/grub.cfg   2015-06-16 11:29:39.332187860 +0000
+++ /boot/loader/grub.cfg.tmp   2015-06-16 11:29:52.377187798 +0000
@@ -77,7 +77,7 @@
 ### END /etc/grub.d/10_linux ###

 ### BEGIN /etc/grub.d/15_ostree ###
-menuentry 7.1.0 (ostree)' --class gnu-linux --class gnu --class os --unrestricted 'ostree-1-9400eec6-bf55-4c0f-ab41-3caee981bcd9' {
+menuentry '7.1.2 (ostree)' --class gnu-linux --class gnu --class os --unrestricted 'ostree-0-9400eec6-bf55-4c0f-ab41-3caee981bcd9' {
 load_video
 set gfxpayload=keep
 insmod gzio
@@ -89,10 +89,10 @@
 else
   search --no-floppy --fs-uuid --set=root 9400eec6-bf55-4c0f-ab41-3caee981bcd9
 fi
-linux16 /ostree/rhel-atomic-host-dd0d21c7622b8f0f5f559a45cf125b88d6b6334ea3049ee56f8ab5f3b96a478a/vmlinuz-3.10.0-229.el7.x86_64 no_timer_check  console=tty1 console=ttyS0,115200n8 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=atomicos/root crashkernel=auto vconsole.keymap=us root=/dev/mapper/atomicos-root ostree=/ostree/boot.1/rhel-atomic-host/dd0d21c7622b8f0f5f559a45cf125b88d6b6334ea3049ee56f8ab5f3b96a478a/0
-initrd16 /ostree/rhel-atomic-host-dd0d21c7622b8f0f5f559a45cf125b88d6b6334ea3049ee56f8ab5f3b96a478a/initramfs-3.10.0-229.el7.x86_64.img
+linux16 /ostree/rhel-atomic-host-3b7333ea045ca267a0d482e88f93848da82b569a92f9b1ee79429393f54f449a/vmlinuz-3.10.0-229.4.2.el7.x86_64 no_timer_check  console=tty1 console=ttyS0,115200n8 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=atomicos/root crashkernel=auto vconsole.keymap=us root=/dev/mapper/atomicos-root ostree=/ostree/boot.1/rhel-atomic-host/3b7333ea045ca267a0d482e88f93848da82b569a92f9b1ee79429393f54f449a/0
+initrd16 /ostree/rhel-atomic-host-3b7333ea045ca267a0d482e88f93848da82b569a92f9b1ee79429393f54f449a/initramfs-3.10.0-229.4.2.el7.x86_64.img
 }
-menuentry '7.1.2 (ostree)' --class gnu-linux --class gnu --class os --unrestricted 'ostree-0-9400eec6-bf55-4c0f-ab41-3caee981bcd9' {
+menuentry '7.1.0 (ostree)' --class gnu-linux --class gnu --class os --unrestricted 'ostree-1-9400eec6-bf55-4c0f-ab41-3caee981bcd9' {
 load_video
 set gfxpayload=keep
 insmod gzio
@@ -104,8 +104,8 @@
 else
   search --no-floppy --fs-uuid --set=root 9400eec6-bf55-4c0f-ab41-3caee981bcd9
 fi
-linux16 /ostree/rhel-atomic-host-3b7333ea045ca267a0d482e88f93848da82b569a92f9b1ee79429393f54f449a/vmlinuz-3.10.0-229.4.2.el7.x86_64 no_timer_check  console=tty1 console=ttyS0,115200n8 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=atomicos/root crashkernel=auto vconsole.keymap=us root=/dev/mapper/atomicos-root ostree=/ostree/boot.1/rhel-atomic-host/3b7333ea045ca267a0d482e88f93848da82b569a92f9b1ee79429393f54f449a/0
-initrd16 /ostree/rhel-atomic-host-3b7333ea045ca267a0d482e88f93848da82b569a92f9b1ee79429393f54f449a/initramfs-3.10.0-229.4.2.el7.x86_64.img
+linux16 /ostree/rhel-atomic-host-dd0d21c7622b8f0f5f559a45cf125b88d6b6334ea3049ee56f8ab5f3b96a478a/vmlinuz-3.10.0-229.el7.x86_64 no_timer_check  console=tty1 console=ttyS0,115200n8 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=atomicos/root crashkernel=auto vconsole.keymap=us root=/dev/mapper/atomicos-root ostree=/ostree/boot.1/rhel-atomic-host/dd0d21c7622b8f0f5f559a45cf125b88d6b6334ea3049ee56f8ab5f3b96a478a/0
+initrd16 /ostree/rhel-atomic-host-dd0d21c7622b8f0f5f559a45cf125b88d6b6334ea3049ee56f8ab5f3b96a478a/initramfs-3.10.0-229.el7.x86_64.img
 }
 ### END /etc/grub.d/15_ostree ###

Update bootloader configuration? [y/N] y
GRUB2 configuration modified: re-synchronized with /boot/loader/entries
  • If the grub configuration does not require modifications, you will see the following:
# python /tmp/grub2-entries-fix.py 
GRUB2 configuration validated
  • Reboot. RHEL Atomic Host should boot into the expected version.

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments