Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after reboot machine #73

Open
nameeeeeek opened this issue Mar 30, 2021 · 38 comments
Open

Error after reboot machine #73

nameeeeeek opened this issue Mar 30, 2021 · 38 comments

Comments

@nameeeeeek
Copy link

Good afternoon,

After following your tutorial to switch from CentOS 7 to Oracle Linux, I found an error.

I do everything right and there is no problem. It turns out that when I reboot, the machine no longer starts me and gives the following errors:

  • Failed to open \ EPI \ centos \ grubx64.efi - Not Found
    Falied to load image \ EPI \ centos \ grubx64.efi - Not Found
    start_image () returned Not Found

Can you help, please?

Thanks!

errro_centos8

@aburmash
Copy link

You might want to have a look at #70
There is an immediate workaround listed there. In the meanwhile i will try to find some time to implement a proper fix.

@nameeeeeek
Copy link
Author

I had already tested it but without success ... I will try again.

Thanks

@aburmash
Copy link

Well, the main idea is that you need to add an UEFI boot entry for /boot/efi/EFI/redhat/shimx64.efi
relative path to ESP dir, that should be used as a parameter for efibootmgr is "\EFI\redhat\shimx64.efi"
You might want to check that file is actually present at first.

But that definitely should be fixed in the script itself, my proposal here and in #70 is just a quick bandaid.

@lvarela
Copy link

lvarela commented Mar 30, 2021

I tested the script now by creating a new VM in Oracle Cloud with CentOS 8 then running the migration script.

After rebooting, I get the following message:

System BootOrder not found. Initializing defaults.
Creating boot entry "Boot0001" with label "Oracle Linux" for file "\EFI\redhat\shimx64.efi"

The system is not usable after running the script.

@Djelibeybi
Copy link
Member

Right, we still need to fix the UEFI use-case. I was hoping @aburmash would submit a fix for it. :)

@aburmash
Copy link

Yeah. Will try to do it this week.
Meanwhile @lvarela could you please share some details of what exactly is unusable ?
According to the log you have provided entry was re-created by fallback without issues, what is the problem after that ? Is that entry unbootable ? What is the error ?

@lvarela
Copy link

lvarela commented Mar 30, 2021

The VM boots to the grub> prompt. The entry is unbootable.

If I try to load the kernel manually by using the following commands on the grub prompt:

set prefix=(hd0,gpt2)/boot/grub
set root=(hd0,gpt2)
insmod normal
normal
insmod linux
linux /vmlinuz-5.4.17-2036.104.5.el8uek.x86_64
initrd /initramfs-5.4.17-2036.104.5.el8uek.x86_64.img

The VM just hangs.

@Djelibeybi
Copy link
Member

What VM shape are you using? I want to reproduce this internally using the same config.

@lvarela
Copy link

lvarela commented Mar 30, 2021

VM.Standard.E2.1

@Djelibeybi
Copy link
Member

Do you mean VM.Standard2.1? The E(PYC) shapes are the E3.Flex and E4.Flex.

@lvarela
Copy link

lvarela commented Mar 30, 2021

I copy/pasted from the GUI. Here is a screenshot:

SHAPECONFIG

@Djelibeybi
Copy link
Member

Righto. I'll have to find another tenancy that still has access to those shapes. I'm busy testing a VM.Standard2.1 now.

@Djelibeybi
Copy link
Member

Ok, it works fine with a VM.Standard2.1. I'll test the E3/E4 Flex shapes as well. I'm still trying to find access to a Standard.E2.1 instance. I think that's a legacy shape that was replaced by the E3 and E4 Flex. If you have access to those shapes, can you see if those reboot successfully?

@lvarela
Copy link

lvarela commented Mar 30, 2021

That shape was located in "Specialty and Previous Generation" I am currently on a trial mode, it could be that.

I don't have access to the E3/E4s but I will test tomorrow on a VM.Standard2.1

@Djelibeybi
Copy link
Member

E3/E4 shapes work for me too. Let me know how you go.

@aburmash
Copy link

aburmash commented Mar 31, 2021

The VM boots to the grub> prompt. The entry is unbootable.

This indicates that grub did not load the grub config
Which is actually a different problem. If that VM is still recoverable check if grub.cfg is present in /boot/efi/EFI/redhat/

@nameeeeeek
Copy link
Author

Good, I tested the migration script again but without success.

I did what aburmash said and created the UEFI boot entry for Oracle Linux but when the system reboots, it still doesn't work.

I execute the commands in the following order:

