[SOLVED] How to boot/restore grub after installing Windows in UEFI system

Forum Forums New users New Users and General Questions [SOLVED] How to boot/restore grub after installing Windows in UEFI system

  • This topic has 19 replies, 4 voices, and was last updated Feb 17-6:20 pm by Anonymous.
Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #35844
    Member
    kaye

      Hello Friends!

      Originally I had only Debian and antiX installed on my laptop. Everything worked fine. Then I made it a triple boot by installing Windows 7 64-bit.

      Please have a look at the attached file. The partition table of the hard drive is GPT.

      Before anything else, let me say that I always intentionally install Windows in a spot OTHER than the leftmost/start of the hard drive. I just prefer it that way.

      The problem right now is that GRUB is gone, as expected, but this time I am unable to bring it back.

      I turn on laptop, go to BIOS, enabled the legacy boot so I can boot my antiX live USB (is it because the live USB has a partition table of “MSDOS” ?)

      I insert my antiX live USB, which has a partition table of “MSDOS” (if you look in GParted). I run Boot Repair. I choose:

      “Reinstall GRUB bootloader on ESP, MBR or PBR (root)”

      For “Install on:” I choose ESP

      For “Location:” sda2 100M vfat is automatically detected and selected.

      For “Select root location:” I choose my “sda8 15G ext4 antix_root”

      I click Apply button

      For “Select /boot/efi location:” I choose again the sda2 100M vfat

      Success dialog box appears which says ‘Process finished with success.’

      So I exit.

      I reboot, disabled the legacy boot so I can boot the efi hard drive, and change boot order to hard drive.

      Still no GRUB. It still boots directly to Windows.

      I need your help! I can’t figure it out after two days.

      Many thanks!!!

      • This topic was modified 2 years, 11 months ago by kaye.
      Attachments:
      #35848
      Member
      Xecure
        Helpful
        Up
        0
        ::

        0. Make sure Secure Boot is disabled in BIOS and EFI is correctly installed. In the live system, use a file manager to (mount and) navigate to the EFI partition. You should see an antiX19 (or whatever version) folder there.
        1. Can you select boot partition in your BIOS? You can sometimes choose not only device boot order but also system boot order (related to what BIOS detects in the EFI partition). You should be able then to change the boot order and move antiX to the top.
        2. You should be able to start antiX live USB without having to select “Legacy boot” (maybe you didn’t burn the USB with the antiX Live USB maker?). In the boot window, before going in to the antiX system, try to find and load the antiX EFI. In the boot window, select “Boot Rescue menus” > Find EFI bootloaders” and select the antiX EFI bootloader (the one on sda2, not the USB one). Try to load antiX from there.

        If you still have problems, we may need more info. What computer are you using? (an inxi -Fxz would be nice).

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

        #35850
        Member
        kaye
          Helpful
          Up
          0
          ::

          Hello Xecure!

          I’ll try your steps later, in the meantime, inxi -Fxz shows:

          System:
          Host: antix1 Kernel: 4.9.200-antix.1-amd64-smp x86_64 bits: 64
          compiler: gcc v: 8.3.0 Desktop: IceWM 1.6.3+git20191202
          Distro: antiX-19.1_x64-full Marielle Franco 23 December 2019
          base: Debian GNU/Linux 10 (buster)
          Machine:
          Type: Laptop System: SAMSUNG product: R439/R478 v: N/A serial: <filter>
          Mobo: SAMSUNG model: R439/R478 serial: <filter> BIOS: Phoenix
          v: 00UN.M001.20100814.LEO date: 08/14/2010
          Battery:
          ID-1: BAT1 charge: 10.0 Wh condition: 10.0/44.4 Wh (22%)
          model: SAMSUNG Electronics status: Full
          CPU:
          Topology: Dual Core model: Intel Core i3 M 380 bits: 64 type: MT MCP
          arch: Nehalem rev: 5 L2 cache: 3072 KiB
          flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 20217
          Speed: 933 MHz min/max: 933/2533 MHz Core speeds (MHz): 1: 933 2: 1333
          3: 933 4: 1066
          Graphics:
          Device-1: AMD Park [Mobility Radeon HD 5430/5450/5470] vendor: Samsung Co
          driver: radeon v: kernel bus ID: 02:00.0
          Display: x11 server: X.Org 1.20.4 driver: ati,radeon
          unloaded: fbdev,modesetting,vesa resolution: 1366×768~60Hz
          OpenGL:
          renderer: AMD CEDAR (DRM 2.49.0 / 4.9.200-antix.1-amd64-smp LLVM 7.0.1)
          v: 3.3 Mesa 18.3.6 direct render: Yes
          Audio:
          Device-1: Intel 5 Series/3400 Series High Definition Audio
          vendor: Samsung Co driver: snd_hda_intel v: kernel bus ID: 00:1b.0
          Device-2: AMD Cedar HDMI Audio [Radeon HD 5400/6300/7300 Series]
          vendor: Samsung Co driver: snd_hda_intel v: kernel bus ID: 02:00.1
          Sound Server: ALSA v: k4.9.200-antix.1-amd64-smp
          Network:
          Device-1: Broadcom Limited BCM4313 802.11bgn Wireless Network Adapter
          vendor: Wistron NeWeb driver: wl v: kernel port: 2000 bus ID: 03:00.0
          IF: wlan1 state: up mac: <filter>
          Device-2: Marvell 88E8040 PCI-E Fast Ethernet vendor: Samsung Co
          driver: sky2 v: 1.30 port: 5000 bus ID: 07:00.0
          IF: eth1 state: down mac: <filter>
          Drives:
          Local Storage: total: 502.02 GiB used: 28.60 GiB (5.7%)
          ID-1: /dev/sda vendor: Toshiba model: MK5065GSX size: 465.76 GiB
          ID-2: /dev/sdb type: USB vendor: Transcend model: JetFlash Transcend 8GB
          size: 7.36 GiB
          ID-3: /dev/sdc type: USB vendor: Kingston model: DT 101 G2 size: 28.90 GiB
          Partition:
          ID-1: / size: 4.52 GiB used: 185.3 MiB (4.0%) fs: overlay source: ERR-102
          Sensors:
          System Temperatures: cpu: 52.0 C mobo: 52.0 C gpu: radeon temp: 54 C
          Fan Speeds (RPM): N/A
          Info:
          Processes: 168 Uptime: 55m Memory: 5.70 GiB used: 1.08 GiB (18.9%)
          Init: SysVinit runlevel: 5 Compilers: gcc: 8.3.0 Shell: bash v: 5.0.3
          inxi: 3.0.36

          #35852
          Member
          Xecure
            Helpful
            Up
            0
            ::

            I tried to find out if your device has UEFI support (I don’t know your exact model, but I searched for R439/R478 models), and nothing seems to indicate this.

            https://downloadcenter.samsung.com/content/UM/201110/20111011152910227/Dos_Manual_eng.pdf

            If in the “Boot” options in the BIOS you can see an option:
            UEFI Boot Support: [Enabled]
            or
            OS Mode Selection: [UEFI OS]
            Then you should have UEFI support and the system should be able to boot from EFI.

            If there is not such an option, and you can’t find a
            Secure boot: [Disabled]
            then it is very likely you don’t have EFI support. You will need to install GRUB to MBR.

            I turn on laptop, go to BIOS, enabled the legacy boot so I can boot my antiX live USB

            Is this Legacy USB maybe? I have no idea for this kind of laptop, but maybe the only thing this does is enable boot from USB and has nothing to do with UEFI or Legacy boot options.

            After you do the tests we may know more.

            antiX Live system enthusiast.
            General Live Boot Parameters for antiX.

            #35860
            Member
            kaye
              Helpful
              Up
              0
              ::

              Let me slightly correct my own statement. Sorry about that!

              I turn on laptop, go to BIOS, enabled the legacy boot so I can boot my antiX live USB

              I went back to BIOS and saw that it’s actually ‘Legacy OS Booot’. It can be Enabled or Disabled. The description for this setting is as follows:

              Select Enabled to attempt Legacy OS Boot only.
              Select Disabled to attempt EFI Boot first, Legacy OS Boot second.

              I guess this answers your question of whether my laptop has UEFI support?

              As for Secure Boot, I cannot find it.

              As for selecting boot partition, the BIOS does not seem to have it.

              Just as a reminder, going back to ‘Legacy OS Boot’, I find that it really needs to be Enabled if I want to boot my antiX live USB.

              If ‘Legacy OS Boot’ is Disabled, and I try to boot the hard drive, it goes directly to Windows – no GRUB.

              If ‘Legacy OS Boot’ is Enabled, and I try to boot the hard drive, I get this message on the screen:

              error: no such partition.
              Entering rescue mode...
              grub rescue>

              I am typing this right now in my antiX live USB session. I open spacefm as root so I can mount sda2. In the directory /media/sda2/EFI , there are 3 folders:

              antiX19.1
              Boot
              Microsoft

              I guess this confirms your Point 0 ?

              I will do your Point 2 several hours from now.

              2. You should be able to start antiX live USB without having to select “Legacy boot” (maybe you didn’t burn the USB with the antiX Live USB maker?). In the boot window, before going in to the antiX system, try to find and load the antiX EFI. In the boot window, select “Boot Rescue menus” > Find EFI bootloaders” and select the antiX EFI bootloader (the one on sda2, not the USB one). Try to load antiX from there.

              #35861
              Member
              Xecure
                Helpful
                Up
                0
                ::

                Ok. Sorry for the confusion. Now we know it is UEFI ready.

                For the USB booting maybe you have to disable “Fast Bios mode” (if available)

                I don’t know the options in your BIOS, but I found for a samsung laptop:
                https://www.youtube.com/watch?v=D0ylA1ltqEo

                Then, when you have time, (with UEFI enabled), try to launch antiX through the live boot menu (find EFI). If it launches properly, then we will try to figure out how to set antiX UEFI as first boot instead of Windows.

                antiX Live system enthusiast.
                General Live Boot Parameters for antiX.

                #35864
                Member
                kaye
                  Helpful
                  Up
                  0
                  ::

                  Let me add this: Inside /media/sda2/EFI/antiX19.1 , there is a file named grubx64.efi

                  I did the following just now, then I’ll be offline for several hours.

                  I booted the antiX live USB, found ‘Boot Rescue Menus’, entered it. It does not seem to have ‘Find EFI bootloaders’ . It does have the following:

                  Find GRUB bootloaders
                  Find GRUB menus
                  Find Windows bootloaders
                  Reboot 
                  Power Off
                  Back to main menu

                  I choose ‘Find GRUB bootloaders’

                  In the next screen, I see the following:

                  searching grub bootloaders...
                  found GRUB bootloader at (hd0,msdos1)    : antiX-Live-usb
                  found GRUB bootloader at (hd1,gpt8)      : antix_root
                  ... finished
                  Press enter to continue

                  Then I think I pressed enter, then maybe chose to run the bootloader in the hard drive (sorry I forgot to take note of this particular step), and the next screen showed:

                  error: no such partition.
                  Entering rescue mode...
                  grub rescue> 
                  #35878
                  Member
                  kaye
                    Helpful
                    Up
                    0
                    ::

                    I am currently using antiX that is installed in my laptop hard drive. This is how I got in:

                    I boot antiX live USB, chose

                    Switch to GRUB bootloader

                    then Boot Rescue Menus

                    Then Find GRUB Menus, press enter

                    It says,

                    Searching grub.cfg menus...
                    Found grub menu at (hd0,msdos2)  :  antix-uefi
                    Found grub menu at (hd0,msdos1)  :  antix-Live-usb
                    Found grub menu at (hd1,gpt8)  :  antix_root
                    Found grub menu at (hd1,gpt6)  :  debian_root
                    ...finshed
                    Press enter to continue

                    I press enter

                    I chose antix_root , then was able to access GRUB that is in the hard drive (?), and logged into my hard drive antiX.

                    I wish to be able to log in my hard drive antiX without having to do all this, and also add the installed Windows 7 64-bit in the restored GRUB.

                    • This reply was modified 2 years, 11 months ago by kaye.
                    #35887
                    Member
                    Xecure
                      Helpful
                      Up
                      0
                      ::

                      For setting up EFI boot order from your installed antiX system.

                      0. Open a terminal and install efibootmgr
                      sudo apt install efibootmgr

                      1. On terminal, check the current EFI boot order by executing efibootmgr
                      efibootmgr
                      Example:

                      $ efibootmgr
                      Timeout: 1 seconds
                      BootOrder: 0002,0000,0001
                      Boot0000* antiX System
                      Boot0001* debian System
                      Boot0002* Windows Boot Manager

                      Pay atention to the numbers for each boot and the boot order.

                      2. Now you are going to set antiX System as the first one in the boot order with efibootmgr -o order,separated,by,commas
                      For the previous example:
                      sudo efibootmgr -o 0000,0001,0002
                      Substitute the numbers for the ones in your system and set the boot order as described above.

                      3. Restart your system.
                      Now antiX should be the first to boot
                      (remember to set UEFI boot and not legacy).

                      antiX Live system enthusiast.
                      General Live Boot Parameters for antiX.

                      #35895
                      Member
                      kaye
                        Helpful
                        Up
                        0
                        ::

                        When I executed efibootmgr, I get this:

                        EFI variables are not supported on this system.

                        Is this because I got into my installed antiX by way of the antiX live USB, which can only be booted if the Legacy OS Boot is enabled (meaning EFI wasn’t used).

                        Currently this method is the only way I can boot into my installed antiX in my hard drive – via the antiX live USB.

                        Should I create another antix live USB? Please see attached files and check if the antix live USB looks ok. I’m pretty sure I created it using antiX’s own live usb maker.
                        Look at the partition table, it’s MSDOS.

                        • This reply was modified 2 years, 11 months ago by kaye.
                        • This reply was modified 2 years, 11 months ago by kaye.
                        #35906
                        Member
                        Xecure
                          Helpful
                          Up
                          0
                          ::

                          Is this because I got into my installed antiX by way of the antiX live USB, which can only be booted if the Legacy OS Boot is enabled (meaning EFI wasn’t used).

                          This is the most probable case.

                          Seeing your screenshot, I believe the antiX live USB is ok.

                          Try to find out if there is something that blocks the USB to startup in EFI mode in the BIOS.

                          There seems to be different options in different Samsung laptops, but I would guess it is a security intended behavior that, by default, you cannot boot from USB except if you change a BIOS setting (as illustrated in the video I linked before).

                          Try to find a manual for your specific device or read the different options in your BIOS to enable USB boot with UEFI mode turned on.

                          antiX Live system enthusiast.
                          General Live Boot Parameters for antiX.

                          #35920
                          Member
                          kaye
                            Helpful
                            Up
                            0
                            ::

                            No matter what I do I cannot boot from the antiX live USB. I even recreated it but this time with partition table of GPT (the old one was MSDOS partition table). Still can’t boot.

                            I was wondering, could I create an antiX live CD? How do I do it? I can’t find the instructions for it. Maybe a live CD would be bootable in uefi mode?

                            Thank you.

                            #35923
                            Member
                            Xecure
                              Helpful
                              Up
                              0
                              ::

                              I don’t think it will help. Your live USB was already good to go. I believe there is still some option in the BIOS, but let us forget about it for now.

                              You will have to se the boot manager in Windows. These instructions may be a bit off but hopefully we can figure it out. (This is me testing this on W10. No guaranties it will work with W7)

                              0. Go back to the BIOS and set UEFI boot. It is important this is working first.

                              1. Start Windows 7 and wait for it to load.

                              2. Open a command line promp with administrative priviledges (for example, start powershell as Administrator).

                              3. Check to see the boot manager that is working for Windows executing this in the command line:
                              bcdedit /enum

                              4. A list should show up. It is important that the {bootmgr} has a path similar to \EFI\MICROSOFT\BOOT\BOOTMGR.EFI
                              The important part is that it is a .EFI file. If there is no EFI file for the boot manager, it means that windows is not using EFI to boot. If so, that means your system has never used the EFI booting. You will have to return to loading antiX live system and installing grub to MBR instead of EFI.
                              If there IS an EFI file managing the boot, then continue to step 5

                              5. Mount the EFI partition in the Command Promp with:
                              mountvol S: /S
                              This will mount the EFI partition to S:

                              6. Navigate to the EFI partition and check the path for antiX EFI.

                              cd S:\EFI\
                              ls

                              What I see is that I have a folder named Microsoft (containing the efi for booting windows) and an antiX19 folder where the EFI file to load antiX is stored.
                              I believe you said your folder was antiX19.1 Make sure that to pay attention to the your correct folder name and use it in the next step.

                              7. Now that you know the correct path to your antiX system EFI file, you will set it as the path for the boot manager
                              bcdedit /set {bootmgr} path \EFI\antiX19\grubx64.efi
                              Remember to use your correct path (mine is \EFI\antiX19\grubx64.efi, yours may be \EFI\antiX19.1\grubx64.efi but make sure what your correct path is).

                              8. Check that your boot manager path is correct
                              bcdedit /enum
                              It should now display

                              device       partition=S:
                              path         \EFI\ANTIX19\GRUBX64.EFI

                              9. If everything is correct, now reboot. You should now see the antiX GRUB instead of Windows.

                              antiX Live system enthusiast.
                              General Live Boot Parameters for antiX.

                              #35926
                              Forum Admin
                              rokytnji
                                Helpful
                                Up
                                0
                                ::

                                Try a different usb stick also. You might have roached the one you are using. I have messed em before so they are only good for storage.

                                Sometimes I drive a crooked road to get my mind straight.
                                Not all who Wander are Lost.
                                I'm not outa place. I'm from outer space.

                                Linux Registered User # 475019
                                How to Search for AntiX solutions to your problems

                                #35943
                                Member
                                kaye
                                  Helpful
                                  Up
                                  0
                                  ::

                                  I did try a different usb stick, same thing. Although one’s not much newer than the other.

                                  Inside Windows, I was stuck at:

                                  bcdedit /enum

                                  It says,

                                  The boot configuration data store could not be opened. The system cannot find the file specified.

                                Viewing 15 posts - 1 through 15 (of 20 total)
                                • You must be logged in to reply to this topic.