Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How can I reinstall grub on dual boot EFI partition?

  1. #1

    Default How can I reinstall grub on dual boot EFI partition?

    Hi guys!
    I started using linux some years ago, but I'm not a guru yet (eheheheh ) and I'm a new user to opensuse
    I successfully installed opensuse 13.1 on my Samsung Laptop together with pre-installed OEM Windows 8.0 (now upgraded to 8.1) on the same disk, with secure boot enabled.

    Everything works fine, but sometimes Grub2 doesn't load anymore at boot, and Windows starts automatically, so I can't start OpenSuse anymore. I'm still wondering what causes this strange behavior.... this time as far as I can remember what I did before, was applying windows updates, and using the Hibernate function often, on Windows and Linux.


    However, I can correct this:
    - I boot from the OpenSuse installation DVD and choose to update my system.
    - After the update setup has finished and rebooted, Windows is no more available at boot
    - To let OpenSuse starts automatically, I must temporarily disable the secure boot feature from bios (i don't know why)
    - Now I can run Yast, open the boot loader configuration, and click Ok without doing any changes.
    - Reboot (this time with secure boot enabled).
    Now grub is back as before, and everything is working fine.... till next time!



    Now, my questions are:
    1) Can any windows automatic updates replace grub with default windows 8 loader (it sounds strange to me)? Can the hibernate feature?
    2) Is there a better and "elegant" way to reinstall grub2 on dual boot EFI partition, using my original grub configuration?


    Thank you in advance for your help, and sorry if my english is not perfect

  2. #2
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    16,284

    Default Re: How can I reinstall grub on dual boot EFI partition?

    There is a EFI/boot partition this is what boots on a EFI system. It is formatted FAT and there should be directories for each OS that is to boot. So forget anything you ever learned about grub and MBR booting since they no longer apply in EFI based systems

    In Windows try turning off fast boot. This is a method that does not actually shut down the OS but does a kind of hibernate. Some EFI implementations seem to want to boot only Windows. Some are OK.

    There is a trick which I'll let others explain of putting the openSUSE files in the Windows part of the efi/boot to trick it to always boot to grub

  3. #3
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,317
    Blog Entries
    15

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Hi
    I don't boot into windows much, so I use the efibootmgr next option to ensure only openSUSE or SLED boots first rather than resorting to the bcdedit or /Boot options. On my HP systems I just press the F9 key and select to boot openSUSE/SLED after a windows boot. I also ensure when using Windows to do a full shutdown.

    Use the advance search of the forum for the keyword bcdedit, this may work for your UEFI implementation.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,664
    Blog Entries
    3

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Quote Originally Posted by superuzzo View Post
    Now, my questions are:
    1) Can any windows automatic updates replace grub with default windows 8 loader (it sounds strange to me)? Can the hibernate feature?
    2) Is there a better and "elegant" way to reinstall grub2 on dual boot EFI partition, using my original grub configuration?
    It is more likely that Windows is just changing the boot order, so that Windows booting comes first.

    When running linux, either the installed version or the installer disk, use the following commands as root:

    Code:
    # efibootmgr -v
    # fdisk -l /dev/sda
    Post the output here. Use code tags (you can generate them with the "#" button in the edit window).

    When there are future problems, you should be able to use the "efibootmgr" command to restore the booting to grub. Once you post that output, we can try to work out the exact command that you need. That will be a lot easier than what you have been doing.

    It is also possible that your BIOS has a boot key you can use during boot. For my EFI box, it is F12. When I hit that, during boot, I get a BIOS boot menu. You might be able to get back into opensuse that way. At least it is worth trying.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  5. #5
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,317
    Blog Entries
    15

    Default Re: How can I reinstall grub on dual boot EFI partition?

    [QUOTE=nrickert;2636837]
    Code:
    # efibootmgr -v
    # fdisk -l /dev/sda
    Hi
    That should be gdisk not fdisk....
    Code:
    efibootmgr -v
    gdisk -l /dev/sda
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  6. #6
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,664
    Blog Entries
    3

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Quote Originally Posted by malcolmlewis View Post
    That should be gdisk not fdisk....
    "fdisk" probably works too. Try it.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  7. #7
    Join Date
    Mar 2010
    Location
    UTC +1
    Posts
    193

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Quote Originally Posted by superuzzo View Post
    [...] and using the Hibernate function often, on Windows and Linux.
    My guess is that this fact is responsible for much of your problems. I have been dual-booting for a while now, and I've never experienced what you describe - and I apply all security fixes and most of the feature upgrades as they are released. For many of my computers, without even testing first (well - they are the test ).

    Even over at Microsoft they say that keeping fast-boot and hibernation active while dual-booting is dangerous (that's the actual word used by their support people). And they, of course, only talk about dual-booting Windows OS-es. So Windows 8 even destroys other Windows OS-es. However, things doesn't change much if you switch Windows for other OS-es though, although Non-Windows OS-es may be more polite in how co-installed OS-es are treated.


    I think that you, in order to resolve your problem permanently, need to disable fast-boot and hibernation (in Windows) and hibernation (in Linux). The Windows-side disable is particularly important, since NTFS is accessible from Linux. If you make use of that, NTFS is in an undefined state while hibernated (fast-boot is a type of hibernation too), and you may corrupt NTFS if writing to it, or your results from reading NTFS may be unreliable. On top of that, Windows 8 also manipulates the EFI boot-order when hibernating.

    If disabling Linux hibernation is as important, others should comment - I have not used it due to the above. Chances are that Linux only "corrupts" its own file system (as viewed from outside of Linux) and doesn't hamper the boot situation as Windows 8.x does, and Windows cannot natively access a Linux file system anyway (but I bet someone somewhere has made a plug-in that enables such access). However, if you have multiple Linux installations, you probably will want to make sure that any Linux session makes a clean shutdown so you can access file system across OS-es as you wish.

    For a way to disable Windows 8 properly, you can see my how-to here: https://forums.opensuse.org/showthre...nux-UEFI-etc#4. If you need more that that, you should follow the advices from malcolmlewis and nrickert and take it from there (traditionally gdisk has been the tool to map out GPT disks, but since 13.1 fdisk also has GPT support. They call it "experimental support", so it will probably change somewhat in future releases. Both tools are included in 13.1).


    Good luck!

    dayfinger

  8. #8

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Thank you to everybody!

    My laptop doesn't have a boot key, I can access boot options from setup.
    Fast boot has been always disabled.

    I think hibernation has an importart role in this.... but I'm not sure, I need to do more tests using your advices
    Months ago, I read something about using UUID, instead of mount points, to let grub handle correctly hibernation between different systems.
    However, I guess using UUID won't also help to access NTFS partition from linux, isn't it?
    So maybe hibernation should be avoided on both OS


    Quote Originally Posted by nrickert View Post
    It is more likely that Windows is just changing the boot order, so that Windows booting comes first.
    Could it really change boot order on its own even if I will not use hibernation in future?



    Below is the output of commands I ran (fdisk wasn't useful):

    # efibootmgr -v

    Code:
    BootCurrent: 0001
    Timeout: 0 seconds
    BootOrder: 0001,0002,0000
    Boot0000*   Windows Boot Manager    Vendor(99e275e7-75a0-4b37-a2e6-c5385e6c00cb,)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
    Boot0001* opensuse      HD(2,fa000,96000,97287ad7-892c-49ee-ac22-8cf741104997)File(\EFI\opensuse\grubx64.efi)
    Boot0002*   Windows Boot Manager    HD(2,fa000,96000,97287ad7-892c-49ee-ac22-8cf741104997)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...e................


    # fdisk -l /dev/sda

    Code:
    Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk label type: dos
    Disk identifier: 0xd4739049
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1  4294967295  2147483647+  ee  GPT
    Partition 1 does not start on physical sector boundary.


    # gdisk -l /dev/sda

    Code:
    GPT fdisk (gdisk) version 0.8.7
    
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    Disk /dev/sda: 976773168 sectors, 465.8 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): C6738160-9539-41DF-BA9C-E75B787E8561
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 976773134
    Partitions will be aligned on 8-sector boundaries
    Total free space is 2029 sectors (1014.5 KiB)
    
    Number  Start (sector)    End (sector)  Size       Code  Name
       1            2048         1023999   499.0 MiB   2700  Basic data partition
       2         1024000         1638399   300.0 MiB   EF00  EFI system partition
       3         1638400         1900543   128.0 MiB   0C01  Microsoft reserved part
       4         1900544       793835519   377.6 GiB   0700  Basic data partition
       5       793835520       794552319   350.0 MiB   2700  
       6       929722369       974675968   21.4 GiB    2700  Basic data partition
       7       974675969       976773120   1024.0 MiB  2700  Basic data partition
       8       794552320       802959359   4.0 GiB     8300  primary
       9       802959360       929722367   60.4 GiB    8300  primary

  9. #9
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    15,664
    Blog Entries
    3

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Quote Originally Posted by superuzzo View Post
    Below is the output of commands I ran (fdisk wasn't useful):
    You are correct. The "fdisk" output is not useful. The new "fdisk" tries to emulate "gdisk", but it apparently fails to recognize that some disks are GPT partitioned. Your disk is one that it fails on.

    Quote Originally Posted by superuzzo View Post
    # efibootmgr -v

    Code:
    BootCurrent: 0001
    Timeout: 0 seconds
    BootOrder: 0001,0002,0000
    Boot0000*   Windows Boot Manager    Vendor(99e275e7-75a0-4b37-a2e6-c5385e6c00cb,)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
    Boot0001* opensuse      HD(2,fa000,96000,97287ad7-892c-49ee-ac22-8cf741104997)File(\EFI\opensuse\grubx64.efi)
    Boot0002*   Windows Boot Manager    HD(2,fa000,96000,97287ad7-892c-49ee-ac22-8cf741104997)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...e................
    Intesting. That first entry (Vendor) for Windows is new to me. I have not seen something like that. You can try deleting it with:
    Code:
    # efibootmgr -b 0000 -B
    and see if that fixes the problem.

    I'll note that you apparently did not install secure-boot support for opensuse. So you will need to leave secure-boot disabled.
    openSUSE Leap 15.3; KDE Plasma 5.18.6;

  10. #10
    Join Date
    Sep 2012
    Posts
    7,090

    Default Re: How can I reinstall grub on dual boot EFI partition?

    Quote Originally Posted by superuzzo View Post
    # efibootmgr -v
    At which state your system was when you made this output? According to it, it should boot openSUSE (in non-secure boot version).
    What would be really useful is the same output made when openSUSE does not boot and system goes straight to Windows (you will need to boot from live DVD or installation media to do it).

Page 1 of 2 12 LastLast

Posting Permissions

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