1.-curl https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh

  1. sudo bash centos2ol.sh

  2. rpm -e shim-x64

  3. yum install shim-x64 (does not work)

  4. efibootmgr -c -d / dev / sda1 -p 1 -L "Oracle Linux" -l "\ EFI \ redhat \ shimx64.efi"

When rebooting, I lose the machine, and it is necessary to restore a backup.

@aburmash
Copy link

aburmash commented Mar 31, 2021

@nameeeeeek

efibootmgr -c -d /dev/sda1 -p 1 -L "Oracle Linux" -l "\EFI\redhat\shimx64.efi"

Here is the problem. There should be no 1 there.
You should be providing device ( which is /dev/sda ) and later partition which is 1. With -d /dev/sda1 -p1 you essentially provide device sda1 and partition 1, which does not exist.

Overall, just do not reboot immediately after running efibootmgr. You can run efibootmgr -v and check if output matches expectations.
For example here is my test system:
efibootmgr -c -d /dev/vda -p 1 -L "test" -l "\EFI\redhat\shimx64.efi"

[root@localhost ~]# efibootmgr -v
BootCurrent: 0003
Timeout: 3 seconds
BootOrder: 0004,0003,0002,0001,0000
Boot0000* UiApp FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* UEFI QEMU DVD-ROM QM00005     PciRoot(0x0)/Pci(0x1f,0x2)/Sata(2,65535,0)N.....YM....R,Y.
Boot0002* UEFI Misc Device      PciRoot(0x0)/Pci(0x3,0x0)N.....YM....R,Y.
Boot0003* Oracle LinuZ  HD(1,GPT,88f20717-7ccd-4cff-b5c7-1098ac0b2d47,0x800,0x12c000)/File(\EFI\redhat\shimx64.efi)
Boot0004* test  HD(1,GPT,88f20717-7ccd-4cff-b5c7-1098ac0b2d47,0x800,0x12c000)/File(\EFI\redhat\shimx64.efi)

So you can easily check by this output:

  1. If disk in efibootmgr output matches your ESP partition
[root@localhost ~]# blkid |grep EFI
/dev/vda1: UUID="A4E3-577B" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="88f20717-7ccd-4cff-b5c7-1098ac0b2d47"

PARTUUID from blkid output matches what i see in efibootmgr output.

  1. Check if boot file actually file exists.
    \EFI\redhat\shimx64.efi == /boot/efi/EFI/redhat/shimx64.efi

@aburmash
Copy link

@nameeeeeek
yum install shim-x64 (does not work)
well, that explains the failure of boot. If you remove shim and do not install a new one you do not have even a single shimx64.efi binary to boot. What is the error with shim-x64 installation ?

@nameeeeeek
Copy link
Author

Thanks for the answers.

Ah ok, I understand ...

I did it all over again but now I didn't run rpm -e shim-x64. And I ran the command efibootmgr -c -d / dev / sda -p 1 -L "Oracle Linux" -l "\ EFI \ redhat \ shimx64.efi after run script.

When checking through efibootmgr -v, the Oracle Linux line appears there but when rebooting, it gives the error attached below.

BootCurrent: 0003
BootOrder: 0006,0003,0000,0001,0002,0000,0001,0002,0004,0000,0001,0002,0003,0000,0001,0002,0005,0000,0001,0002,0003,0000,0001,0002,0004,0000,0001,0002,0003,0000,0001,0002
Boot0000* EFI SCSI Device AcpiEx(VMBus,,)/VenHw(9b17e5a2-0891-42dd-b653-80b5c22809ba,d96361baa104294db60572e2ffb1dc7f00eff7d9741a9d4c85772655f5f508c3)/SCSI(0,0)
Boot0001* EFI SCSI Device AcpiEx(VMBus,,)/VenHw(9b17e5a2-0891-42dd-b653-80b5c22809ba,d96361baa104294db60572e2ffb1dc7f00eff7d9741a9d4c85772655f5f508c3)/SCSI(0,1)
Boot0002* EFI Network AcpiEx(VMBus,,)/VenHw(9b17e5a2-0891-42dd-b653-80b5c22809ba,635161f83edfc546913ff2d2f965ed0e25cbb88ca5da9f48a4854cf485549d3f)/MAC(000000000000,0)
Boot0003* CentOS Linux HD(1,GPT,2004b5aa-4426-46d0-9531-a40e30d69be3,0x800,0x64000)/File(\EFI\centos\shim.efi)
Boot0004* CentOS Linux HD(1,GPT,2004b5aa-4426-46d0-9531-a40e30d69be3,0x800,0x64000)/File(\EFI\centos\shim.efi)
Boot0005* CentOS Linux HD(1,GPT,2004b5aa-4426-46d0-9531-a40e30d69be3,0x800,0x64000)/File(\EFI\centos\shim.efi)
Boot0006* Oracle Linux HD(1,GPT,2004b5aa-4426-46d0-9531-a40e30d69be3,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)

