SparkyLinux Forums

Installation & Upgrade => System upgrading => Topic started by: corsair on May 01, 2023, 06:41:11 PM

Title: [SOLVED] windows no longer appears in the grub menu
Post by: corsair on May 01, 2023, 06:41:11 PM
After grub was updated Windows no longer appears as an option in the grub bootloader menu.
I do not know enough about gnu/linux system to act on my own, I would be grateful if someone could help me.
This is the Boot-Info summary:

boot-info-4ppa200                                              [20230501_1815]

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

=> Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 1 of
    the same hard drive for core.img. core.img is at this location and looks
    for (,msdos5)/boot/grub. It also embeds following components:
   
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos 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:        /bootmgr /Boot/BCD

sda2: __________________________________________________________________________

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

sda3: __________________________________________________________________________

    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:       

sda4: __________________________________________________________________________

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

sda5: __________________________________________________________________________

    File system:      ext4
    Boot sector type:  -
    Boot sector info:
    Operating System:  SparkyLinux 7 (Orion-Belt)
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub
                      /boot/grub/i386-pc/core.img

sda6: __________________________________________________________________________

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

sda7: __________________________________________________________________________

    File system:      ext4
    Boot sector type:  -
    Boot sector info:
    Operating System: 
    Boot files:       


================================ 3 OS detected =================================

OS#1:  Sistema operativo ora in uso - SparkyLinux 7 (Orion-Belt) CurrentSession on sda5
OS#2:  Windows 10 (boot) on sda1
OS#3:  Windows 10 or 11 on sda2

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

CPU architecture: 64-bit
Video: GK106 [GeForce GTX 650 Ti] from NVIDIA Corporation
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-6.1.0-7-amd64 root=UUID=586c3143-1d2b-4c51-b6f0-a5577dbc7f47 ro quiet splash resume=UUID=1dc3427a-bb80-47bd-9824-1258af7ce54c
df -Th / : /dev/sda5      ext4  30G  12G    17G  42% /

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

BIOS/UEFI firmware: 2104(4.6) from American Megatrends Inc.
This installed-session is in Legacy/BIOS/CSM mode (not in EFI mode).



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

Disks info: ____________________________________________________________________

sda    : notGPT,    no-BIOSboot,    has-noESP,    not-usb,    not-mmc, has-os,    has-win,    2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

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

Partitions info (2/3): _________________________________________________________

sda2    : isnotESP,    part-has-no-fstab,    no-nt,    haswinload,    no-recov-nor-hid,    no-bmgr,    notwinboot
sda7    : isnotESP,    part-has-no-fstab,    no-nt,    no-winload,    no-recov-nor-hid,    no-bmgr,    notwinboot
sda5    : isnotESP,    fstab-without-efi,    no-nt,    no-winload,    no-recov-nor-hid,    no-bmgr,    notwinboot
sda3    : isnotESP,    part-has-no-fstab,    no-nt,    no-winload,    no-recov-nor-hid,    no-bmgr,    notwinboot
sda1    : isnotESP,    part-has-no-fstab,    no-nt,    no-winload,    no-recov-nor-hid,    bootmgr,    is-winboot

Partitions info (3/3): _________________________________________________________

sda2    : not--sepboot,    no---boot,    part-has-no-fstab,    not-sep-usr,    no---usr,    part-has-no-fstab,    no--grub.d,    sda
sda7    : maybesepboot,    no---boot,    part-has-no-fstab,    not-sep-usr,    no---usr,    part-has-no-fstab,    no--grub.d,    sda
sda5    : not--sepboot,    with-boot,    fstab-without-boot,    not-sep-usr,    with--usr,    fstab-without-usr,    std-grub.d,    sda
sda3    : 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: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 0x443bbada
      Boot    Start      End  Sectors  Size Id Type
