Ubuntu 10.10 - 邮件服务器上的 Grub 启动问题

Ubuntu 10.10 - 邮件服务器上的 Grub 启动问题

今天早上,一位用户来找我,告诉我从外部世界发送的电子邮件没有出现在他的工作邮箱收件箱中。我们内部托管电子邮件服务器(不是我的主意)。我通过从我的 gmail 帐户向我的工作邮箱发送电子邮件进行了测试,正如预期的那样,电子邮件从未到达。

我去重新启动邮件服务器(运行 Ubuntu 10.10),就在启动 GRUB 引导加载程序之前,服务器会重新启动回到 POST/BIOS“检查内存”消息,就好像我按下了重置按钮一样。

我去刻录了一份 10.10 的副本,并尝试运行系统救援程序,看看是否能够修复启动问题,但无法修复。然后,我刻录了一份 Ubuntu 18.04 的副本,看看是否有任何其他工具可以让我更深入地挖掘以找出发生了什么。

我检查了当前安装 Ubuntu 的驱动器上的 /etc/fstab,以下是我发现的内容

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/mailadmin-root /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda2 during installation
UUID=e8c63c19-db49-4013-bec8-ef8479fb52f1 /boot           ext2    defaults        0       2
/dev/mapper/mailadmin-swap_1 none            swap    sw              0       0
10.6.9.5:/volume1/Backups/Zimbra/TarBackups /zmbackup nfs,size=8192,wsize=8192,timeo=14,intr

注意到 /boot 分区的 UUID 上方的注释了吗?我没有输入该注释,它是几年前前任 IT 经理留下的。我修改了 /etc/fstab 文件以指向 /dev/sda2(我已确认这是 grub 配置所在的实际位置)而不是 UUID,重新启动 - 但服务器在即将加载 grub 时仍然进入重新启动循环。

经过一番谷歌搜索,我找到了一个名为 bootinfoscript.sh 的脚本,它会输出一个文本文件,其中包含与系统中检测到的硬盘相关的大量信息。以下是 bootinfoscript.sh 的输出

                  Boot Info Script 0.61      [1 April 2012]


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

 => Grub2 (v1.97-1.98) is installed in the MBR of /dev/sda and looks at sector 
    2048 of the same hard drive for core.img. core.img is at this location and 
    looks in partition 2 for /grub.
 => Syslinux MBR (4.04 and higher) is installed in the MBR of /dev/sdb.

sda1: __________________________________________________________________________

    File system:       BIOS Boot partition
    Boot sector type:  Grub2's core.img
    Boot sector info: 

sda2: __________________________________________________________________________

    File system:       ext2
    Boot sector type:  -
    Boot sector info: 
    Operating System:  
    Boot files:        /grub/grub.cfg /grub/core.img

sda3: __________________________________________________________________________

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

sdb1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  SYSLINUX 6.03
    Boot sector info:  Syslinux looks at sector 32784 of /dev/sdb1 for its 
                       second stage. The integrity check of Syslinux failed. 
                       No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /boot/grub/grub.cfg /syslinux.cfg 
                       /efi/BOOT/grubx64.efi /ldlinux.sys

mailadmin-root': _______________________________________________________________

    File system:       
    Boot sector type:  Unknown
    Boot sector info: 
    Mounting failed:   mount: /tmp/BootInfo-TMXYqs5T/LVM/mailadmin-root': unknown filesystem type ''.

mailadmin-swap_1': _____________________________________________________________

    File system:       
    Boot sector type:  Unknown
    Boot sector info: 
    Mounting failed:   mount: /tmp/BootInfo-TMXYqs5T/LVM/mailadmin-root': unknown filesystem type ''.
mount: /tmp/BootInfo-TMXYqs5T/LVM/mailadmin-swap_1': unknown filesystem type ''.

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

Drive: sda _____________________________________________________________________
Disk /dev/sda: 10.9 TiB, 11999064883200 bytes, 23435673600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sda1                   1 4,294,967,295 4,294,967,295  ee GPT


GUID Partition Table detected.

Partition    Start Sector    End Sector  # of Sectors System
/dev/sda1           2,048         4,095         2,048 BIOS Boot partition
/dev/sda2           4,096       503,807       499,712 Data partition (Windows/Linux)
/dev/sda3         503,808 7,329,544,191 7,329,040,384 Logical Volume Manager (LVM) partition (Linux)

Drive: sdb _____________________________________________________________________
Disk /dev/sdb: 14.4 GiB, 15500574720 bytes, 30274560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos

Partition  Boot  Start Sector    End Sector  # of Sectors  Id System

