Page 1 of 5 123 ... LastLast
Results 1 to 10 of 43

Thread: Grub - Add windows

  1. #1
    Join Date
    Dec 2008
    Beans
    220

    Grub - Add windows

    Because of the Ubuntu 20.04 update my system (dual boot with Windows 10, dual HD, amd64, UEFI) is a bit of a mess. For instance the boot loader thinks Ubuntu is the only flavor in town. I have been looking around and came up with the following change of the /etc/grub.d/40_custom file:
    Code:
    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    menuentry "Windows 10 (loader)"{
        insmod part_gpt
        search --no-floppy --set=root --fs-uuid 109C-D028
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
    }
    I tried to reboot but came up looking at a black screen, and no HD action. Clearly the wrong choice.

    I also tried:
    Code:
    sudo update-grub
    sudo grub-install /dev/sdb1
    That did not work out either. What options do I have?

  2. #2
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Grub - Add windows

    You never install grub to a partition.
    And if you install grub to a NTFS partition you break it, as it has its own essential data where grub is in PBR - partition boot record or BS - boot sector. NTFS does have a backup that often can be restored.

    But is system UEFI or BIOS?
    Is Windows installed in UEFI or BIOS boot mode?
    Microsoft has required vendors to install in UEFI mode to gpt partitioned drives since 2012. Users could use the old BIOS/MBR, but that was more for very old systems.

    Lets see details, use ppa version with your live installer (2nd option) or any working install, not Boot-Repair ISO:
    Please copy & paste the pastebin link to the Boot-info summary report ( do not post report), do not run the auto fix till reviewed.
    https://help.ubuntu.com/community/Boot-Repair &
    https://sourceforge.net/p/boot-repair/home/Home/
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  3. #3
    Join Date
    Dec 2008
    Beans
    220

    Re: Grub - Add windows


  4. #4
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Grub - Add windows

    You have now mixed UEFI & BIOS which is difficult to manage, but can be done with two drives if you really want to.
    You also have sda as gpt and sdb as MBR.
    Windows only boot in BIOS mode from MBR(msdos) partitioned drives. You have Windows on sdb with MBR, so Windows has to boot in BIOS mode. Boot flag then has to be on NTFS primary partition with Windows boot files, your sdb1.
    So use gparted and move boot flag back to sdb1 and your Windows repair flash drive booted in BIOS mode to install a Windows boot loader to MBR of sdb. You may be able to use Boot-Repair to install a Windows type boot loader syslinux to MBR of sdb.

    You somehow got an ESP - efi system partition on sdb. UEFI requires boot flag on ESP, but with Windows in BIOS mode cannot have another boot flag on Windows. Only one boot flag per drive.

    Do not use auto fix with Boot-Repair when you have multiple drives. Only use advanced mode.
    And be sure to boot in boot mode you want to repair UEFI or BIOS.

    Better to back up Windows and reinstall in UEFI boot mode to gpt partitioned drive. But that will erase sdb, so backups required. Which you should have anyway when doing major system changes.

    You have both a BIOS boot grub entry in both MBR and UEFI boot of grub in both drives.
    You need to remove ESP on sdb, and have Windows boot loader in MBR of sdb.
    If you want Ubuntu in UEFI boot mode (on either drive) you need to boot Boot-Repair in UEFI mode and reinstall grub in UEFI mode to sda.
    If you want Ubuntu in BIOS mode on gpt drive, your sda, you need a tiny 1 or 2MB unformatted partition with bios_grub flag. Use gparted. Then use Boot-Repair in BIOS mode and only install grub to sda.

    Windows only boots in UEFI mode from gpt drives. Microsoft has required vendors to install in UEFI/gpt boot mode since 2012 and release of Windows 8. Users could install in BIOS mode, but mostly allowed for old non-UEFI based hardware.
    GPT Advantages (older 2010 but still valid) see post#2 by srs5694:
    http://ubuntuforums.org/showthread.php?t=1457901 &
    https://wiki.archlinux.org/index.php...antages_of_GPT
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  5. #5
    Join Date
    Dec 2008
    Beans
    220

    Re: Grub - Add windows

    That went fast to hell in a basket. Probably made some bad choices when it went wrong. Let's not elaborate an that too much.

    I had an unstable system where I had to install Ubuntu numerous times. Somewhere along the way I got the impression to create an UEFI on the Linux HD. I finally got a more or less stable system. After that I lost my access to Windows (if I remember correctly).

    So what steps do I need to do? What you have written seems a bit post-grad science to me. Beyond me.

  6. #6
    Join Date
    Dec 2008
    Beans
    220

    Re: Grub - Add windows

    If I remember correctly I added a small (200 mb) partition for UEFI. I can reinstall, and remove that partition, add the space back to my swap partition. I introduced the UEFI partition because my installation process failed time and time again. Would it help to remove UEFI partition, reinstall, and when installation crashes to run Boot-Repair?
    Last edited by Macamba; October 9th, 2020 at 11:59 AM.

  7. #7
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Grub - Add windows

    Solution depends on what you want to end up with.

    You have UEFI system, but Windows in BIOS mode.
    If you just want to stay with BIOS add a bios_grub partition to sda. And reinstall BIOS boot loaders to each drive, grub to sda & Windows to sdb. Grub only boots working Windows, so you still have to keep Windows fast start up off. If Windows turns it on, then directly boot Windows using Windows boot loader in sdb.

    Long term probably better to reinstall Windows in UEFI boot mode. But major change as that erases sdb.

    You just need to always be consistent. Always UEFI or always BIOS.
    Default boot mode setting in UEFI, only applies to installed systems.
    You have to select UEFI or BIOS from most flash drive live installer or Windows repair disk each time you boot. And it installs or repairs in mode you boot flash drive.
    Some installers only create an UEFI installer or a BIOS installer (not both). So when creating flash drive you may have to have correct selection there first. ISO is configured to be both.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  8. #8
    Join Date
    Dec 2008
    Beans
    220

    Re: Grub - Add windows

    Quote Originally Posted by oldfred View Post
    Solution depends on what you want to end up with.

    You have UEFI system, but Windows in BIOS mode.
    If you just want to stay with BIOS add a bios_grub partition to sda. And reinstall BIOS boot loaders to each drive, grub to sda & Windows to sdb. Grub only boots working Windows, so you still have to keep Windows fast start up off. If Windows turns it on, then directly boot Windows using Windows boot loader in sdb.
    My constellation worked before in what appears to be BIOS-mode. So during partitioning change the UEFI partition to BIOS? Is that a choice I will see during installation/partitioning?

    Next you say: "reinstall BIOS boot loaders to each drive". Ehm, how? Does the live CD do it automatically? Or need I instruct it to do it? How?

    Then you say "grub to sda & Windows to sdb". I think grub is installed on sda, and I do not change anything of my installation of Windows on sdb, so I am in the clear on that account? Otherwise, what do I need to do?

    Oh, and thanks for your help.

  9. #9
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Grub - Add windows

    Grub does not correctly install to gpt partition drives in BIOS mode unless you have a bios_grub partition.
    With MBR, there is space after the MBR and before first partition for core.img or more of grub's BIOS boot code.
    So with gparted on live installer, shrink any partition on sda, by several MB and add a 1MB unformatted partition with bios_grub flag.
    Then with Boot-Repair in BIOS mode, reinstall grub to sda using advanced mode.

    See if Boot-Repair's advanced mode offers to install a Windows boot loader to sdb, but if fast start up on, it may not see your Windows to offer to install a Windows type boot loader to sdb.


    You may be able to manually install syslinux which is a Windows type boot loader. I have seen two versions, not sure which path is correct?
    sudo apt-get install syslinux
    sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdb
    sudo dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sdb

    My UEFI system still has syslinux in the SYSLINUX folder? And in a syslinux-legacy folder. Not sure if different mbr.bin?
    sudo dd if=/usr/lib/SYSLINUX/mbr.bin of=/dev/sdb
    Best to use your Windows repair flash drive and run fixMBR.
    For more info on UEFI boot install & repair - Regularly Updated :
    http://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

  10. #10
    Join Date
    Dec 2008
    Beans
    220

    Re: Grub - Add windows

    That failed :')

    Code:
    Executing 'grub-install /dev/sda' failed
    This is a fatal error
    I could not find a choice bios_grub flag. The closes I could get was allocating 16 MB as "Reserved BIOS boot area". I could not find a choice bios_grub flag.

    During partitioning my choices where:
    Code:
    partition #1 of SCSI2 (0,0,0) (sda) as biosgrub
    partition #4 of SCSI2 (0,0,0) (sda) as swap
    partition #2 of SCSI2 (0,0,0) (sda) as ext4
    As grub-install failed I have totally not working system again. Now I am thinking about trying to install the previous working version of Ubuntu (18.something).
    Last edited by Macamba; October 13th, 2020 at 03:16 PM.

Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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