[SOLVED] win7 no longer appears on grub menu, also error while generating grub config
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
win7 no longer appears on grub menu, also error while generating grub config
I am using arch based linux, xfce. using legacy mode, MBR hdd.
This is my hdd partition:
sda1 windows7 reserve
sda2 win7 ntfs
sda3 / ext4
sda4 extended
sda6 logical ext4 /home
sda5 /swap
I have win7 install, and i also have eos linux installed
Issue1:
------------
Previously when i execute
Code:
grub-mkconfig -o /boot/grub/grub.cfg
it always creates 2 lines for windows7:
1. windows7 sda1
2. windows7 sda2
While windows7 sda2 should not be listed.. I think it is generated when grub-mkconfig is because something have being created in sda2, which grub thought it is also and os of itself.
Q1.
What does grub look in every partitions when grub-mkconfig (so that it know to create a menu for a os that it detected or don't create when it see a partition that has got no os in it )?
Why in this case it mistaken SDA2 as an os loader when it is not ?
Scenario2:
------
So, i entered found a webpage said
Code:
disable os-prober in /etc
.. but i lost the article now.. can't remember where was the /etc file that i have modified. I did however made bak copy of the file beside it before i made the change.
This "os-prober disable" fix the dual line win7 in grub menu. (i think i also went to grub config to mask out the "win7 sda2 boot menu".
*which now i come to think of it, it is not the right thing to do, because everytime when a kernel update or installed, it will be over written.
Today, i used the Kernel manager of EOS to install several kernels, lts , zen , hardened.. (just to have more kernel to try out). the Kernel manager did the grub config generating in background by itself.
Issue2:
--------
Booted the computer, it shows the whole list of kernels, but the original rolling release kernel is not in the grub menu.
Also Win7 is not in the grub menu.
I suspect it was due to the "os-prober disable" line that i have added in (i can't remember where is the file i added the line)
Q2.
What skeleton files that refers to by
Code:
grub-mkconfig -o
I believe it looks for
Code:
/etc/default/grub
as "template" to create grub config file.
I want to undo my previous *mistake* so, grub will able to show win7 and rolling release kernel.
Or is there way to grab and replace those files in /etc/default from liveusb ?
/dev/sda2 probably does have loader code. os-prober was doing its job. PEBKAC.
Simplest solution is likely to (force) re-install os-prober. mkconfig doesn't go looking for other boot entries - it invokes os-prober to do that if it's present. It's just a (bunch of) script - go look what it does yourself.
as "template" to create grub config file.
I want to undo my previous *mistake* so, grub will able to show win7 and rolling release kernel.
Or is there way to grab and replace those files in /etc/default from liveusb ?
Thx
Yes, the file needed to be edited as root/sudo is /etc/default/grub, you will want to comment out this line ---> GRUB_DISABLE_OS_PROBER=true.
After editing /etc/default/grub you will need to run command as root/sudo:#grub-mkconfig -o /boot/grub/grub.cfg
Why in this case it mistaken SDA2 as an os loader when it is not ?
It isn't. The second windows option is likely the Recovery partition for windows 7 which has boot files on it also which is why a Grub entry was created for it.
You can disable/enable os-prober by changing the execute permissions on the file using root permissions: /etc/grub.d/30_os-prober
Also, you may need to do the same with: chmod a-x /usr/bin/os-prober
And probably the simplest to try is to change the line below in /etc/default/grub:
Code:
GRUB_DISABLE_OS_PROBER=true
Simply change true to false.
If it bothers you to have the 2nd entry for windows, given your level of expertise from reading your other post, it might be less problematic for you to simply go into the grub.cfg file with root permissions after running grub-mkconfig and delete it each time. I would also suggest that when you are making changes to the system like this that you create a file listing all the steps you took and the commands you used and files you changed so that you can undo them if problems arise.
I don't see any error listed while running grub-mkconfig as stated in your thread title?
/dev/sda2 probably does have loader code. os-prober was doing its job. PEBKAC.
Simplest solution is likely to (force) re-install os-prober. mkconfig doesn't go looking for other boot entries - it invokes os-prober to do that if it's present. It's just a (bunch of) script - go look what it does yourself.
1.
So, SDA2 even is not a boot partition, but it might have loader code.
I would very much like to learn this. Any idea how i search for google ? i have being trying to search, but it seems google just does not understand at all my question..
Any idea, What term of keyword i can search google so that it understand what i want.
I don't see any error listed while running grub-mkconfig as stated in your thread title?
Here is the partial error prompt when grub-mkconfig:
Code:
.
.
.
found linux image: /boot/vmlinuz-linux-hardened
found initrd image: /boot/intel-ucode.img /boot/initramfs-linux-hardened.img
found fallback initrd image(s) in /boot: initramfs-linux-hardened-fallback.img
found memtest86+ image: /boot/memtest86+/memtest.bin
error: syntax error.
syntax error at line 346
syntax error are detected in generated Grub config file.
Ensure that thre are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with /boot/grub/grub.cfg.new file attached.
This is the new grub.cfg created by grub-mkconfig for troubleshooting:
Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
insmod gfxmenu
loadfont ($root)/boot/grub/themes/EndeavourOS/unifont-regular-16.pf2
insmod png
set theme=($root)/boot/grub/themes/EndeavourOS/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=10
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=10
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/01_grub-customizer_menu_color_helper ###
### END /etc/grub.d/01_grub-customizer_menu_color_helper ###
### BEGIN /etc/grub.d/10_linux_proxy ###
### END /etc/grub.d/10_linux_proxy ###
### BEGIN /etc/grub.d/30_os-prober_proxy ###
menuentry "Windows 7 (on /dev/sda1)" --class windows --class os $menuentry_id_option 'osprober-chain-442C45772C456550' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos1' --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 442C45772C456550
else
search --no-floppy --fs-uuid --set=root 442C45772C456550
fi
parttool ${root} hidden-
chainloader +1
}
### END /etc/grub.d/30_os-prober_proxy ###
### BEGIN /etc/grub.d/31_os-prober.bak_proxy ###
menuentry "Windows 7 (on /dev/sda1)" --class windows --class os $menuentry_id_option 'osprober-chain-442C45772C456550' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos1' --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 442C45772C456550
else
search --no-floppy --fs-uuid --set=root 442C45772C456550
fi
parttool ${root} hidden-
chainloader +1
}
### END /etc/grub.d/31_os-prober.bak_proxy ###
### BEGIN /etc/grub.d/32_linux_proxy ###
menuentry "EndeavourOS, on linux-zen" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-zen-advanced-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-zen ...'
linux /boot/vmlinuz-linux-zen root=UUID=5c487842-7591-49e3-8d50-77304544091e rw loglevel=3 quiet nowatchdog
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux-zen.img
}
menuentry "EndeavourOS, on linux-zen (fallback initramfs)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-zen-fallback-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-zen ...'
linux /boot/vmlinuz-linux-zen root=UUID=5c487842-7591-49e3-8d50-77304544091e rw loglevel=3 quiet nowatchdog
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-zen-fallback.img
}
menuentry "EndeavourOS, on linux-zen (recovery mode)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-zen-recovery-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-zen ...'
linux /boot/vmlinuz-linux-zen root=UUID=5c487842-7591-49e3-8d50-77304544091e rw single
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-zen-fallback.img
}
menuentry "EndeavourOS, on linux-lts (fallback initramfs)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-fallback-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-lts ...'
linux /boot/vmlinuz-linux-lts root=UUID=5c487842-7591-49e3-8d50-77304544091e rw loglevel=3 quiet nowatchdog
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-lts-fallback.img
}
menuentry "EndeavourOS, on linux-lts (recovery mode)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-recovery-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-lts ...'
linux /boot/vmlinuz-linux-lts root=UUID=5c487842-7591-49e3-8d50-77304544091e rw single
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-lts-fallback.img
}
menuentry "EndeavourOS, on linux-hardened" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-hardened-advanced-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-hardened ...'
linux /boot/vmlinuz-linux-hardened root=UUID=5c487842-7591-49e3-8d50-77304544091e rw loglevel=3 quiet nowatchdog
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux-hardened.img
}
menuentry "EndeavourOS, on linux-hardened (fallback initramfs)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-hardened-fallback-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-hardened ...'
linux /boot/vmlinuz-linux-hardened root=UUID=5c487842-7591-49e3-8d50-77304544091e rw loglevel=3 quiet nowatchdog
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-hardened-fallback.img
}
menuentry "EndeavourOS, on linux-hardened (recovery mode)" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-hardened-recovery-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-hardened ...'
linux /boot/vmlinuz-linux-hardened root=UUID=5c487842-7591-49e3-8d50-77304544091e rw single
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-hardened-fallback.img
}
menuentry "EndeavourOS, on linux-lts" --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-advanced-5c487842-7591-49e3-8d50-77304544091e' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 5c487842-7591-49e3-8d50-77304544091e
else
search --no-floppy --fs-uuid --set=root 5c487842-7591-49e3-8d50-77304544091e
fi
echo 'Loading kernel linux-lts ...'
linux /boot/vmlinuz-linux-lts root=UUID=5c487842-7591-49e3-8d50-77304544091e rw loglevel=3 quiet nowatchdog
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux-lts.img
}
### END /etc/grub.d/32_linux_proxy ###
### BEGIN /etc/grub.d/61_custom_proxy ###
# 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.
### END /etc/grub.d/61_custom_proxy ###
### BEGIN /etc/grub.d/62_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/62_custom ###
### BEGIN /etc/grub.d/63_memtest86+_proxy ###
if [ "${grub_platform}" == "pc" ]; then
fi
### END /etc/grub.d/63_memtest86+_proxy ###
I booted it up with the repair boot liveusb,
pressed "advanced option"
under "main option" , i pressed "backup partition table, bootsectors and logs"
boot repair generate a zip file , which contains :
did you edit the /etc/default/grub or one of the files in /etc/grub.d?
That's what i can't remember. I was exhausted back then.
Can you tell me what is the different purpose of both
/etc/default/grub
and
/etc/grub.d
which is template for grub-mkconfig ?
The error messages you posted above in post 7 indicate it is likely that there are error in the /etc/default/grub file. Post the contents here so members can view it and hopefully tell you what to change. Did you modify the 30_os-prober file or one of the other files (40_custom). You implied earlier that you had disabled 30_os-prober so post the permissions on that file.
Code:
ls -l /etc/grub.d/30_os-prober
The comment below (beginning on line 5) of the bootinfoscript tells us that windows is hibernated and Grub will never create an entry for a hibernated system.
Quote:
Windows is hibernated, refused to mount.
You should have an option to Create BootInfo Summary on boot repair, use that.
andrew posted several changes to grub installation and configuration but not the "boot time results" of any of it (is booting windows an option yet?)
obviously andrew you want to insure your grub is the right version, that you have it installed original (noting on ubuntu original means highly hacked!). you don't have a backup to check (you should).
you should seek to see what the default install files (for ubuntu not for grub, for ubuntu post-install not before installed) are and use those and will likely see what you should. that's the way you'd get "rolling release support". running grub config may have "permanently ooops'ed" that feature
The error messages you posted above in post 7 indicate it is likely that there are error in the /etc/default/grub file. Post the contents here so members can view it and hopefully tell you what to change. Did you modify the 30_os-prober file or one of the other files (40_custom). You implied earlier that you had disabled 30_os-prober so post the permissions on that file.
Sorry, reply late. Was sick, due to improper late sleeping.. what a start for new year.
I think i modified 30_os-prober .. i remember 30_os-prober something.. was late and tired. I don't recall anything about 40_custom.
The comment below (beginning on line 5) of the bootinfoscript tells us that windows is hibernated and Grub will never create an entry for a hibernated system.
You should have an option to Create BootInfo Summary on boot repair, use that.
I don't understand what did you meant by "windows is hibernated and grub..... hibernated system".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.