After installing the Windows 10 upgrade on my laptop, it ruined the grub boot manager, and I could only boot in windows 10. I fixed the boot manager using a live cd with the boot-repair tool, but it only recognized the Ubuntu partition, and not the Windows one.

So I edited the /etc/grub.d/40_custom file and added the following contents:

menuentry "Windows 10" {
    set root='(hd0,3)'
    chainloader +1

After running sudo update-grub2, I got an entry in the boot menu, but the partition does not load. It gives the following error:

Error: Invalid signature.

enter image description here

Does anybody know how one can overcome this error?

My most recent boot-repair dump is here: http://paste.ubuntu.com/11965327/, and the partition I want to boot is this one:

sda4: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /bootmgr /Windows/System32/winload.exe
  • @Fabby: That's interesting. I would rather not mess up my ubuntu partition since it's the one use primarily. I am now downloading the windows 10 image from microsoft, and I will try to install it as non-UEFI if it has the option.
    – user000001
    Jul 30 '15 at 11:26
  • Comment deleted and converted to an answer... Please leave future comments down under... ;-)
    – Fabby
    Jul 30 '15 at 11:27

There are some peculiarities about your installation:

  • Your computer has two Windows Recovery Environment partitions, /dev/sda1 and /dev/sda5. My guess is one is from your previous Windows installation and the other is for the new installation, but I can't be positive of that. I doubt if this duplication is causing you any problems per se; I mention it simply because it's a sign of a history of changes to the machine, and such changes may be both the cause of problems and make it difficult to figure out what's wrong.
  • Your EFI System Partition (ESP) is /dev/sda4. This is perfectly legal, but is unusual; the ESP is normally /dev/sda1 or /dev/sda2. The ESP holds EFI-mode boot loaders and related files. My hunch is that the ESP was created late in the machine's history -- perhaps it was Ubuntu-only at one point and then you installed Windows, which created the ESP in this unusual location.
  • The Boot Info Script output doesn't identify any EFI boot loaders on the ESP. My suspicion is that they do exist, but the script has omitted these entries. (I've seen this happen from time to time.) OTOH, if those files are missing, then it means that Windows has failed to install its boot loader. The same may be true of Ubuntu, too; but see below....
  • Your disk uses the GUID Partition Table (GPT), which means that Windows will install to and boot from this disk only in EFI mode; but there's evidence of a BIOS-mode installation of GRUB, the standard Ubuntu boot loader. Such a mish-mash means that you'd not be able to boot Windows from a BIOS-mode GRUB on this computer. It could be you've also got an EFI-mode GRUB and had been booting that way; or maybe you had been switching between OSes by using the computer's built-in boot manager (typically accessed by hitting Esc, Enter, or a function key at start time).

At this point, your best bet is to install an EFI-mode boot loader for Linux. There are two ways to do this that are relatively safe and easy. Both work best if you first enter your firmware and completely disable any option to boot using BIOS, CSM, or legacy mode. (Those are three terms for the same thing.) Sometimes these options are phrased the other way -- you must enable EFI or UEFI support. With that done, do one of two things:

  • Method 1: Boot your Ubuntu install disk, ensure you've booted in EFI mode by looking for the /sys/firmware/efi directory (if it's present, you've booted in EFI mode), install the boot-repair package, and run it. This should repair your installation by installing an EFI version of GRUB. This usually works, but occasionally it doesn't. I realize you've already run Boot Repair, but my suspicion is that you ran it in BIOS mode, which of course means it would install the BIOS-mode GRUB, which will be useless for booting Windows.
  • Method 2: If you haven't done so already, disable Secure Boot in your firmware. You can then download and prepare a boot medium from the CD-R or USB flash drive version of my rEFInd boot manager. Boot to it; it should show you a menu with at least one option for each of Windows and Ubuntu. Test these to be sure you can boot both OSes, then boot Ubuntu. At this point, you can install the rEFInd Debian package or PPA. (Alternatively, you could install the EFI version of GRUB.) You may be able to re-enable Secure Boot at this point, but you may need to jump through some extra hoops to get it to work.

There should be no need to re-install Ubuntu, and probably not to re-install Windows. BIOS-mode and EFI-mode installations of Ubuntu are identical except for the boot loader (and related partitions -- but you've got the partitions to handle both modes).

  • In the meantime, the situation has deteriorated a bit... I tried re-installing windows from an image, and it deleted my former windows partition (i.e. /dev/sda4). I also switched to UEFI using the instructions from this answer. I suspect that Boot Repair doesn't find the windows partition because it's been deleted, but I will try to install a fresh copy of windows tomorrow, when I will have a second PC in case the installation screws up the MBR again. Now I am playing a bit with testdisk in case I can recover the windows installation.
    – user000001
    Jul 30 '15 at 18:44
  • BTW I tried boot-repair again and got this warning
    – user000001
    Jul 30 '15 at 18:46
  • /dev/sda4 was not your Windows partition; as I stated, it was your ESP -- what Boot Repair calls the "EFI partition." With it gone, so is your Windows boot loader. At this point, you can either try recovering the ESP with gdisk or parted (but do not try to create a filesystem on it or use GParted); or you can back up your personal data, delete all the partitions, and install everything from scratch.
    – Rod Smith
    Jul 30 '15 at 19:12
  • 2
    In theory, typing sudo efibootmgr -o 0001,0002 should get your system to boot GRUB by default. In practice, some EFIs are broken and this won't work. Sometimes this procedure fixes the problem, but other times you need an ugly hack, as described on this page of mine.
    – Rod Smith
    Jul 31 '15 at 16:42
  • 1
    @RodSmith Yup, the solution in your first link solved it! Now both OSs are working properly, using grub as the bootloader. You are a genious :)
    – user000001
    Aug 1 '15 at 11:02

From the output of your boot-repair command, it looks like you have an UEFI system…

However, Ubuntu is installed in non-UEFI mode, and Windows is installed in UEFI mode so only one of the two is going to work at a time without changing the boot parameters…

The best you can do is: re-install Windows 10 in non-UEFI mode or reinstall Ubuntu in UEFI mode depending on which you use most.

  • I still find it a bit strange that it changed the boot method though, since it was merely an upgrade and not a fresh install...
    – user000001
    Jul 30 '15 at 11:33
  • I did a fresh install and didn't have that problem... (and M$ questions are off-topic here anyway...)
    – Fabby
    Jul 30 '15 at 11:45

As an alternative to have dual boot setup, you can try setting up Grub2Win, which is an implementation of GRUB installed from Windows and has UEFI support. Note that Grub2Win does not integrate with existing GRUB installation, it creates its own.

Once installed it would detect your UEFI boot option for Windows.

It may detect your Linux partition automatically, if it doesn't you can add the menu entry manually to C:\grub2\grub.cfg, you can grab menuentry from your existing grub.cfg in Linux (usually located at /boot/grub/grub.cfg), looks similar to this:

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os --class icon-linux {
    insmod gzio
    insmod part_gpt
    insmod ext2
    set root='hd0,gpt6'
    search --no-floppy --fs-uuid --set=root ###################
    linux   /boot/vmlinuz-5.4.0-48-generic root=UUID=################### ro  quiet splash $vt_handoff
    initrd  /boot/initrd.img-5.4.0-48-generic

Note that instead of ###### above, you should use your Linux partition UUID, and should use the real boot image names installed in your /boot directory.

This enabled me to have Windows 10 + Ubuntu 20.04 dual boot setup successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.