1

Yesterday I installed Linux for the first time in a partition I made in the same disk where Windows is installed. Everything worked fine, but upon reboot Windows was not in the list, so I did a few things I found here on ask Ubuntu.

  • I installed OS-prober and set GRUB_DISABLE_OS_PROBER to false in /etc/default/grub. Then ran update-grub but no luck.

  • The next thing I did was creating a menuentry. Mi 40_custom file looks like:

#!/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" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set 2AF7-AD85 (my /boot-efi uuid)
        chainloader /efi/Microsoft/Boot/bootmgfw.efi
}
  • This added a Windows 10 entry when booting but sadly when selecting it I have the error invalid signature.

I have no idea on what to do. I also tried Boot-Repair tool the log of which is at this link.

============================== Boot Info Summary ===============================

 => Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 
    404376632 of the same hard drive for core.img. core.img is at this 
    location and looks for (,gpt6)/boot/grub. It also embeds following 
    components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_gpt biosdisk
    ---------------------------------------------------------------------------

sda1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sda2: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  Windows 8/10/11/2012: FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/Boot/bootx64.efi /efi/Boot/fbx64.efi 
                       /efi/Boot/mmx64.efi /efi/Microsoft/bootmgfw.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg 
                       /efi/Microsoft/Boot/bootmgfw.efi 
                       /efi/Microsoft/Boot/bootmgr.efi

sda3: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info: 

sda4: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 7
    Boot files:        /Windows/System32/winload.exe

sda5: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sda6: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 22.04 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/grub/i386-pc/core.img


================================ 2 OS detected =================================

OS#1:   El sistema operativo que se está usando - Ubuntu 22.04 LTS CurrentSession on sda6
OS#2:   Windows 7 on sda4

================================ Host/Hardware =================================

CPU architecture: 64-bit
Video: CoffeeLake-S GT1 [UHD Graphics 610] from Intel Corporation
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.15.0-41-generic root=UUID=4abe2367-f313-4759-8ecb-1c9d2b1bf155 ro quiet splash vt.handoff=7
df -Th / : /dev/sda6      ext4    67G    15G   49G  24% /

===================================== UEFI =====================================

BIOS/UEFI firmware: 1.40(5.12) from American Megatrends Inc.
The firmware is EFI-compatible, but this installed-session is in Legacy/BIOS/CSM mode (not in EFI mode).



============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

sda : is-GPT,   no-BIOSboot,    has---ESP,  not-usb,    not-mmc, has-os,    has-win,    2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda6    : is-os,    64, apt-get,    signed grub-pc grub-efi ,   grub2,  grub-install,   grubenv-ok, update-grub,    farbios
sda4    : is-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sda2    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far
sda5    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sda1    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far

Partitions info (2/3): _________________________________________________________

sda6    : isnotESP, fstab-has-goodEFI,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda4    : isnotESP, part-has-no-fstab,  no-nt,  haswinload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda2    : is---ESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda5    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, recovery-or-hidden, no-bmgr,    notwinboot
sda1    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, recovery-or-hidden, no-bmgr,    notwinboot

Partitions info (3/3): _________________________________________________________

sda6    : not--sepboot, with-boot,  fstab-without-boot, not-sep-usr,    with--usr,  fstab-without-usr,  std-grub.d, sda
sda4    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda2    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda5    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda1    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda

fdisk -l (filtered): ___________________________________________________________

Disk sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk identifier: 273D7298-3818-4EA0-BDAF-3703DD323179
          Start       End   Sectors   Size Type
sda1       2048   1085439   1083392   529M Windows recovery environment
sda2    1085440   1288191    202752    99M EFI System
sda3    1288192   1320959     32768    16M Microsoft reserved
sda4    1320960 324161535 322840576 153.9G Microsoft basic data
sda5  467521536 468858879   1337344   653M Windows recovery environment
sda6  324161536 467521535 143360000  68.4G Linux filesystem
Partition table entries are not in disk order.

parted -lm (filtered): _________________________________________________________

sda:240GB:scsi:512:512:gpt:ATA KINGSTON SA400S3:pmbr_boot;
1:1049kB:556MB:555MB:ntfs:Basic data partition:hidden, diag;
2:556MB:660MB:104MB:fat32:EFI system partition:boot, esp;
3:660MB:676MB:16.8MB::Microsoft reserved partition:msftres;
4:676MB:166GB:165GB:ntfs:Basic data partition:msftdata;
6:166GB:239GB:73.4GB:ext4::;
5:239GB:240GB:685MB:ntfs::hidden, diag;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL        PARTLABEL
sda                                                                                                    
├─sda1 ntfs     36D4F797D4F75797                     7e1b17f4-b204-47ff-94c1-c1a16329f1c8 Recuperación Basic data partition
├─sda2 vfat     2AF7-AD85                            c3e30674-fd02-4775-bdf7-9b4673941b2a              EFI system partition
├─sda3                                               b515d3ba-6f9a-4a71-aade-c40e94e554e9              Microsoft reserved partition
├─sda4 ntfs     8A28FD7728FD631D                     4172e039-0871-43f8-88b5-1ce2eca637e5              Basic data partition
├─sda5 ntfs     C8BC825CBC824542                     27c163a4-a400-4dc7-a458-d774d32ba26e              
└─sda6 ext4     4abe2367-f313-4759-8ecb-1c9d2b1bf155 9e0d898d-b7ad-46c3-8cff-06ab04840013              

Mount points (filtered): _______________________________________________________

                        Avail Use% Mounted on
/dev/sda1                519M   2% /mnt/boot-sav/sda1
/dev/sda4               59.5G  61% /mnt/boot-sav/sda4
/dev/sda5                 89M  86% /mnt/boot-sav/sda5
/dev/sda6               48.7G  22% /

Mount options (filtered): ______________________________________________________

/dev/sda1              fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda4              fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda5              fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda6              ext4            rw,relatime,errors=remount-ro

===================== sda2/efi/ubuntu/grub.cfg (filtered) ======================

search.fs_uuid 4abe2367-f313-4759-8ecb-1c9d2b1bf155 root hd0,gpt6 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

====================== sda6/boot/grub/grub.cfg (filtered) ======================

Ubuntu   4abe2367-f313-4759-8ecb-1c9d2b1bf155
Ubuntu, with Linux 5.15.0-41-generic   4abe2367-f313-4759-8ecb-1c9d2b1bf155
Ubuntu, with Linux 5.15.0-25-generic   4abe2367-f313-4759-8ecb-1c9d2b1bf155
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###
Windows 10

========================== sda6/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=4abe2367-f313-4759-8ecb-1c9d2b1bf155 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda2 during installation
UUID=2AF7-AD85  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

======================= sda6/etc/default/grub (filtered) =======================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=false

==================== sda6: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
 200,844955444 = 215,655628800  boot/grub/grub.cfg                             1
 192,821826935 = 207,040860160  boot/grub/i386-pc/core.img                     1
 193,543525696 = 207,815778304  boot/vmlinuz                                   2
 159,027889252 = 170,754895872  boot/vmlinuz-5.15.0-25-generic                 2
 193,543525696 = 207,815778304  boot/vmlinuz-5.15.0-41-generic                 2
 159,027889252 = 170,754895872  boot/vmlinuz.old                               2
 203,692836761 = 218,713518080  boot/initrd.img                                1
 194,098724365 = 208,411918336  boot/initrd.img-5.15.0-25-generic              1
 203,692836761 = 218,713518080  boot/initrd.img-5.15.0-41-generic              1
 194,098724365 = 208,411918336  boot/initrd.img.old                            1

===================== sda6: ls -l /etc/grub.d/ (filtered) ======================

-rwxr-xr-x 1 root root 18683 Apr 15 23:50 10_linux
-rwxr-xr-x 1 root root 43031 Apr 15 23:50 10_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15 23:50 20_linux_xen
-rwxr-xr-x 1 root root 13369 Apr 15 23:50 30_os-prober
-rwxr-xr-x 1 root root  1372 Apr 15 23:50 30_uefi-firmware
-rwxr-xr-x 1 root root   700 Feb 19 14:21 35_fwupd
-rwxr-xr-x 1 root root   390 Jul 23 04:33 40_custom
-rwxr-xr-x 1 root root   215 Apr 15 23:50 41_custom

=========================== sda6/etc/grub.d/35_fwupd ===========================

#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
   ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
      . /var/lib/fwupd/uefi_capsule.conf
      if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
      echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
      ${grub_probe:?}
      prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
    chainloader ${EFI_PATH}
}
EOF
      fi
fi

========================== sda6/etc/grub.d/40_custom ===========================

#!/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" {
        insmod part_gpt
        insmod fat
        search --no-floppy --fs-uuid --set 2AF7-AD85
        chainloader /efi/Microsoft/Boot/bootmgr.efi
}



Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub-efi of
sda6,
using the following options:  sda2/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file

Blockers in case of suggested repair: __________________________________________

WindowsEFI detected. Please disable BIOS-compatibility/CSM/Legacy mode in your UEFI firmware, and use this software from a live-CD (or live-USB) that is compatible with UEFI booting mode. For example, use a live-USB of Boot-Repair-Disk-64bit (www.sourceforge.net/p/boot-repair-cd), after making sure your BIOS is set up to boot USB in EFI mode. Please use this software in a live-session (live-CD or live-USB). This will enable this feature.

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your UEFI firmware boot on the El sistema operativo que se está usando - Ubuntu 22.04 LTS CurrentSession entry (sda2/efi/****/grub****.efi (**** will be updated in the final message) file) !
If your computer reboots directly into Windows, try to change the boot order in your UEFI firmware.
If your UEFI firmware does not allow to change the boot order, change the default boot entry of the Windows bootloader.
For example you can boot into Windows, then type the following command in an admin command prompt:
bcdedit /set {bootmgr} path \EFI\****\grub****.efi (**** will be updated in the final message)
The boot of your PC is in BIOS-compatibility/CSM/Legacy mode. You may want to retry after changing it to UEFI mode.

If I recall correctly my BIOS is and has always been set to Legacy/UEFI. If I try to set UEFI boot mode, every reboot directs me to BIOS. In the boot priority I just see my disk, not ubuntu nor windows.

Thanks in advance

k2helix
  • 11
  • 2
  • 1
    Does this answer your question? [In a dual boot system, how does the BIOS choose which bootloader to run?](https://askubuntu.com/questions/981382/in-a-dual-boot-system-how-does-the-bios-choose-which-bootloader-to-run) – karel Jul 23 '22 at 07:12
  • Sadly, no. I need to know how to boot into Windows – k2helix Jul 23 '22 at 07:37
  • Windows was booting in UEFI mode before. Now grub is the bootloader, but grub is installed in BIOS mode so Windows can't boot from grub. If you don't like the logic of this suggestion then don't convert Ubuntu from BIOS mode to UEFI mode to make grub bootloader compatible with Windows. – karel Jul 23 '22 at 07:41
  • If I select the UEFI boot mode then my pc starts rebooting into BIOS everytime I turn it on, what should I do? – k2helix Jul 23 '22 at 07:57
  • I didn't suggest changing the boot priority in the UEFI firmware. I suggested doing something else entirely different. Please read the relevant answer in the linked question. – karel Jul 23 '22 at 08:01
  • Sorry, I don't understand. I want to be able to boot into windows but idk why I can't – k2helix Jul 23 '22 at 08:31
  • 1
    The reason is you can't dual-boot with Grub if Windows and Ubuntu are installed in different modes. And in 2022 (actually since 2012) you want UEFI mode, period. Windows 11 supports UEFI mode only, unlike previous versions. **Fortunately** for you, Ubuntu can be easily converted to UEFI mode so everything works as it should. Please read the part of the answer that says "Converting Ubuntu into UEFI mode" and follow instructions, it only takes a few minutes and you'll have your problem solved. – ChanganAuto Jul 23 '22 at 10:30
  • I see. However, when I run boot-repair, it will do nothing, just say that I must enable UEFi only mode or sth like that. But when I enable that from BIOS, my PC enters a bootloop to the BIOS and won't boot – k2helix Jul 23 '22 at 11:15
  • Yes, you MUST enable UEFI (disable any Legacy/CSM) and your USB live/installation media MUST be done correctly (any tool does it correctly except maybe Rufus with wrong settings) in order to boot in the proper mode. Not doing it correctly is exactly where your problem starts. – ChanganAuto Jul 23 '22 at 19:29
  • I correctly enabled UEFi mode and booted into a Ubuntu Live USB, however when I run boot-repair I get "Locked NVRAM detected" – k2helix Jul 24 '22 at 12:46
  • Do you have UEFI Secure Boot on? Or some other setting in UEFI that lock update. Many Lenovo's have something called "Device Guard" Others may have something similar. Best to get manual and review UEFI/BIOS setting a manual may have more explanation of settings than brief one in UEFI. Also Windows turns fast start up back on with updates, so you may have to turn off again. And Windows may update UEFI resetting to many defaults, so you have to redo those also. I had to keep a list, so I could redo all of them, if necessary. – oldfred Jul 24 '22 at 15:11
  • Hi, I managed to solve it by following this guide http://woshub.com/how-to-repair-uefi-bootloader-in-windows-8/#h2_2, tried installing Ubuntu but it wouldn't work. Finally, I tried installing fedora and creating another /boot/efi partition for it. Now it works and I can choose to boot between Windows and Fedora – k2helix Jul 25 '22 at 17:34

0 Answers0