Post-Update, Post-Reboot Fix
Overview
In this article we will cover the steps to recovery a virtual machine affected by the EFI boot problem for a virtual machine which has already been updated and failed to reboot. If you have not rebooted, but have updated, review the steps in the article Post-Update, Pre-Reboot Fix. You will also need to refer to that article in order to finish the necessary steps to resolve this issue. We will link to it below in the final step on this page.
Post-Update, Post-Reboot Fix
-
Mount Linux ISO
We need to load a Linux CD ISO first in order to access the Recovery option.- Access your virtual machine using the tenant portal and attach a DVD drive with a CentOS 7 version 1804 ISO.
- You can use any distribution but the "Minimal" install version is recommended.
- Reboot the machine if it is running.
- Access your virtual machine using the tenant portal and attach a DVD drive with a CentOS 7 version 1804 ISO.
-
Access CentOS Recovery Menu
You'll need to connect to the console during boot to access the Rescue menu.- Use the "Connect" option in the tenant portal during boot.
- Select the option "Troubleshooting" from the CentOS menu.
- Select "Rescue a CentOS system".
- Select Continue on the next menu.
- Press Enter to get a shell when prompted.
-
Mount Your Disk Image
Next, we will mount our system disk from the recovery shell. Note that you will start in a prompt that is not the system root of your Linux disk.
Follow the steps below to mount this as the root partition.# You will start in a sh prompt. Switch to bash.
sh-4.2# /bin/bash
# Mount the system image
bash-4.2# chroot /mnt/sysimage -
Copy Boot Files - "centos" Directory
We'll need to copy over some files from the boot sector into another part of the boot sector first. Answer "y" for yes when prompted to overwrite.$ cp -r /boot/efi/EFI/centos/* /boot/efi/EFI/BOOT/
cp: overwrite ‘./BOOT/BOOT.CSV’? y cp: overwrite ‘./BOOT/BOOTX64.CSV’? y cp: overwrite ‘./BOOT/mmx64.efi’? y cp: overwrite ‘./BOOT/shim.efi’? y cp: overwrite ‘./BOOT/shimx64-centos.efi’? y cp: overwrite ‘./BOOT/shimx64.efi’? y -
Copy Boot Files - "BOOT" directory
We'll now do the reverse of the previous step. This is necessary so that the latest files are in both directories. Answer "y" for yes when prompted to overwrite.$ cp -r /boot/efi/EFI/BOOT/* /boot/efi/EFI/centos/
cp: overwrite ‘./centos/BOOT.CSV’? y cp: overwrite ‘./centos/BOOTX64.CSV’? y cp: omitting directory ‘./BOOT/fonts’ cp: overwrite ‘./centos/mmx64.efi’? y cp: overwrite ‘./centos/MokManager.efi’? y cp: overwrite ‘./centos/shim.efi’? y cp: overwrite ‘./centos/shimx64-centos.efi’? y cp: overwrite ‘./centos/shimx64.efi’? y -
Confirm Changes
We want to make sure we see the correct files with the correct dates in both directories. Both directories should contain exactly the same files as shown below.
The date of the changed files should reflect today's date or August 24, 2018. We can ignore the "fonts" directory.[root@localhost]# ls -al /boot/efi/EFI/centos/ total 8768 drwx------. 2 root root 4096 Oct 4 12:30 . drwx------. 4 root root 4096 Apr 13 13:32 .. -rwx------. 1 root root 134 Oct 4 12:30 BOOT.CSV -rwx------. 1 root root 134 Oct 4 12:30 BOOTX64.CSV -rwx------. 1 root root 1302920 Oct 4 12:30 BOOTX64.EFI -rwx------. 1 root root 77544 Oct 4 12:30 fallback.efi -rwx------. 1 root root 77544 Oct 4 12:30 fbx64.efi -rwx------. 1 root root 5075 Oct 4 12:30 grub.cfg -rwx------. 1 root root 1024 Oct 4 12:30 grubenv -rwx------. 1 root root 1051520 Oct 4 12:30 grubx64.efi -rwx------. 1 root root 1261312 Oct 4 12:30 mmx64.efi -rwx------. 1 root root 1261312 Oct 4 12:30 MokManager.efi -rwx------. 1 root root 1302920 Oct 4 12:30 shim.efi -rwx------. 1 root root 1296776 Oct 4 12:30 shimx64-centos.efi -rwx------. 1 root root 1302920 Oct 4 12:30 shimx64.efi [root@localhost]# ls -al /boot/efi/EFI/BOOT/ total 8772 drwx------. 3 root root 4096 Oct 4 12:29 . drwx------. 4 root root 4096 Apr 13 13:32 .. -rwx------. 1 root root 134 Oct 4 12:29 BOOT.CSV -rwx------. 1 root root 134 Oct 4 12:29 BOOTX64.CSV -rwx------. 1 root root 1302920 Aug 24 10:20 BOOTX64.EFI -rwx------. 1 root root 77544 Aug 24 10:20 fallback.efi -rwx------. 1 root root 77544 Aug 24 10:20 fbx64.efi drwx------. 2 root root 4096 Apr 13 13:56 fonts -rwx------. 1 root root 5075 Apr 13 13:58 grub.cfg -rwx------. 1 root root 1024 Apr 13 13:58 grubenv -rwx------. 1 root root 1051520 Oct 21 2017 grubx64.efi -rwx------. 1 root root 1261312 Oct 4 12:29 mmx64.efi -rwx------. 1 root root 1261312 Oct 4 12:29 MokManager.efi -rwx------. 1 root root 1302920 Oct 4 12:29 shim.efi -rwx------. 1 root root 1296776 Oct 4 12:29 shimx64-centos.efi -rwx------. 1 root root 1302920 Oct 4 12:29 shimx64.efi
-
Reboot Test
We can now reboot to be sure our change took effect and resolved the boot issue. As long as the machine reboots and you're able to successfully login, you should be fine.
But we still need to fix the boot loader to load the correct kernel. Proceed to the next step.# Perform a soft reboot
$ shutdown -r
# After reboot, review the current kernel, which is incorrect
$ cat /proc/version
Linux version 3.10.0-693.21.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Wed Mar 7 19:03:37 UTC 2018 -
Fix Boot Configuration
Follow the steps on the Post-Update, Pre-Reboot Fix starting from step 7 to complete the process and fix the boot menu and startup configuration.
Last modified: Thursday, 4 October 2018, 4:33 PM