sda1  *        2048    206847    204800  100M  7 HPFS/NTFS/exFAT
sda2          206848 208831058 208624211 99.5G  7 HPFS/NTFS/exFAT
sda3      208832512 209919999  1087488  531M 27 Hidden NTFS WinRE
sda4      209920000 734207999 524288000  250G  5 Extended
sda5      209922048 272836607  62914560  30G 83 Linux
sda6      272838656 289615871  16777216    8G 82 Linux swap / Solaris
sda7      289617920 734207999 444590080  212G 83 Linux

parted -lm (filtered): _________________________________________________________

sda:1000GB:scsi:512:512:msdos:ATA WDC WD1002FAEX-0:;
1:1049kB:106MB:105MB:ntfs::boot;
2:106MB:107GB:107GB:ntfs::;
3:107GB:107GB:557MB:ntfs::msftres;
4:107GB:376GB:268GB:::;
5:107GB:140GB:32.2GB:ext4::;
6:140GB:148GB:8590MB:linux-swap(v1)::swap;
7:148GB:376GB:228GB:ext4::;

Free space >10MiB: ______________________________________________________________

sda: 358500MiB:953870MiB:595370MiB

blkid (filtered): ______________________________________________________________

NAME  FSTYPE UUID                                PARTUUID                            LABEL                    PARTLABEL
sda                                                                                                             
├─sda1 ntfs  2A221998221969D9                    443bbada-01                          Riservato per il sistema
├─sda2 ntfs  E4DA1AE6DA1AB4B0                    443bbada-02                                                 
├─sda3 ntfs  48F88DAAF88D973A                    443bbada-03                                                 
├─sda4                                            443bbada-04                                                 
├─sda5 ext4  586c3143-1d2b-4c51-b6f0-a5577dbc7f47 443bbada-05                                                 
├─sda6 swap  1dc3427a-bb80-47bd-9824-1258af7ce54c 443bbada-06                                                 
└─sda7 ext4  1df9ccb0-9589-4b04-968e-c6021f6a4716 443bbada-07                                                 

Mount points (filtered): _______________________________________________________

            Avail Use% Mounted on
/dev/sda1    67.8M  32% /mnt/boot-sav/sda1
/dev/sda2    20.1G  80% /mnt/boot-sav/sda2
/dev/sda3    80.9M  85% /mnt/boot-sav/sda3
/dev/sda5    16.3G  39% /
/dev/sda7  113.5G  40% /home

Mount options (filtered): ______________________________________________________

/dev/sda1  fuseblk        rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda2  fuseblk        rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda3  fuseblk        rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda5  ext4            rw,noatime
/dev/sda7  ext4            rw,noatime

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

Sparky GNU/Linux  586c3143-1d2b-4c51-b6f0-a5577dbc7f47
Sparky GNU/Linux, with Linux 6.1.0-7-amd64  586c3143-1d2b-4c51-b6f0-a5577dbc7f47
Sparky GNU/Linux, with Linux 6.1.0-6-amd64  586c3143-1d2b-4c51-b6f0-a5577dbc7f47
Sparky GNU/Linux, with Linux 4.9.335-sparky-lts49-amd64  586c3143-1d2b-4c51-b6f0-a5577dbc7f47
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###

========================== sda5/etc/fstab (filtered) ===========================

# <file system>            <mount point>  <type>  <options>  <dump>  <pass>
UUID=586c3143-1d2b-4c51-b6f0-a5577dbc7f47 /              ext4    defaults,noatime 0 1
UUID=1dc3427a-bb80-47bd-9824-1258af7ce54c swap          swap    defaults,noatime 0 0
UUID=1df9ccb0-9589-4b04-968e-c6021f6a4716 /home          ext4    defaults,noatime 0 2

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

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=1dc3427a-bb80-47bd-9824-1258af7ce54c"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=false
GRUB_DISABLE_OS_PROBER=false

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

          GiB - GB            File                                Fragment(s)
