0

I've Lenovo B-4030 laptop which came pre-installed with Windows 8.1. I installed Ubuntu 14.04.1 along side this in UEFI mode (kept security mode off). Everything worked fine even when I updated windows 8.1 to windows 10 becaused I was able to get the grub back by using boot-repair tool. Then I upgraded to Ubuntu 16.04. After that I wasn't able to boot into windows 10. I don't know what caused this but I was not bothered by it because I was using Ubuntu as primary OS. But when I used a windows 10 bootable usb to recover windows 10, I was again able to boot into windows (I don't remember the steps).

But then I updated to Ubuntu 16.04.1 and I lost control of Windows again. The entry of windows in grub menu was empty (as I call it) because when I select it, it always bring me back to the grub menu. I used boot-repair to repair it. First it gave me an error which mentioned something like GPT detected. Create BIOS-boot, >1MB unformatted partition with bios_grub flag and something else. I used gparted to create a new unformatted partition after seeing this post but step 3 gave me some output saying "target can not be found". Then I installed rEFInd boot manager (even when I have no idea what it does). But nothing solved my problem.

Then I again executed boot-repair and this time it gave me the following result...

result of boot-repair

After all this adventure, I've decided to post this as a question because I don't want to explore more on my own.

Some more info:

Today I have been looking here and there when I found the RESULT.txt files of boot-repair. The content which I'm putting here is from two files; first part is from the file when I was running Ubuntu 14.04 alongside Windows 10 and second part from the file when I had upgraded to Ubuntu 16.04.

PART I

I have uploaded the text file. You can see it here:
http://pastebin.com/YpcJjkR5

PART II

The text can be found here:
http://pastebin.com/i9C6Xbyc

Main things that I want to highlight are:

  • Ignore sda6. It was just an experiment and I'm fully confident that this was not the culprit.

  • Note the starting of the report. Why there's a difference even in the beginning?

  • Entry 25_custom(corresponding to EFI/ubuntu/fwupx64.efi and EFI/ubuntu/MokManager.efi) in /etc/grub.d/ is missing in the later result. How/Why?

