Centos7 and Window7 grub not work after reboot

General support questions
Post Reply
User avatar
rosen
Posts: 4
Joined: 2014/11/25 16:28:59

Centos7 and Window7 grub not work after reboot

Post by rosen » 2018/04/22 10:17:03

I installed Centos7 and Windows on my desktop computer and my computer and boot success at first.

But recently I have removed a file partition(the file partition is which I installed Centos) from Windows 7,since then each time when I boot(or reboot) my computer I will get the following error message:

Code: Select all

error:unknown filesystem.
Entering resuce mode
grub resuce>
Using set will get the follwoing message:

Code: Select all

>set
prefix=(hd0,msdos9)/boot/grub2
root=hd0,msdos9
Now I found the root cause of it:msdos8 should be change to msdos9,so I input the following code:

Code: Select all

>set prefix=(hd0,msdos8)/boot/grub2
>set root=hd0,msdos8
>insmod normal
>normal 
After doing this,the system can boot success and I can choose to boot Windows or Linux.

But the problem is that:If I reboot or boot my computer next time,I will still get the error list above and I have to use set to do it again.
I want to know if there is a way to fix this issue permanently?

I have tried to modify grub.cfg under /boot/grub2,but it didn't work(also tried use grub2-mkconfig to generate a new file),below is the configuration code of my grub.cfg file:

Code: Select all

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

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="${saved_entry}"
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
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux  7' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.21.1.el7.x86_64-advanced-ec143453-515a-4bc9-b17b-6bd33f305e3a' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos8'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos8 --hint-efi=hd0,msdos8 --hint-baremetal=ahci0,msdos8 --hint='hd0,msdos8'  1f858d09-5ce8-435e-9aba-7f48c3100abe
        else
          search --no-floppy --fs-uuid --set=root 1f858d09-5ce8-435e-9aba-7f48c3100abe
        fi
        linux16 /vmlinuz-3.10.0-693.21.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/swap vconsole.keymap=us rd.lvm.lv=centos/usr crashkernel=auto  vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root rhgb quiet 
        initrd16 /initramfs-3.10.0-693.21.1.el7.x86_64.img
}
if [ "x$default" = 'CentOS Linux 7' ]; then default='Advanced options for CentOS Linux>CentOS Linux (3.10.0-693.21.1.el7.x86_64) 7 (Core)'; fi;
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7' --class windows --class os $menuentry_id_option 'osprober-chain-C4DC2ACFDC2ABB94' {
        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-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  C4DC2ACFDC2ABB94
        else
          search --no-floppy --fs-uuid --set=root C4DC2ACFDC2ABB94
        fi
        parttool ${root} hidden-
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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/40_custom ###

### BEGIN /etc/grub.d/41_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/41_custom ###

kt53
Posts: 48
Joined: 2016/05/12 05:12:02

Re: Centos7 and Window7 grub not work after reboot

Post by kt53 » 2018/04/23 01:57:45

If you deleted the Linux partitions from your computer, then you also have to restore the Windows boot loader yourself.

See this article: https://www.howtogeek.com/141818/how-to ... -computer/

Post Reply