114.854579926 = 123.324166144  boot/grub/grub.cfg                            1
113.631099701 = 122.010464256  boot/grub/i386-pc/core.img                    1
115.868244171 = 124.412579840  boot/vmlinuz-4.9.335-sparky-lts49-amd64        1
109.004783630 = 117.042995200  boot/vmlinuz-6.1.0-6-amd64                    2
111.551563263 = 119.777579008  boot/vmlinuz-6.1.0-7-amd64                    2
111.551563263 = 119.777579008  vmlinuz                                        2
109.004783630 = 117.042995200  vmlinuz.old                                    2
114.098628998 = 122.512470016  boot/initrd.img-4.9.335-sparky-lts49-amd64    6
127.072101593 = 136.442630144  boot/initrd.img-6.1.0-6-amd64                  5
127.212970734 = 136.593887232  boot/initrd.img-6.1.0-7-amd64                  3
127.212970734 = 136.593887232  initrd.img                                    3
127.072101593 = 136.442630144  initrd.img.old                                5

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

-rwxr-xr-x 1 root root  6155 16 feb  2015 06_sparky_theme
-rwxr-xr-x 1 root root 14123 10 giu  2022 10_linux
-rwxr-xr-x 1 root root 14180 10 giu  2022 20_linux_xen
-rwxr-xr-x 1 root root 12910 21 apr 14.30 30_os-prober
-rwxr-xr-x 1 root root  1372 10 giu  2022 30_uefi-firmware
-rwxr-xr-x 1 root root  700  7 ott  2022 35_fwupd
-rwxr-xr-x 1 root root  214 29 apr  2013 40_custom
-rwxr-xr-x 1 root root  215 10 giu  2022 41_custom

======================= sda5/etc/grub.d/06_sparky_theme ========================

#!/bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2010  Alexander Kurtz <kurtz.alex@googlemail.com>
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
#
# Remastered for SparkyLinux by Paweł "pavroo" Pijanowski 2015/02/16 (C) GNU GPLv3
# Include the GRUB helper library for grub-mkconfig.
. /usr/share/grub/grub-mkconfig_lib
# We want to work in /boot/grub/ only.
test -d /boot/grub; cd /boot/grub
# Set the location of a possibly necessary cache file for the background image.
# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.
BACKGROUND_CACHE=".background_cache"
set_default_theme(){
    case $GRUB_DISTRIBUTOR in
        Sparky|Ubuntu|Kubuntu)
            # Set a monochromatic theme for Sparky/Ubuntu.
            echo "${1}set menu_color_normal=white/black"
            echo "${1}set menu_color_highlight=black/light-gray"
            if [ -e /lib/plymouth/themes/default.grub ]; then
                sed "s/^/${1}/" /lib/plymouth/themes/default.grub
            fi
            ;;
        *)
            # Set the traditional Debian blue theme.
            echo "${1}set menu_color_normal=cyan/blue"
            echo "${1}set menu_color_highlight=white/blue"
            ;;
    esac
}
module_available(){
    local module
    for module in "${1}.mod" */"${1}.mod"; do
        if [ -f "${module}" ]; then
            return 0
        fi
    done
    return 1
}
set_background_image(){
    # Step #1: Search all available output modes ...
    local output
    for output in ${GRUB_TERMINAL_OUTPUT}; do
        if [ "x$output" = "xgfxterm" ]; then
            break
        fi
    done
    # ... and check if we are able to display a background image at all.
    if ! [ "x${output}" = "xgfxterm" ]; then
        return 1
    fi
    # Step #2: Check if the specified background image exists.
    if ! [ -f "${1}" ]; then
        return 2
    fi
    # Step #3: Search the correct GRUB module for our background image.
    local reader
    case "${1}" in
        *.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpeg";;
        *.png|*.PNG) reader="png";;
        *.tga|*.TGA) reader="tga";;
        *) return 3;; # Unknown image type.
    esac
    # Step #4: Check if the necessary GRUB module is available.
    if ! module_available "${reader}"; then
        return 4
    fi
    # Step #5: Check if GRUB can read the background image directly.
    # If so, we can remove the cache file (if any). Otherwise the backgound
    # image needs to be cached under /boot/grub/.
    if is_path_readable_by_grub "${1}"; then
        rm --force "${BACKGROUND_CACHE}.jpeg" \
            "${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga"
    elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then
        set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}"
    else
        return 5
    fi
    # Step #6: Prepare GRUB to read the background image.
    if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${1}"`"; then
        return 6
    fi
    # Step #7: Everything went fine, print out a message to stderr ...
    echo "Found background image: ${1}" >&2
    # ... and write our configuration snippet to stdout. Use the colors
    # desktop-base specified. If we're using a user-defined background, use
    # the default colors since we've got no idea how the image looks like.
    # If loading the background image fails, use the default theme.
    echo "insmod ${reader}"
    echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"
    if [ -n "${2}" ]; then
        echo "  set color_normal=${2}"
    fi
    if [ -n "${3}" ]; then
        echo "  set color_highlight=${3}"
    fi
    if [ -z "${2}" ] && [ -z "${3}" ]; then
        echo "  true"
    fi
    echo "else"
    set_default_theme "  "
    echo "fi"
}
# Earlier versions of grub-pc copied the default background image to /boot/grub
# during postinst. Remove those obsolete images if they haven't been touched by
# the user. They are still available under /usr/share/images/desktop-base/ if
# desktop-base is installed.
while read checksum background; do
    if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" = "x${checksum}  ${background}" ]; then
        echo "Removing old background image: ${background}" >&2
        rm "${background}"
    fi
done <<EOF
648ee65dd0c157a69b019a5372cbcfea4fc754a5  debian-blueish-wallpaper-640x480.png
0431e97a6c661084c59676c4baeeb8c2f602edb8  debian-blueish-wallpaper-640x480.png
968ecf6696c5638cfe80e8e70aba239526270864  debian-blueish-wallpaper-640x480.tga
11143e8c92a073401de0b0fd42d0c052af4ccd9b  moreblue-orbit-grub.png
d00d5e505ab63f2d53fa880bfac447e2d3bb197c  moreblue-orbit-grub.png
f5b12c1009ec0a3b029185f6b66cd0d7e5611019  moreblue-orbit-grub.png
EOF
# Include the configuration of desktop-base if available.
if [ -f "/usr/share/desktop-base/sparky_grub_background.sh" ]; then
    . "/usr/share/desktop-base/sparky_grub_background.sh"
fi
# First check whether the user has specified a background image explicitly.
# If so, try to use it. Don't try the other possibilities in that case
# (#608263).
if [ -n "${GRUB_BACKGROUND+x}" ]; then
    set_background_image "${GRUB_BACKGROUND}" || set_default_theme
    exit 0
fi
# Next search for pictures the user put into /boot/grub/ and use the first one.
for background in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA; do
    if set_background_image "${background}"; then
        exit 0
    fi
done
# Next try to use the background image and colors specified by desktop-base.
if set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then
    exit 0
fi
# If we haven't found a background image yet, use the default from desktop-base.
case $GRUB_DISTRIBUTOR in
    Ubuntu|Kubuntu)
        ;;
    Sparky)
        if set_background_image "/opt/artwork/sparky-grub.png"; then
            exit 0
        fi
        ;;
    *)
        if set_background_image "/usr/share/images/desktop-base/desktop-grub.png"; then
            exit 0
        fi
        ;;
esac
# Finally, if all of the above fails, use the default theme.
set_default_theme

=========================== sda5/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



Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub2 of
sda5 into the MBR of sda.
Grub-efi would not be selected by default because no ESP detected.
Additional repair would be performed: unhide-bootmenu-10s win-legacy-basic-fix

Blockers in case of suggested repair: __________________________________________

Please use this software in a live-session (live-CD or live-USB). This will enable this feature.

Thank you
Title: Re: windows no longer appears in the grub menu
Post by: pavroo on May 01, 2023, 07:17:10 PM
If you have Sparky testing (7) the default option of Grub doesn't support other operating systems to boot.
To fix that add the line:
GRUB_DISABLE_OS_PROBER=falseas root or with sudo to the end of the file:
/etc/default/grubthenL
sudo update-grub
Title: Re: windows no longer appears in the grub menu
Post by: corsair on May 02, 2023, 08:49:45 PM
Thank you pavroo, everything is fine now.