Although I have now come to realise that Windows Hibernation might be the cause of this problem but how do I solve this issue without using a Windows Recovery Disk (as I don't have one)?

3 Answers3

1

What happens if you mount all your hard drives and run sudo update-grub?

As your paste2.org file http://paste2.org/AXVH8wM8 tells:

update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-47-generic
Found initrd image: /boot/initrd.img-4.4.0-47-generic
Found linux image: /boot/vmlinuz-4.4.0-45-generic
Found initrd image: /boot/initrd.img-4.4.0-45-generic
Found linux image: /boot/vmlinuz-4.4.0-43-generic
Found initrd image: /boot/initrd.img-4.4.0-43-generic
Found linux image: /boot/vmlinuz-4.4.0-38-generic
Found initrd image: /boot/initrd.img-4.4.0-38-generic
Found linux image: /boot/vmlinuz-4.4.0-36-generic
Found initrd image: /boot/initrd.img-4.4.0-36-generic
Found linux image: /boot/vmlinuz-4.4.0-34-generic
Found initrd image: /boot/initrd.img-4.4.0-34-generic
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found initrd image: /boot/initrd.img-4.4.0-31-generic
Found linux image: /boot/vmlinuz-4.4.0-24-generic
Found initrd image: /boot/initrd.img-4.4.0-24-generic
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
Found linux image: /boot/vmlinuz-4.4.0-21-generic
Found initrd image: /boot/initrd.img-4.4.0-21-generic
Found linux image: /boot/vmlinuz-3.13.0-85-generic
Found initrd image: /boot/initrd.img-3.13.0-85-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
NTFS signature is missing.
Failed to mount '/dev/sda6': Invalid argument
The device '/dev/sda6' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount /dev/sda6 : Error code 12
mount -r /dev/sda6 /mnt/boot-sav/sda6
NTFS signature is missing.
Failed to mount '/dev/sda6': Invalid argument
The device '/dev/sda6' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
mount -r /dev/sda6 : Error code 12
Unhide GRUB boot menu in sda2/boot/grub/grub.cfg
Boot successfully repaired. You can now reboot your computer.

It seems that there is something wrong with your Windows mountpoint. You could try to remove the BIOS Boot partition on sda6 and repair Windows with its built in tools. Then, using a live DVD, you could repair your Grub again.

1

Some observations/questions/suggestions:

  • You've got a mishmash of BIOS/CSM/legacy-mode and EFI/UEFI-mode boot loaders on your disk. It looks like you're using EFI-mode primarily, which is good, because Windows will not boot in BIOS mode from a GPT disk, which you also have. Nonetheless, the BIOS-mode stuff is clearly sending you on wild goose chases. (The bios_grub partition, /dev/sda6, is used only by the BIOS version of GRUB, for instance, so time spent on it is wasted.) I recommend you read this page of mine for more on this subject.
  • Your Boot Repair output (at http://paste2.org/AXVH8wM8) lacks the grub.cfg file, which this output normally includes. This makes it impossible to comment on your GRUB configuration. You may want to post that file (it's at /boot/grub/grub.cfg once you boot into Ubuntu) to a pastebin site and post the URL to your document here for comment.
  • You've installed rEFInd (which I maintain, BTW), and Boot Repair shows the rEFInd files on your hard disk; but there's no evidence of a rEFInd entry in your boot manager. You may be able to create one by typing sudo efibootmgr -c -l \\EFI\\refind\\refind_x64.efi -L "rEFInd boot manager" in a Terminal window in Ubuntu. Once you do this, rEFInd should come up the next time you boot; however, the fact that the rEFInd boot entry is missing suggests that your firmware may be a bit flaky and not "taking" NVRAM changes. If so, or if you prefer not to change your default boot manager just now, you can try putting rEFInd on a USB flash drive or CD-R -- images for both are available at the rEFInd download link you put in your question. rEFInd can sometimes be more reliable about booting Windows than GRUB, which is why it's worth trying to get rEFInd working.
  • In theory, updates to Ubuntu should not affect your ability to boot to Windows through GRUB. This makes the fact that you ran into this problem twice rather troubling. My best guess is that you've neglected to disable the Windows Fast Startup and/or Hibernation features. These features can create filesystem damage on shared filesystems, including the ESP where boot loaders reside. Read how to disable Fast Startup here, and how to disable Hibernation here. Disable these features as soon as you get Windows booting again.
  • If my guess that Fast Startup/Hibernation is at the root of your problems is correct, you may be able to temporarily fix the problem by running dosfsck on /dev/sda1 (that is, sudo dosfsck /dev/sda1). In extreme cases, backing up the partition (at /boot/efi in Ubuntu), unmounting it, creating a fresh FAT32 filesystem on it, re-mounting it, editing /etc/fstab to use its new serial number, and restoring data to it may be necessary. In the long term, though, disabling Fast Startup and Hibernation is the only solution, should they be causing filesystem damage on the ESP.
Rod Smith
  • 44,284
  • 7
  • 63
  • 105
  • A) 1. I have installed Ubuntu in UEFI mode (not legacy). 2. I deleted the partition which was flagged as bios_grub. 3. I used boot-repair again to check if anything changes. I got the message: GPT detected. Please create a BIOS-boot partition... Alternatively, you can retry after activating the separate /boot/efi partition option. :( I want to emphasize that I could easily use both my OS's before the update. B) I have posted the grub.cfg file and here is it's link: http://paste.ubuntu.com/23503765/ C) Got your point about rEFInd. – Manish Kumar Bisht Nov 20 '16 at 02:56
  • D) Fast startup has always been disabled. E) Still I tried sudo dosfsck /dev/sda1 and it gave me a result: 'fsck.fat 3.0.28 (2015-05-16) /dev/sda1: 480 files, 12927/130812 clusters. – Manish Kumar Bisht Nov 20 '16 at 02:58
  • Your grub.cfg file looks OK, on a first pass. I suspect filesystem damage. Note that I'm referring to the Windows Fast Startup feature. Many EFIs have a feature with a similar name that many guides recommend disabling, but that feature is much less important. Also, you may need to disable Hibernation as well as Fast Startup. – Rod Smith Nov 21 '16 at 14:56
  • Yes, I was also talking about the Windows Fast Startup feature which I always keep disabled. I also think that using a Windows 10 bootable device may solve the problem. I'm insisting on solving it through Ubuntu because I don't have a bootable windows device and my internet connection is not so fast so I can't download it. :( – Manish Kumar Bisht Nov 22 '16 at 05:44
  • At this point I suggest you try using rEFInd, either installed on your hard disk or from a USB flash drive or CD-R. If that works, then you can use it instead of Windows. If not, it may at least display an error message that might be helpful in tracking down the cause of the problem. – Rod Smith Nov 22 '16 at 18:33
  • I tried using rEFInd and here is the error it gives when I tried to boot windows entry: Starting bootmgfw.efi Using load options '' Failed to open \EFI\Microsoft\Boot\grubx64.efi - Not Found Failed to load image \EFI\Microsoft\Boot\grubx64.efi: Not Found Failed to open \EFI\Microsoft\Boot\MokManager.efi - Not Found Failed to load image \EFI\Microsoft\Boot\MokManager.efi: Not Found Error: Not Found returned from bootmgfw.efi – Manish Kumar Bisht Nov 23 '16 at 01:34
  • That error message indicates, with near 100% certainty, that the FAT filesystem on your ESP is damaged. This is most often caused by the Windows Fast Startup or Hibernate features, so I urge you to triple-check that both these features are disabled. Filesystem damage can have other causes, of course. It's possible that backing it up, creating a fresh filesystem, and restoring it will resolve the issue. If it recurs, though, you must identify the root cause of the filesystem damage. – Rod Smith Nov 23 '16 at 15:44
  • This is regarding the error reported when I used rEFInd to boot into windows: It mentioned that it failed to open two things; first grubx64.efi and second MokManager.efi. I checked the sda1 manually and these files are not present in \boot\Microsoft\Boot folder. But these files are present in \boot\ubuntu. – Manish Kumar Bisht Nov 24 '16 at 05:53
  • Upon further reflection, it could be that Microsoft's bootmgfw.efi has been replaced by a copy of Shim (shimx64.efi). If so, you'll need to restore the original file from a backup or use Windows recovery tools to fix the problem. – Rod Smith Nov 25 '16 at 20:54
  • I'm unaccepting your answer @RodSmith as when I used a winPE bootable USB, I found that neither hibernation was on nor the fast start-up. Also, my Ubuntu and Windows were both installed in UEFI. I was successful in repairing the boot entry of Windows by using that WinPE bootable USB. Thankyou so much for your efforts. – Manish Kumar Bisht Jan 26 '17 at 11:03
