Results 1 to 10 of 10

Thread: Rebuild GRUB2 EFI boot menu

  1. #1
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    240

    Default Rebuild GRUB2 EFI boot menu

    This post [1] saved me today. But it's instructions are not so clear for a newbie like me. So I referred to a post [2] on superuser as well.

    Here is my steps of doing this in case anyone need an example. I wanted to post it to the original post, but it's closed.

    These were used on openSUSE Tumbleweed snapshot 20170329.

    1. Burn the Rescue CD [3] to a USB stick using ImageUSB [4].
    2. Boot into system using the USB stick and login as root without password.
    3. Create mount points.
      Code:
      # mkdir /mounts
      # mkdir /mounts/root
    4. Mount necessary devices and paths.
      Code:
      # mount /dev/nvme0n1p<root> /mounts/root
      # mount /dev/nvme0n1p<efi> /mounts/root/boot/efi
      # mount --bind /dev /mounts/root/dev
      # mount -B /proc /mounts/root/proc
      # mount -B /sys /mounts/root/sys
    5. Chroot to mounted root.
      Code:
      # chroot /mounts/root
    6. Rebuild GRUB2.
      Code:
      # efibootmgr -c -d /dev/nvme0n1 -p 1 -L opensuse-secure -l "\EFI\opensuse\shim.efi"
      Change `shim.efi` to `grubx64.efi` if not using Secure Boot as suggested in [5].
    7. Exit chroot.
      Code:
      # exit
    8. Reboot
      Code:
      # reboot


    Here is my partition scheme (excluding those irrelevant) as a reference. And I used <root> and <efi> to represent the `/` and `/boot/efi` in order to avoid misleading.

    Code:
    /dev/nvme0n1p1  EFI System (/boot/efi)
    /dev/nvme0n1p7  /
    [1] https://forums.opensuse.org/showthre...nsole-form-DVD
    [2] https://superuser.com/questions/3764...tall-grub2-efi
    [3] https://en.opensuse.org/openSUSE:Tum...d_installation
    [4] http://www.osforensics.com/tools/write-usb-images.html
    [5] https://forums.opensuse.org/showthre...29#post2597929
    Last edited by cnzhx; 04-Apr-2017 at 15:37. Reason: Add testing platform of openSUSE Tumbleweed snapshot 20170329.
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    9,164
    Blog Entries
    3

    Default Re: Rebuild GRUB2 EFI boot menu

    It is far from clear what you are doing there.

    Take, for example, the line:
    Code:
    # mount /dev/nvme0n1p<root> /mounts/root
    The unix shell will take the "<" and ">" is input and output redirection. And that would be a mess.

    You probably did not intend that line to be taken literally. But you did not make clear what you intended.

    And, for additional clarification:

    Using "efibootmgr -c" add an entry to the firmware (BIOS) boot menu. It does not affect the grub boot menu. You do not need to go to a "chroot" session for that, as long as you provide paths relative to the system that you are using at the time you run the command (such as the rescue system). The man pages for "efibootmgr" explain it reasonably well. And there are good example that can be found with google searches.

    If the goal is to update the grub2 menu, then you instead need the "grub2-mkconfig" command and that does need to be run within a "chroot" shell.
    opensuse Leap 42.3; KDE Plasma 5;
    opensuse tumbleweed; KDE Plasma 5 (test system);

  3. #3
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    240

    Default Re: Rebuild GRUB2 EFI boot menu

    Hi nrickert,

    Thank you for your corrections. I should've asked here first to make my move. Obviously, your words could save me a lot of trial-and-error.

    And my sincere apologies to those have been or will be misguided by my post. I should never post such a summary based on my limited experience.

    I wish I could rectify the post so that it will not misguide anyone in the future. Could any moderator or administrator of this forum add a warning message on the title or some text at the foremost of the content? The message could be "The codes and procedure in this post are not safe to be followed directly. Please refer to the 2nd floor for explanation."

    Sincerely,
    CnZhx
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  4. #4
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    240

    Default Re: Rebuild GRUB2 EFI boot menu

    In order to clarify the misleading information I provided in this post, I made this description based on the explanation on this page: https://en.opensuse.org/openSUSE:UEFI.

    What I wanted to do was actually to re-register the boot information for my openSUSE install in `/boot/efi` into EFI boot manager as an entry. This entry disappeared after I reset the BIOS of my computer. But the boot information in `/boot/efi` is still there. So, what I need is to add an entry to EFI boot manager so that it can pass the boot procedure to the existing boot information. There is no need to perform operations described in the first post in this thread. An acceptable procedure is,
    1. Boot the computer using Rescue CD.
    2. Enter a terminal and execute the following command as root.
      Code:
      # efibootmgr -c -d /dev/nvme0nX -p M -L opensuse-secure -l "\EFI\opensuse\shim.efi"
      where `/dev/nvme0nX` is the disk number `X` that holding the partition for `/boot/efi` as "EFI System"; `-p M` indicates the partition holding `/boot/efi` as "EFI System" on disk `/dev/nvme0nX` and `M` is a number that should be replaced with a proper number based on actual case. Here, my disk is `/dev/nvme0` numbered `1`, and the EFI partition is on partition `1`.

      Also, change `shim.efi` to `grubx64.efi` if not using Secure Boot.


    For another condition, if boot information in `/boot/efi` is damaged, one should re-build the boot information. I found an article talking about re-install GRUB2 via Rescue. The link: https://forums.opensuse.org/content....rom-DVD-Rescue

    Hopefully this understanding of mine is not wrong. All corrections are appreciated.

    Regards,
    CnZhx
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    9,164
    Blog Entries
    3

    Default Re: Rebuild GRUB2 EFI boot menu

    A quick comment.

    You use "/dev/nvme0nX" for the disk. Apparently that's what an SSD (solid state disk) shows up as. A hard drive (spinning magnetic disk) will instead be something like "/dev/sda" or "/dev/sdb".

    This is intended as a clarification for people who do not have SSDs on their systems.
    opensuse Leap 42.3; KDE Plasma 5;
    opensuse tumbleweed; KDE Plasma 5 (test system);

  6. #6
    Join Date
    Nov 2009
    Location
    West Virginia Sector 9
    Posts
    14,592

    Default Re: Rebuild GRUB2 EFI boot menu

    Here my SSD show as /dev/sdaX format as does my spinning rust. It may be best to define the hardware that seems to be an odd name convention

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    9,164
    Blog Entries
    3

    Default Re: Rebuild GRUB2 EFI boot menu

    I think it depends on the interface. Your SSD is probably connected to a SATA cable. Some newer computers have a separate PCI interface.
    opensuse Leap 42.3; KDE Plasma 5;
    opensuse tumbleweed; KDE Plasma 5 (test system);

  8. #8
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    240

    Default Re: Rebuild GRUB2 EFI boot menu

    @nrickert Thanks for your clarification. I forgot to mention this difference between `/dev/sda` and `/dev/nvme`.

    @ gogalthorp

    AFAIK, disk connected to SCSI/SATA interface is identified as `/dev/sda` while disk connected to PCIe based NVMe interface is identified as `/dev/nvme` (or `/dev/nvme*n*`? I'm not sure about this). As an example, here is a explain to the convention from Dell community:

    Naming conventions:

    The below explains the naming convention of the device nodes

    The number immediately after the string “nvme” is the device number

    Example:

    nvme0n1 – Here the device number is 0

    Partitions are appended after the device name with the prefix ‘p’

    Example:

    nvme0n1p1 – partition 1

    nvme1n1p2 – partition 2

    Example:

    nvme0n1p1 – partition 1 of device 0

    nvme0n1p2 – partition 2 of device 0

    nvme1n1p1 – partition 1 of device 1

    nvme1n1p2 – partition 2 of device 1
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

  9. #9
    Join Date
    Nov 2009
    Location
    West Virginia Sector 9
    Posts
    14,592

    Default Re: Rebuild GRUB2 EFI boot menu

    One of the new drives on a card. Interesting. Might want to check on what kernel supports these new PCI drives. May require a driver or newer kernel. This hardware is relatively new. Might have better luck with tumbleweed it runs a much newer kernel

  10. #10
    Join Date
    Jan 2016
    Location
    Manchester, UK
    Posts
    240

    Default Re: Rebuild GRUB2 EFI boot menu

    As stated on ArchWiki, "The Linux NVMe driver is natively included in the kernel since version 3.3." So I guess there is no support issue.

    But like any SSD drive, the NVMe SSD also has a limited write endurance of about 50-500TB varying on different types. It's especially critical to NVMe SSD given that it has very high input/output speed (1-3GB/s). It could be wore out shortly if the user use it excessively.
    openSUSE Tumbleweed (usually the latest snapshot) w/ KDE Plasma 5

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •