3

I have read several threads regarding this problem, but I can't solve mine.

Background

I wanted to upgrade my Lubuntu 20.04 to 22.04. My /boot/efi-partition's size was 150 MB and was working perfectly, but the Lubuntu 22.04 installer found an error: "/boot/efi partition has to be of at least 300 MB". So I went back, made my /swap partition 150 MB smaller, deleted the /boot/efi partition, and created it again but with a size of 300 MB. The installer accepted my manual partitioning and installed the OS.

Problem

My Lubuntu system works perfectly, but the "Windows Boot Manager" option on startup doesn't show up. The partition in which Windows 7 is installed remains untouched. The "Windows Boot Manager" option appeared yesterday and Windows 7 booted just fine.

Information

I did a lot of things, I can't really remember them all. I will leave you the information I believe is necessary after reading many threads and doing many things.

  1. Partition structure: I have an SSD in which I run my Lubuntu 22.04 (/dev/sda3), and in which I used to run my Windows 7 (/dev/sda6). The Lubuntu 20.04 (/dev/sdb7 I think) is an old backup Linux I have for emergencies.

    NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    loop0     7:0    0  74,2M  1 loop /snap/core22/1122
    loop1     7:1    0  74,2M  1 loop /snap/core22/1380
    loop2     7:2    0 262,5M  1 loop /snap/firefox/3779
    loop3     7:3    0     4K  1 loop /snap/bare/5
    loop4     7:4    0   497M  1 loop /snap/gnome-42-2204/141
    loop5     7:5    0  91,7M  1 loop /snap/gtk-common-themes/1535
    loop6     7:6    0  40,4M  1 loop /snap/snapd/20671
    loop7     7:7    0 139,7M  1 loop /snap/jdownloader2/20
    loop8     7:8    0  38,8M  1 loop /snap/snapd/21759
    sda       8:0    0 223,6G  0 disk 
    ├─sda1    8:1    0   301M  0 part /boot/efi
    ├─sda2    8:2    0   3,9G  0 part [SWAP]
    ├─sda3    8:3    0    40G  0 part /var/snap/firefox/common/host-hunspell
    │                                 /
    ├─sda4    8:4    0    60G  0 part /home
    ├─sda5    8:5    0    16M  0 part 
    └─sda6    8:6    0 119,4G  0 part 
    sdb       8:16   0 931,5G  0 disk 
    ├─sdb1    8:17   0    20G  0 part /home/el38/Descargas
    ├─sdb2    8:18   0    50G  0 part /home/el38/Documentos
    ├─sdb3    8:19   0   100G  0 part /home/el38/Imágenes
    ├─sdb4    8:20   0   100G  0 part /home/el38/Otros/misc
    ├─sdb5    8:21   0     1G  0 part 
    ├─sdb6    8:22   0     8G  0 part 
    ├─sdb7    8:23   0  43,6G  0 part 
    ├─sdb8    8:24   0  19,1G  0 part 
    ├─sdb9    8:25   0 377,1G  0 part /home/el38/Música
    └─sdb10   8:26   0   807M  0 part 
    
  2. sudo update-grub output

    Sourcing file `/etc/default/grub'
    Sourcing file `/etc/default/grub.d/init-select.cfg'
    Sourcing file `/etc/default/grub.d/lubuntu-grub-theme.cfg'
    Generating grub configuration file ...
    Found theme: /usr/share/grub/themes/lubuntu-grub-theme/theme.txt
    Found linux image: /boot/vmlinuz-6.5.0-41-generic
    Found initrd image: /boot/initrd.img-6.5.0-41-generic                                                                                                                   
    Found linux image: /boot/vmlinuz-6.5.0-18-generic                                                                                                                       
    Found initrd image: /boot/initrd.img-6.5.0-18-generic                                                                                                                   
    Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting                                                                                                   
    Warning: os-prober will be executed to detect other bootable partitions.                                                                                                
    Its output will be used to detect bootable binaries on them and create new boot entries.                                                                                
    Found Ubuntu 20.04.3 LTS (20.04) on /dev/sdb7                                                                                                                           
    done
    
  3. sudo os-prober output:

    /dev/sdb7:Ubuntu 20.04.3 LTS (20.04):Ubuntu:linux
    
  4. /etc/fstab/ file. Note that for some reason there are two /boot/efi/ entries, with the same UUID, but one of them is commented. I did not do this manually, it is the original file that came with the install.

    # /etc/fstab: static file system information.
    #
    # Use 'blkid' to print the universally unique identifier for a device; this may
    # be used with UUID= as a more robust way to name devices that works even if
    # disks are added and removed. See fstab(5).
    #
    # <file system>             <mount point>  <type>  <options>  <dump>  <pass>
    #UUID=F79B-717D                            /boot/efi      vfat    umask=0077 0 2
    UUID=9e06d6ca-c62d-46a3-9002-f46ead7d60b3 swap           swap    defaults,discard 0 0
    UUID=6f74b624-4306-4586-8913-d9328779bb27 /              ext4    defaults,discard 0 1
    UUID=78cd0971-1d29-4878-b3b3-f95499c7c141 /home          ext4    defaults,discard 0 2
    UUID=d72d820e-4479-4d9a-a742-c0cef3060ca9 /home/el38/Descargas ext4    defaults   0 2
    UUID=891ffb6e-ac93-4747-8d1e-e64661bd4805 /home/el38/Documentos ext4    defaults   0 2
    UUID=ddc43c37-870b-4d61-82dd-527bd6de118d /home/el38/Imágenes ext4    defaults   0 2
    UUID=af917f50-c22f-4fac-bb7b-9fdfeb65cae4 /home/el38/Otros/misc ext4    defaults   0 2
    UUID=54b294eb-c768-4061-9488-4e79f52104ae /home/el38/Música ext4    defaults   0 2
    /swapfile                                 swap           swap    defaults   0 0
    tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
    UUID=F79B-717D  /boot/efi       vfat    defaults      0       1
    
  5. I followed this guide and did what it said. I ran Boot-Repair in a live USB (the same I used to install my 22.04 new version in /dev/sda3). This is the Boot-Info diagnosis, and after running the recommended repair it said "Boot successfully repaired.", but the "Windows Boot Manager" option still does not appear and I can not boot Windows 7.

    This is the Recommended Repair report.

    I don't know if it's important, but after this recommended repair, Boot-Repair warned me about some "NVram locked". I searched this on the internet, and I read some people saying it is because of the Secure Boot option in the BIOS configuration. I made sure the Secure Boot was (and still is) disabled.

  6. (edit) sudo efibootmgr --verbose output

    Timeout: 1 seconds
    BootOrder: 000C,000D,000E,0004
    Boot0004  Hard Drive    BBS(HD,,0x0)..GO..NO........o.A.D.A.T.A.        .S.U.6.3.0....................A...........................>..Gd-.;.A..MQ..L.L.2.6.2.9.2.7.1.N.E.U.1. . . . . . . . ........BO..NO........o.S.T.1.0.0.0.L.M.0.2.4. .H.N.-.M.1.0.1.M.B.B....................A...........................>..Gd-.;.A..MQ..L.3.S.X.2.9.J.G.B.3.9.2.6.6.6. . . . . . ........BO
    Boot000C* ubuntu        HD(1,GPT,3860fedb-cbb4-1b4b-a151-c012fcf4afec,0x22,0x967de)/File(\EFI\UBUNTU\SHIMX64.EFI)
    
  7. (edit) My /dev/sda SSD partition table is of type GPT, in case this information is relevant. The /dev/sda6 partition (where Windows 7 is) has the boot-bios flag set.

  8. I got Boot Info Script and ran it. This is the result.

I would really appreciate your help and even more if it prevents me from reinstalling Windows 7, I do not even know how I got it working in the first place (until yesterday when I decided to update Lubuntu).

  1. I did as @talaat-etman suggested with great help from @kos too. My list volume output is

    Volume 0      G    NO_LABEL    FAT32   Partition   300 MB    Correct     Hidden
    ...
    Volume 2      K                NTFS    Partition   119 GB    Correct     Hidden
    ...
    Volume 4      E                NTFS    Partition   807 MB    Correct     Hidden
    Volume 5      D     W7X64ULT_E FAT32   Partition   14 GB     Correct     Hidden
    

    For clarity:

    • Volume 0 = /dev/sda1 = the /boot/efi partition

    • Volume 2 = /dev/sda6 = the Windows 7 C:/ partition (installed)

    • Volume 4 = /dev/sda5 = "Microsoft reserved partition" which is empty, unknown filesystem, msftres flag active

    • Volume 5 = /dev/sdc = Live USB stick from which I booted Win7 installer

I opened the "Advanced Options" menu, and opened CMD. I ran X:\sources>bcdboot X:\Windows /s G: /f ALL and also X:\sources>bcdboot X:\Windows /s K: /f ALL just in case, but both outputs were

   BFSVC Error: Failed to set element application device. Status = [c00000bb]
  1. After I followed the steps described in 11., the "Windows Boot Manager" option reappeared, so maybe I'm close. Trying to run it gives an error, though. I took photo of the screen: photo

  2. I booted the Boot-Repair CD from a live USB stick. I ran the program, and it said Windows legacy detected. The process continued and it said that the boot had been successfully repaired. It doesn't work though, since I rebooted and the option does not yet appear. It showed a warning before finishing asking if I wanted to continue (I said yes):

        EFI detected. You may want to retry after activating the [Separate /boot/efi partition:] option.
    

    When it finished, it gave this report and showed this message:

        You can now reboot your computer.
        Please do not forget to make your UEFI firmware boot on the Ubuntu 22.04.4 LTS entry (sda1/efi/ubuntu/grubx64.efi file)!
    

    So, I rebooted, added manually such entry in my BIOS configuration and made my PC boot using it. Still only showed my Lubuntu 22.04 on /dev/sda1 and the Lubuntu 20.04 on dev/sdb7.

2 Answers2

3

After rebooing by windows installation media, You can copy BCD files that support booting on either a UEFI-based or a BIOS-based computer from the C:\Windows folder to windows boot drive or to C drive by the following command:

bcdboot C:\Windows /s X: /f ALL #replace X with boot or windows drive

after then, reboot by lubuntu and update-grub

I usually put the boot files in the boot partition and the Windows partition. if there is any problem in the boot partition, I will boot directly from Windows partition.

Revere to this video to know how to fix UEFI Partition When Windows 10 and 11 Won't Boot.

Revere to this answer to know how to deal with Windows botable USB drive from Ubuntu and Windows, and how to use HBCD_PE to fix BCD problems.

Talaat Etman
  • 1,340
2

Ok, after quickly looking at boot repair log, i can see you have more than one grub, try loading the grub on sda, i can see it's already installed there, so all you need to do is mark sda1 partition with the boot flag, using gparted for example.

What happens is that the fixed grub containing windows section doesnot get booted.

Also beside boot repair, there is super grub disc too.

Is sdc your live usb stick?

Good luck ! and keep me posted...