1

In my case, as I found, my Boot Configuration Data (BCD) was somehow damaged so my system was not able to locate the Windows 10.
I followed the steps given below to resolve the issue;

  1. First of all, download ISO of WinPE from this website (Windows 10 Recovery Tool - Bootable Rescue Disk). You can surely download from other sites too.

  2. Make a bootable USB flash drive from the ISO of WinPE by following the instructions given on the page (how to create a bootable USB drive from command prompt).

  3. Boot into WinPE using the USB.

  4. Open a command prompt with administrative privilege.

  5. Input diskpart then press Enter.

  6. Input list vol then press Enter.

  7. Now you need to find the position of Boot Configuration Data(BCD) with the features given below.

    • Its format is FAT32.

    • Size could be 100MB/200MB/300MB/512MB
      for example: In my case, it was Volume 1. Note down the Volume No. carefully.

  8. Input select Volume No. then press Enter.

  9. Input assign Letter Z: then press Enter.
    You will see a message that DiskPart successfully assigned the drive letter or mount point.

  10. Input exit then press Enter.

  11. Input Bcdboot C:\Windows /s Z: /f UEFI then press Enter.
    If everything worked fine then you will get a message that Boot files successfully created.

  12. Input exit then press Enter.

  13. Restart the system.
    You will be able to boot into Windows 10.

The original steps I used to solve this problem can be found here.