GRUB:从 Debian Wheezy 更新到 Jessie 后找不到文件

GRUB:从 Debian Wheezy 更新到 Jessie 后找不到文件

我有一个运行 Debian Wheezy 的在线服务器。昨天,我更新了杰西。

我在升级过程中没有遇到任何问题,但是当我重新启动机器时,它没有上线。

我可以通过 KVM 访问机器,在出现找不到文件的错误消息(但不告诉是哪个文件)后,它会显示 grub 提示符。

经过在网上的一些搜索,我能够使用以下命令成功启动操作系统:

linux (hd0,msdos1)/vmlinuz-3.16.0-4-646-pae root=/dev/sda4
initrd (hd0,msdos1)/initrd.img-3.16.0-4-686-pae
boot

仅供参考,以下是 $prefix 和 $root 的值:

echo $root
hd0,msdos4

echo $prefix
(hd0,msdos1)/grub

现在操作系统已经启动,我可以正常登录并使用以下命令修复GRUB:

sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.16.0-4-686-pae
Found initrd image: /boot/initrd.img-3.16.0-4-686-pae
Found linux image: /boot/vmlinuz-3.2.0-4-686-pae
Found initrd image: /boot/initrd.img-3.2.0-4-686-pae
done

sudo grub-mkconfig

Generating grub configuration file ...
#
# 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 ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  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,msdos4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4 --hint='hd0,msdos4'  87b34327-2d5b-429e-8cdb-5fd379f12fa2
else
  search --no-floppy --fs-uuid --set=root 87b34327-2d5b-429e-8cdb-5fd379f12fa2
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=-1
else
  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
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
        set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode

Found linux image: /boot/vmlinuz-3.16.0-4-686-pae
Found initrd image: /boot/initrd.img-3.16.0-4-686-pae
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod ext2
        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'  9db62512-db87-4bbd-8dfd-02a642f0f772
        else
          search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
        fi
        echo    'Loading Linux 3.16.0-4-686-pae ...'
        linux   /vmlinuz-3.16.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /initrd.img-3.16.0-4-686-pae
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
        menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-686-pae-advanced-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                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'  9db62512-db87-4bbd-8dfd-02a642f0f772
                else
                  search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
                fi
                echo    'Loading Linux 3.16.0-4-686-pae ...'
                linux   /vmlinuz-3.16.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /initrd.img-3.16.0-4-686-pae
        }
        menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-686-pae (sysvinit)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-686-pae-init-sysvinit-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                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'  9db62512-db87-4bbd-8dfd-02a642f0f772
                else
                  search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
                fi
                echo    'Loading Linux 3.16.0-4-686-pae ...'
                linux   /vmlinuz-3.16.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro  quiet init=/lib/sysvinit/init
                echo    'Loading initial ramdisk ...'
                initrd  /initrd.img-3.16.0-4-686-pae
        }
 menuentry 'Debian GNU/Linux, with Linux 3.16.0-4-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-4-686-pae-recovery-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                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'  9db62512-db87-4bbd-8dfd-02a642f0f772
                else
                  search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
                fi
                echo    'Loading Linux 3.16.0-4-686-pae ...'
                linux   /vmlinuz-3.16.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro single
                echo    'Loading initial ramdisk ...'
                initrd  /initrd.img-3.16.0-4-686-pae
        }
Found linux image: /boot/vmlinuz-3.2.0-4-686-pae
Found initrd image: /boot/initrd.img-3.2.0-4-686-pae
        menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-686-pae-advanced-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                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'  9db62512-db87-4bbd-8dfd-02a642f0f772
                else
                  search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
                fi
                echo    'Loading Linux 3.2.0-4-686-pae ...'
                linux   /vmlinuz-3.2.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /initrd.img-3.2.0-4-686-pae
        }
        menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae (sysvinit)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-686-pae-init-sysvinit-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                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'  9db62512-db87-4bbd-8dfd-02a642f0f772
                else
                  search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
                fi
                echo    'Loading Linux 3.2.0-4-686-pae ...'
                linux   /vmlinuz-3.2.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro  quiet init=/lib/sysvinit/init
                echo    'Loading initial ramdisk ...'
                initrd  /initrd.img-3.2.0-4-686-pae
        }
menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-686-pae-recovery-87b34327-2d5b-429e-8cdb-5fd379f12fa2' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                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'  9db62512-db87-4bbd-8dfd-02a642f0f772
                else
                  search --no-floppy --fs-uuid --set=root 9db62512-db87-4bbd-8dfd-02a642f0f772
                fi
                echo    'Loading Linux 3.2.0-4-686-pae ...'
                linux   /vmlinuz-3.2.0-4-686-pae root=UUID=87b34327-2d5b-429e-8cdb-5fd379f12fa2 ro single
                echo    'Loading initial ramdisk ...'
                initrd  /initrd.img-3.2.0-4-686-pae
        }
}

### END /etc/grub.d/10_linux ###

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

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

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### 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 ###
done

之后,我重新启动以检查一切正常,但我仍然遇到同样的问题。

最后一条信息:我在 /etc/default/grub 中将变量 GRUB_TIMEOUT 更新为 -1(也用 180 检查),但是当我重新启动时,我看不到提示。我直接进入 GRUB 提示符。

我可以做什么来解决这个问题?我现在有点不知所措。

谢谢 !

答案1

现在它可以工作了:

sudo grub-install /dev/sda

我害怕写这个命令:)但事实证明它必须完成......

相关内容