No Windows on Grub, UEFI X MBR mess... :(

Hi all!

First, I would like to point out that I’m aware specially of the thread https://forums.opensuse.org/showthread.php/519097-repair-MBR.

I seem to have run into the same problem somehow, but I’m really not sure if it is precisely the same. Also, in the midst of the lots of information provided there, I’m unsure on how to proceed.

Unfortunately, despite using suse for several years, I was afraid of how to deal with the “uefi thinguie” in this friend’s computer (lended to me), where the windows partition should be keept on and bootable. So afraid that I got a system where the windows option was not appearing on boot.

My first trial looking for an answer seemed simple, ending on a simple edition of the 40_custom file and and grub mkconfig, that ended up on an Windows entry appearing in the grub menu. However, when trying to use it, I’ve found out that the system complained about a bootmgfw.efi file that it could not find: in fact, not even the /efi appears on my system. Clearly, it is not booting on efi.

The thread above let me now about some important commands on this issue, whose output I display below:


fdisk -l

Disk /dev/sda: 465,8 GiB, 500107862016 bytes, 976773168 sectors
Unidades: setor de 1 * 512 = 512 bytes
Tamanho de setor (lógico/físico): 512 bytes / 4096 bytes
Tamanho E/S (mínimo/ótimo): 4096 bytes / 4096 bytes
Tipo de rótulo do disco: dos
Identificador do disco: 0xb85dbc62

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1          206848 375597055 375390208   179G  7 HPFS/NTFS/exFAT
/dev/sda2  *    375597056 934432767 558835712 266,5G  f W95 Ext'd (LBA)
/dev/sda5       375599104 383969279   8370176     4G 82 Linux swap / Solaris
/dev/sda6       383971328 384483327    512000   250M 83 Linux
/dev/sda7       384485376 934432767 549947392 262,2G 83 Linux


gdisk
GPT fdisk (gdisk) version 0.8.8

Type device filename, or press <Enter> to exit: /dev/sda1 
Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************

Exact type match not found for type code 4F00; assigning type code for
'Linux filesystem'
Exact type match not found for type code 7300; assigning type code for
'Linux filesystem'
Exact type match not found for type code 2B00; assigning type code for
'Linux filesystem'
Exact type match not found for type code 6100; assigning type code for
'Linux filesystem'

Warning! Secondary partition table overlaps the last partition by
3396895635 blocks!
You will need to delete this partition or resize it in another utility.

Command (? for help): q


parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) list                                                             
  align-check TYPE N                        check partition N for TYPE(min|opt)
        alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available
        devices, free space, all found partitions, or a particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  resize NUMBER END                        change end sector of partition NUMBER
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright
        information of GNU Parted
(parted) help                                                             
  align-check TYPE N                        check partition N for TYPE(min|opt)
        alignment
  help [COMMAND]                           print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END     make a partition
  name NUMBER NAME                         name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER]     display the partition table, available
        devices, free space, all found partitions, or a particular partition
  quit                                     exit program
  rescue START END                         rescue a lost partition near START and END
  resize NUMBER END                        change end sector of partition NUMBER
  rm NUMBER                                delete partition NUMBER
  select DEVICE                            choose the device to edit
  disk_set FLAG STATE                      change the FLAG on selected device
  disk_toggle [FLAG]                       toggle the state of FLAG on selected device
  set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
  unit UNIT                                set the default unit to UNIT
  version                                  display the version number and copyright
        information of GNU Parted
(parted) print                                                            
Model: ATA Hitachi HTS54755 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start  End    Size    Type      File system     Flags
 1      106MB  192GB  192GB   primary   ntfs            type=07
 2      192GB  478GB  286GB   extended                  boot, lba, type=0f
 5      192GB  197GB  4286MB  logical   linux-swap(v1)  type=82
 6      197GB  197GB  262MB   logical   ext2            type=83
 7      197GB  478GB  282GB   logical   xfs             type=83

(parted) quit


grub2-probe -d /dev/sda1
ntfs

Can anybody please provide me some help on here? Am I with an windows-uefi + linux-non-uefi, or the opposite? How can I properly repair this and have both systems bootable, without anyones data loss?

Thanks a lot in advance! :slight_smile:

It is not clear what you have.

Your disk seems to be MBR partitioned. However, it has an invalid GPT partition table somewhere, which suggests that it might have been GPT partitioned and later converted to MBR partitioning.

If Windows was installed for UEFI, then you have probably broken it. In particular, the EFI partition is missing and Windows installed for UEFI needs GPT partitioning.

If Windows was installed for MBR partitioning, then you probably just need some sort of rescue.

The mention of “bootmgfw.efi” suggests that Windows is using UEFI. However, that message could also come from what you added to 40_custom. So check there. If your entry in 40_custom mentions “bootmgfw.efi”, then perhaps you have the wrong information there – you have EFI booting commands instead of MBR booting commands.

At this stage, I can’t really give any good advice. Perhaps consult your memory as to whether you changed the partitioning during install.

Thank you nrickert.

Well, last things first: I won’t be able to remember that… around 6 months later! :stuck_out_tongue: I just do remember wanting to NOT use an extended partition during the install and the opensuse partitioner obligating me to do so.

My 40_custom reads at the moment:


#!/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" {
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
search --fs-uuid --no-floppy --set=root 62081D53081D2815
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}

Maybe a wrong clue but: if the windows was not actually installed under uefi, how should it look like?

Any extra command line I can try here?

Thanks a lot! :slight_smile:

Please show output of “os-prober” command on Linux as root.

That 40_custom is for Windows that is using EFI.

Looking at an older windows system (booting in MBR mode), it looks as if you should change that “chainloader” line to


chainloader +1

There is still a question on why this is not in your boot menu. That’s why arvidjaar wanted to see the output from “os-prober” (which you would run as root).