如何确保 grub 配置正确?

如何确保 grub 配置正确?

在生产服务器上,我刚刚从 ubuntu 14.04 进行了 dist-upgrade 到 14.04.01。在升级过程中,我在配置 grub 时遇到了一个严重的问题。我最终追溯了问题的根源并修复了它。

现在,虽然一切配置都正确,但我还是有点急于重启服务器(远程)。在此之前,我想确保重启过程顺利进行。我想知道我应该检查什么。

以下是我之前遇到的问题的摘要以及所采用的修复方法。

在 dist-upgrade 期间:

rub-pc
 Error in function: 
A fatal error occurred 
Please report this as a bug and include the files
 /var/log/dist-upgrade/main.log and /var/log/dist-upgrade/apt.log in
 your report. The upgrade has aborted.
 Your original sources.list was saved in
 /etc/apt/sources.list.distUpgrade. 
SystemError: E:Sub-process /usr/bin/dpkg returned an error code (1) 
Could not install the upgrades 
The upgrade has aborted. Your system could be in an unusable state. A
 recovery will run now (dpkg --configure -a). 
Please report this bug in a browser at
 http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebu...
 and attach the files in /var/log/dist-upgrade/ to the bug report.
 installArchives() failed 
Setting up grub-pc (2.02~beta2-9ubuntu1) ...
 Replacing config file /etc/default/grub with new version
 Installing for i386-pc platform.
 Installation finished. No error reported.
 Generating grub configuration file ...
 /etc/grub.d/06_OVHkernel: line 6: /usr/lib/grub/update-grub_lib: No such file or directory
 dpkg: error processing package grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
 grub-pc
Upgrade complete 
The upgrade has completed but there were errors during the upgrade
 process. 
To continue please press [ENTER]

我尝试手动配置:

# dpkg --configure -a
 Setting up grub-pc (2.02~beta2-9ubuntu1) ...
 Replacing config file /etc/default/grub with new version
 Installing for i386-pc platform.
 Installation finished. No error reported.
 Generating grub configuration file ...
 /etc/grub.d/06_OVHkernel: line 6: /usr/lib/grub/update-grub_lib: No such file or directory
 dpkg: error processing package grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 1
 Errors were encountered while processing:
 grub-pc

我终于找到解决方案并发布在这里:

https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1362723
编辑文件 /etc/grub.d/06_OVHkernel
并用 grub-mkconfig_lib 替换 update-grub_lib。

然后再次尝试重新配置,这次成功:

# sudo dpkg --configure -a
 Setting up grub-pc (2.02~beta2-9ubuntu1) ...
 Replacing config file /etc/default/grub with new version
 Installing for i386-pc platform.
 Installation finished. No error reported.
 Generating grub configuration file ...
 Found linux image: /boot/bzImage-2.6.38.2-grsec-xxxx-grs-ipv6-64
 No volume groups found
 done

/etc/default/grub 在升级过程中发生了变化,但我不知道它如何影响 grub:

-GRUB_CMDLINE_LINUX_DEFAULT="" 
+GRUB_CMDLINE_LINUX_DEFAULT="nomdmonddf nomdmonisw"  
-GRUB_DISABLE_LINUX_UUID=true
+#GRUB_DISABLE_LINUX_UUID=true  

我找不到该文件中的值的文档。

那么,我现在应该检查什么来确保系统已准备好成功重启?

答案1

以下问题和答案为回答我自己的问题提供了一些有用的指示:

如何在托管环境中正确更新 Grub

相关内容