/dev/sdb1    *          2,048    30,274,559    30,272,512   c W95 FAT32 (LBA)


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/loop0                                              squashfs   
/dev/loop1                                              squashfs   
/dev/loop2                                              squashfs   
/dev/loop3                                              squashfs   
/dev/loop4                                              squashfs   
/dev/loop5                                              squashfs   
/dev/loop6                                              squashfs   
/dev/loop7                                              squashfs   
/dev/mapper/mailadmin-root 3e2b9e3a-7190-4240-804e-f1761fa96ade   ext4       
/dev/mapper/mailadmin-swap_1 2b7f558a-2abe-4981-879e-d79f7ed3fb01   swap       
/dev/sda1                                                          
/dev/sda2        e8c63c19-db49-4013-bec8-ef8479fb52f1   ext2       
/dev/sda3        WFe0Xa-LXJa-BzOr-Oyo9-kC5E-3W7p-qWA5Uy LVM2_member 
/dev/sdb1        6045-3252                              vfat       UBUNTU 18_0

========================= "ls -R /dev/mapper/" output: =========================

/dev/mapper:
control
mailadmin-root
mailadmin-swap_1

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/loop0       /rofs                    squashfs   (ro,noatime)
/dev/sdb1        /cdrom                   vfat       (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)


============================= sda2/grub/grub.cfg: ==============================

--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/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
  load_env
fi
set default="0"
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 recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,2)'
search --no-floppy --fs-uuid --set e8c63c19-db49-4013-bec8-ef8479fb52f1
set locale_dir=($root)/grub/locale
set lang=en
insmod gettext
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

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

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
    insmod ext2
    set root='(hd0,2)'
    search --no-floppy --fs-uuid --set e8c63c19-db49-4013-bec8-ef8479fb52f1
    linux16 /memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
    insmod ext2
    set root='(hd0,2)'
    search --no-floppy --fs-uuid --set e8c63c19-db49-4013-bec8-ef8479fb52f1
    linux16 /memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ ${timeout} != -1 ]; then
  if keystatus; then
    if keystatus --shift; then
      set timeout=-1
    else
      set timeout=0
    fi
  else
    if sleep --interruptible 3 ; then
      set timeout=0
    fi
  fi
fi
### 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 ###
--------------------------------------------------------------------------------

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

           GiB - GB             File                                 Fragment(s)


=========================== sdb1/boot/grub/grub.cfg: ===========================

--------------------------------------------------------------------------------

if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

set timeout=5
menuentry "Try Ubuntu without installing" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash ---
    initrd  /casper/initrd.lz
}
menuentry "Install Ubuntu" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
    initrd  /casper/initrd.lz
}
menuentry "OEM install (for manufacturers)" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash oem-config/enable=true ---
    initrd  /casper/initrd.lz
}
menuentry "Check disc for defects" {
    set gfxpayload=keep
    linux   /casper/vmlinuz  boot=casper integrity-check quiet splash ---
    initrd  /casper/initrd.lz
}
--------------------------------------------------------------------------------

============================== sdb1/syslinux.cfg: ==============================

--------------------------------------------------------------------------------
DEFAULT loadconfig

LABEL loadconfig
  CONFIG /isolinux/isolinux.cfg
  APPEND /isolinux/
--------------------------------------------------------------------------------

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

           GiB - GB             File                                 Fragment(s)


================= sdb1: Location of files loaded by Syslinux: ==================

           GiB - GB             File                                 Fragment(s)


======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on mailadmin-root'


Unknown BootLoader on mailadmin-swap_1'



=============================== StdErr Messages: ===============================

cat: /tmp/BootInfo-TMXYqs5T/Tmp_Log: No such file or directory
cat: /tmp/BootInfo-TMXYqs5T/Tmp_Log: No such file or directory
cat: /tmp/BootInfo-TMXYqs5T/Tmp_Log: No such file or directory
  Failed to find logical volume "mailadmin/root'"
  Failed to find logical volume "mailadmin/root'"
  Failed to find logical volume "mailadmin/root'"
hexdump: /dev/mapper/mailadmin-root': No such file or directory
hexdump: /dev/mapper/mailadmin-root': No such file or directory
  Failed to find logical volume "mailadmin/swap_1'"
  Failed to find logical volume "mailadmin/swap_1'"
  Failed to find logical volume "mailadmin/swap_1'"
hexdump: /dev/mapper/mailadmin-swap_1': No such file or directory
hexdump: /dev/mapper/mailadmin-swap_1': No such file or directory

仅提供一些背景信息,/dev/sda 是一个 12TB 的分区,其中安装了邮件服务器软件。/dev/sdb 是一个 16GB 的 USB 拇指驱动器,我将 Ubuntu 安装在上面。

我安装了 12TB(实际上是一个 RAID 阵列)/dev/sda1 驱动器,当我浏览到已安装驱动器上的 /boot 文件夹时,似乎 /boot 目录完全是空的!

在此处输入图片描述

有人知道这是怎么回事吗?有没有什么方法可以修复这台旧服务器上的 grub 引导加载程序?

如果您需要任何其他详细信息,请告诉我。

答案1

我们可以通过在另一台服务器上安装相同版本的 Ubuntu 并从新安装的服务器复制 /boot 的内容并修改 /etc/fstab 以指向 /dev 中的正确分区来解决此问题。

相关内容