Now there is no error in yum install shim-x64

errro_centos8

Sorry to be boring but I wanted to solve this

@aburmash
Copy link

No, you are not boring, in fact i am gathering feedback from you for the fix on our side. And i am really grateful you are going through this, this helps A LOT!

OK, i can understand that error.
You actually kept centos shim ( which is clearly seen by the fact that fallback restores the centos entry for you ), but it can't boot grub, because you have grub in redhat dir. and centos shim expects it in centos dir.

So it all comes down to inability to install an new ( oracle ) shim.
Could you please share what is the error on installation of Oracle shim instead of Centos one ?

BTW, do not reboot the box while all pieces are not in place. You need:

  1. Oracle shim

  2. Oracle grub2

  3. Oracle grub2 config ( grub2-mkconfig > /boot/efi/EFI/redhat/grub.cfg )

  4. do ls /boot/efi/EFI/redhat/
    you should see at least grubx64.efi, shimx64.efi and grub.cfg there

  5. efibootmgr command to actually add Oracle shim
    Boot0006* Oracle Linux HD(1,GPT,2004b5aa-4426-46d0-9531-a40e30d69be3,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)

if you have everything of that on place, you should be fine.

@nameeeeeek
Copy link
Author

When you talk about

Could you please share what is the error on installation of Oracle shim instead of Centos one?

, are you referring to the errors after running the script?

@aburmash
Copy link

Well, if you have them during the script - yes.

But i was referring to this:

rpm -e shim-x64

yum install shim-x64 (does not work)

@nameeeeeek
Copy link
Author

Now i don't have errors when install shim...

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package matching shim-x64-15-2.0.9.el7.x86_64 already installed. Checking for update.
Nothing to do

How i can install Grub2 ?

@aburmash
Copy link

yes.
so you need:

Oracle shim

Oracle grub2

Oracle grub2 config ( grub2-mkconfig > /boot/efi/EFI/redhat/grub.cfg )

do ls /boot/efi/EFI/redhat/
you should see at least grubx64.efi, shimx64.efi and grub.cfg there

efibootmgr command to actually add Oracle shim

@nameeeeeek
Copy link
Author

How i can install that ? (oracle shim and oracle grub2)

@aburmash
Copy link

aburmash commented Mar 31, 2021

if you have run migration script and see no errors:
do

[root@localhost ~]# rpm -qi grub2-efi-x64 |grep Vendor
Vendor      : Oracle America
[root@localhost ~]# rpm -qi shim-x64 |grep Vendor
Vendor      : Oracle America

If that matches - you have oracle shim and grub2

You can double check that everything is fine with
find /boot/efi/EFI/redhat/

if you see shimx64.efi , grubx64.efi and grub.cfg there - you are good to go.

// do not forget about efibootmgr entry

@nameeeeeek
Copy link
Author

[root@localhost ~]# rpm -qi grub2-efi-x64 |grep Vendor
Vendor : Oracle America

[root@localhost ~]# rpm -qi shim-x64 |grep Vendor
Vendor : CentOS

[root@localhost ~]# find /boot/efi/EFI/redhat/
/boot/efi/EFI/redhat/
/boot/efi/EFI/redhat/fonts
/boot/efi/EFI/redhat/fonts/unicode.pf2
/boot/efi/EFI/redhat/grubx64.efi

I've seen that I can't even migrate

@aburmash
Copy link

Yeah, you have Centos shim.
Ok, let's use heavy artillery.
is your system OL/CENTOS 7 ?

  1. check your current shim version
    I assume it is
    shim-x64-15-8.el7.x86_64.rpm ?

http://mirror.centos.org/centos/7/os/x86_64/Packages/shim-x64-15-8.el7.x86_64.rpm

  1. rpm -e shim-x64 --nodeps

  2. yum install http://public-yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/shim-x64-15-2.0.9.el7.x86_64.rpm

@aburmash
Copy link

and surely
grub2-mkconfig > /boot/efi/EFI/redhat/grub.cfg

@lvarela
Copy link

lvarela commented Mar 31, 2021

The VM boots to the grub> prompt. The entry is unbootable.

This indicates that grub did not load the grub config
Which is actually a different problem. If that VM is still recoverable check if grub.cfg is present in /boot/efi/EFI/redhat/

Unfortunately I terminated the instance and cannot test the grub config.

I just tried on fresh CentOS 8 install using the VM.Standard2.1 shape .
This time I disabled all the epel repos and I didn't "yum update" before running the centos2ol.sh script.

So after running the script -> rebooted; the system is fine and the migration was successful.

@nameeeeeek
Copy link
Author

Good morning,

I did everything right but when rebooting, the machine is without image again ...

[root@localhost ~]# yum install shim-x64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
ol7_UEKR6 | 2.5 kB 00:00:00
Package matching shim-x64-15-2.0.9.el7.x86_64 already installed. Checking for update.
Nothing to do

[root@localhost ~]# grub2-mkconfig > /boot/efi/EFI/redhat/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.17-2102.200.13.el7uek.x86_64
Found initrd image: /boot/initramfs-5.4.17-2102.200.13.el7uek.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.21.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.21.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.15.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.15.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.11.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.11.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.6.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.6.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1127.19.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1127.19.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-c89d25490ee4439d8bfc404b7821a789
Found initrd image: /boot/initramfs-0-rescue-c89d25490ee4439d8bfc404b7821a789.img
done

I no longer know what to do to make this work ....

@aburmash
Copy link

aburmash commented Apr 1, 2021

At what stage it's failing right now ? Can't find shim or drops to grub cmdline ?

@nameeeeeek
Copy link
Author

It doesn't fail at all ... I did everything as we talked about yesterday, but even with those workarounds, it didn't work ... I'll wait for the script to be corrected, to see if it works.

@nameeeeeek
Copy link
Author

When I try to install shim it gives this ... The problem can only come from here

[root@localhost ~]# yum install shim-x64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
ol7_UEKR6 | 2.5 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package shim-x64.x86_64 0:15-2.0.9.el7 will be installed
--> Processing Dependency: mokutil = 15-2.0.9.el7 for package: shim-x64-15-2.0.9.el7.x86_64
--> Finished Dependency Resolution
Error: Package: shim-x64-15-2.0.9.el7.x86_64 (ol7_latest)
Requires: mokutil = 15-2.0.9.el7
Installed: mokutil-15-8.el7.x86_64 (@updates/7)
mokutil = 15-8.el7
Available: mokutil-12-1.0.3.el7.x86_64 (ol7_latest)
mokutil = 12-1.0.3.el7
Available: mokutil-15-1.0.1.el7.x86_64 (ol7_latest)
mokutil = 15-1.0.1.el7
Available: mokutil-15-1.0.3.el7.x86_64 (ol7_latest)
mokutil = 15-1.0.3.el7
Available: mokutil-15-1.0.5.el7.x86_64 (ol7_latest)
mokutil = 15-1.0.5.el7
Available: mokutil-15-2.0.3.el7.x86_64 (ol7_latest)
mokutil = 15-2.0.3.el7
Available: mokutil-15-2.0.5.el7.x86_64 (ol7_latest)
mokutil = 15-2.0.5.el7
Available: mokutil-15-2.0.7.el7.x86_64 (ol7_latest)
mokutil = 15-2.0.7.el7
Available: mokutil-15-2.0.9.el7.x86_64 (ol7_latest)
mokutil = 15-2.0.9.el7

@aburmash
Copy link

aburmash commented Apr 9, 2021

We have just released updated grub2 and shim for OL7 and OL8 and i'd like people to try reproducing the issue.
Pretty much if you have any problem either Oracle shim or Oracle grub2 not being installed after the migration: please report it.

@nameeeeeek
Copy link
Author

I'll just explain everything I did even to help you internally in case something like that happens to someone else

First I started by giving disabled in all repo, except Centos
I also removed the kernels, leaving only the one used

I ran the script (sudo bash centos2ol.sh > /var/log/upgrade.log 2>&1)

After running the script, it was necessary to create the boot for Oracle with the command (efibootmgr -c -d /dev/sda -p 1 -L "Oracle Linux" -l "\EFI\redhat\shimx64.efi")

It was also necessary to delete the shim and reinstall it.
(
rpm -e shim-x64
yum install shim-x64
)

upgrade.log

@pkoev
Copy link

pkoev commented Jun 21, 2022

Ahoy, everyone. A year later I've been doing migration simulations on EFI systems and it appears, the only way I can make a system bootable after migration is by efibootmgr magic. Am I missing something or is that the case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants