<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>grub Archives | Xiaoming Tu - Blog</title>
	<atom:link href="https://www.xiaomingtu.com/tags/grub/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xiaomingtu.com/tags/grub</link>
	<description>学习、工作、生活，点点滴滴。</description>
	<lastBuildDate>Mon, 12 Jul 2010 09:08:24 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>如何在重装Windows 7之后恢复Grub菜单</title>
		<link>https://www.xiaomingtu.com/archives/11001?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-restore-grub-after-reinstall-windows7</link>
					<comments>https://www.xiaomingtu.com/archives/11001#comments</comments>
		
		<dc:creator><![CDATA[Xiaoming]]></dc:creator>
		<pubDate>Fri, 18 Dec 2009 03:43:13 +0000</pubDate>
				<category><![CDATA[专业技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[桌面应用]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[grub2]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[windows7]]></category>
		<guid isPermaLink="false">/2009/12/18/how-to-restore-grub-after-reinstall-windows7.html</guid>

					<description><![CDATA[<p>最近有机会从单位里弄到了正版Windows 7的License，于是迫不及待的将之前的测试版Win 7（7100版）换掉，从单位里拿回安装盘之后就屁颠屁颠的装系统了，相对于7100，感觉正式版用起来更又安全感，而且感觉也提升了一些东西，：），不过也有可能是用着正版系统的心理作用，哈哈。用过几天之后，今天才想起应该恢复一下系统启动菜单，不然进不去Ubuntu了。 其实在重装Win 7之前已经做过功课了，确定可以回复系统启动项的，所以才感安心直接重装。当时找到的解决方法是从这里的网页得到的，方法还是蛮简单的。 最终目的 安装Grub 如何安装Grub 通过 grub-install 命令安装Grub。 首先用Ubuntu 的liveCD进入系统，运行Terminal，通过命令 “fdisk -l”查看系统现有的分区，因为是从CD启动的，所以如果不能直接使用命令“grub-install”安装Grub，必须指定它的“&#8211;root-directory”参数，具体原因可以看这里。下面是我的安装过程： 1. 用“fdisk -l”看到下面的结果： root@rextu-laptop:~# fdisk -l Disk /dev/sda: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xb2f1d8ee Device Boot Start End Blocks Id System /dev/sda1 * [&#8230;]</p>
<p>The post <a href="https://www.xiaomingtu.com/archives/11001">如何在重装Windows 7之后恢复Grub菜单</a> appeared first on <a href="https://www.xiaomingtu.com">Xiaoming Tu - Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">最近有机会从单位里弄到了正版</span>Windows 7<span style="font-family: DejaVu Sans;">的</span>License<span style="font-family: DejaVu Sans;">，于是迫不及待的将之前的测试版</span>Win 7<span style="font-family: DejaVu Sans;">（</span>7100<span style="font-family: DejaVu Sans;">版）换掉，从单位里拿回安装盘之后就屁颠屁颠的装系统了，相对于</span>7100<span style="font-family: DejaVu Sans;">，感觉正式版用起来更又安全感，而且感觉也提升了一些东西，：），不过也有可能是用着正版系统的心理作用，哈哈。用过几天之后，今天才想起应该恢复一下系统启动菜单，不然进不去</span>Ubuntu<span style="font-family: DejaVu Sans;">了。</span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">其实在重装</span>Win 7<span style="font-family: DejaVu Sans;">之前已经做过功课了，确定可以回复系统启动项的，所以才感安心直接重装。当时找到的解决方法是从<a href="http://www.eb163.com/home/space-5912-do-blog-id-753.html" target="_blank">这里的网页</a>得到的，方法还是蛮简单的。</span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in; text-decoration: none;"><span style="font-family: DejaVu Sans;"><strong>最终目的</strong></span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">安装</span>Grub</p>
<p style="text-indent: 0.31in; margin-bottom: 0in; text-decoration: none;"><span style="font-family: DejaVu Sans;"><strong>如何安装</strong></span><strong>Grub<span id="more-11001"></span><br />
</strong></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">通过 </span>grub-install <span style="font-family: DejaVu Sans;">命令安装</span>Grub<span style="font-family: DejaVu Sans;">。</span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;">首先用</span>Ubuntu <span style="font-family: DejaVu Sans;">的</span>liveCD<span style="font-family: DejaVu Sans;">进入系统，运行</span>Terminal<span style="font-family: DejaVu Sans;">，通过命令 “</span>fdisk -l”<span style="font-family: DejaVu Sans;">查看系统现有的分区，因为是从</span>CD<span style="font-family: DejaVu Sans;">启动的，所以如果不能直接使用命令“</span>grub-install”<span style="font-family: DejaVu Sans;">安装</span>Grub<span style="font-family: DejaVu Sans;">，必须指定它的“</span>&#8211;root-directory”<span style="font-family: DejaVu Sans;">参数，具体原因可以<a href="http://www.gnu.org/software/grub/manual/html_node/Invoking-grub_002dinstall.html#Invoking-grub_002dinstall">看这里</a><span style="text-decoration: none;">。下面是我的安装过程：</span></span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">1. <span style="font-family: DejaVu Sans;">用“</span></span><span style="text-decoration: none;">fdisk -l”<span style="font-family: DejaVu Sans;">看到下面的结果：</span></span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">root@rextu-laptop:~# fdisk -l </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;"> </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">Disk /dev/sda: 160.0 GB, 160041885696 bytes </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">255 heads, 63 sectors/track, 19457 cylinders </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">Units = cylinders of 16065 * 512 = 8225280 bytes </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">Disk identifier: 0xb2f1d8ee </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;"> </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;"> Device Boot      Start         End      Blocks   Id  System </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda1   *           1        3825    30724281    7  HPFS/NTFS </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda2            3826       19457   125564040    5  Extended </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda5            3826        7650    30724281    7  HPFS/NTFS </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda6            7651       11475    30724281    7  HPFS/NTFS </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda7           11476       12622     9213246   83  Linux </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda8           14026       19457    43632508+   7  HPFS/NTFS </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda9           12624       13015     3148708+  82  Linux swap / Solaris </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">/dev/sda10          13016       14025     8112793+  83  Linux </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;"> </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">Partition table entries are not in disk order </span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">2. <span style="font-family: DejaVu Sans;">之前</span></span><span style="text-decoration: none;">Ubuntu<span style="font-family: DejaVu Sans;">是安装在 </span></span><span style="text-decoration: none;">/dev/sda7 <span style="font-family: DejaVu Sans;">的，所以现在需要挂在该分区到 </span></span><span style="text-decoration: none;">/mnt <span style="font-family: DejaVu Sans;">以便后面“</span></span><span style="text-decoration: none;">grub-install” <span style="font-family: DejaVu Sans;">可以用来作为 </span></span><span style="text-decoration: none;">root-drectory<span style="font-family: DejaVu Sans;">。挂在命令：“</span></span><span style="text-decoration: none;">mount /dev/sda7 /mnt”<span style="font-family: DejaVu Sans;">。</span></span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="text-decoration: none;">3. <span style="font-family: DejaVu Sans;">安装</span></span><span style="text-decoration: none;">Grub<span style="font-family: DejaVu Sans;">，命令为：“</span></span><span style="text-decoration: none;">grub-install –root-directory=/mnt /dev/sda”<span style="font-family: DejaVu Sans;">。其中“</span></span><span style="text-decoration: none;">/dev/sda”<span style="font-family: DejaVu Sans;">是我的硬盘的名称吧，我也不知道该怎么叫，理论上来说应该可以使用“</span></span><span style="text-decoration: none;">hd0”<span style="font-family: DejaVu Sans;">，但是用“</span></span><span style="text-decoration: none;">hd0”<span style="font-family: DejaVu Sans;">不总是有效，这里涉及到一个问题就是“</span></span><span style="text-decoration: none;"><a href="http://www.gnu.org/software/grub/manual/html_node/Device-map.html#Device-map">The map between BIOS drives and OS devices</a>”<span style="font-family: DejaVu Sans;">，即</span></span><span style="text-decoration: none;">Device Map<span style="font-family: DejaVu Sans;">，某些时候“</span></span><span style="text-decoration: none;">/dev/sda”<span style="font-family: DejaVu Sans;">不一定对应于“</span></span><span style="text-decoration: none;"><br />
&gt;hd0”<span style="font-family: DejaVu Sans;">，根据不同的设备会有所不同，用“</span></span><span style="text-decoration: none;">/dev/sda”<span style="font-family: DejaVu Sans;">的没问题是因为我们在第</span></span><span style="text-decoration: none;">1<span style="font-family: DejaVu Sans;">步中已经看到了硬盘的名称是这个。</span></span><span style="text-decoration: none;">&#8220;grub-install”<span style="font-family: DejaVu Sans;">执行完毕之后，会提示你查看“</span></span><span style="text-decoration: none;">/boot/grub/device.map”<span style="font-family: DejaVu Sans;">是否正确，也就是让你确定</span></span><span style="text-decoration: none;">Grub<span style="font-family: DejaVu Sans;">是否猜对了“</span></span><span style="text-decoration: none;"><a href="http://www.gnu.org/software/grub/manual/html_node/Device-map.html#Device-map">The map between BIOS drives and OS devices</a>”<span style="font-family: DejaVu Sans;">。</span></span></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;"><strong><span style="text-decoration: none;">更新</span></strong></span><strong><span style="text-decoration: none;">Grub</span></strong></p>
<p style="text-indent: 0.31in; margin-bottom: 0in;"><span style="font-family: DejaVu Sans;"><span style="text-decoration: none;">重启系统之后可以看到之前的启动菜单又出来了，不过</span></span><span style="text-decoration: none;">Win 7<span style="font-family: DejaVu Sans;">无法进入了。按照我<a title="如何修改Grub 2（Ubuntu 9.10）的系统启动项 " href="http://xiaomingtu.com/archives/10001" target="_blank">之前这篇文章</a>的介绍，通过命令“</span></span><span style="text-decoration: none;">update-grub”<span style="font-family: DejaVu Sans;">即可重置</span></span><span style="text-decoration: none;">Grub<span style="font-family: DejaVu Sans;">。之所以进不去可能是因为</span></span><span style="text-decoration: none;">Win 7<span style="font-family: DejaVu Sans;">重装之后地址不一样了吧，反正用“</span></span><span style="text-decoration: none;">update-grub”<span style="font-family: DejaVu Sans;">更新一下肯定行的。</span></span></p>
<p>The post <a href="https://www.xiaomingtu.com/archives/11001">如何在重装Windows 7之后恢复Grub菜单</a> appeared first on <a href="https://www.xiaomingtu.com">Xiaoming Tu - Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.xiaomingtu.com/archives/11001/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>如何修改Grub 2（Ubuntu 9.10）的系统启动项</title>
		<link>https://www.xiaomingtu.com/archives/10001?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-custom-boot-menu-under-grub2</link>
					<comments>https://www.xiaomingtu.com/archives/10001#comments</comments>
		
		<dc:creator><![CDATA[Xiaoming]]></dc:creator>
		<pubDate>Fri, 11 Dec 2009 06:20:03 +0000</pubDate>
				<category><![CDATA[专业技术]]></category>
		<category><![CDATA[教程]]></category>
		<category><![CDATA[桌面应用]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[grub2]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">/2009/12/11/how-to-custom-boot-menu-under-grub2.html</guid>

					<description><![CDATA[<p>在早期的Ubuntu中，使用Grub作为系统的启动引导程序，想修改系统启动项非常简单，只要用gedit打开系统菜单设定文件（ sudo gedit /boot/grub/menu.lst ），修改该文件中到内容即可，但是到了Grub 2中，不能采用这种方式修改系统启动项了。 Grub 2特性 Grub 2（GRand Unified Bootloader, version 2）是Grub的第二版。Grub 2对Grub的接口进行了完整到重写，基于PUPA（详细介绍）项目到研究，Grub 2更模块化并且更方便扩展，Grub 2的一些提升如下： 具有图形化界面，支持主题 模块化加载 夸平台的兼容性 支持脚本 自定义的启动项目定义 修改分区命名 Grub 2结构 Grub 2包含下面几个部分： /boot/grub/grub.cfg 文件 /etc/grub.d/ 文件夹 /etc/default/grub 文件 下面开始一个个介绍。 grub.cfg类似Grub中的 /boot/grub/menu.lst。里面的格式于menu.lst差不多，但是现在不允许你通过直接修改该文件到方式来修改启动项，因为该文件是在执行“update-grub”或者&#8221;update-grub2”之后，根据上面说到2、3两项动态生成到，也就是说，如果你修改了这个文件当下次这两个命令被执行了，你修改到内容就会背覆盖。我发现这两个命令应该经常会自动执行的，因为上次我修改了启动画面的背景，需要通过这两个命令重新生成grub.cfg，但是后来我忘了用这两个命令，所以背景一直没有生效，当时还很纳闷，不知道怎么回事，不过今天开机用了会儿，系统又更新，装完之后重启就 好了，然后我突然想到上次可能忘了执行这命令了，没想到系统更新会自动执行，：）。 grub.cfg文件中主要包含两个部分，一部分是各个启动项的定义，第二部分是启动界面的设置。你可以直接用gedit打开该文件看其中的内容。既然grub.cfg不能修改，那也没什么好详细说的了，稍微研究下就能看懂里面是怎么写的。下面就介绍一下Grub 2的另外两个部分。 Grub 2的另外两部分内容其实就分别对应于grub.cfg中的两部分内容。首先 2. /etc/grub.d/ 文件夹中定义各个启动项，其中的文件代表了一个或多个启动项，命名规范都是“两个数字_名称”，前面的两位数字确定这个或这多个启动项在启动界面的位置，默认的 “00_“是预留给“00_header“的，“10_&#8221;是预留给当前系统内核的，&#8221;20_&#8221;是预留给第三方程序的，除了这些你都可以使用，增加自己的，比如 05_ , 15_，数字越小越前面。这里的文件好像是代码，我还没研究透，不会自己写，只会改，：（，要加油学习了。当执行前面说的“update-grub”或者&#8221;update-grub2”命令之后，这个文件夹中的文件就是用于生成 grub.cfg 中启动项的定义的。 Grub 2的最后一部分是 3. /etc/default/grub 文件，该文件主要是启动界面的配置，比如默认的启动项，等待用户选择启动项的时间等。文件内容很简单，就是一些键值对，详细的可配置属性可以参考Grub [&#8230;]</p>
<p>The post <a href="https://www.xiaomingtu.com/archives/10001">如何修改Grub 2（Ubuntu 9.10）的系统启动项</a> appeared first on <a href="https://www.xiaomingtu.com">Xiaoming Tu - Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>在早期的Ubuntu中，使用Grub作为系统的启动引导程序，想修改系统启动项非常简单，只要用gedit打开系统菜单设定文件（ sudo gedit /boot/grub/menu.lst ），修改该文件中到内容即可，但是到了Grub 2中，不能采用这种方式修改系统启动项了。</p>
<p><strong>Grub 2特性</strong></p>
<p>Grub 2（GRand Unified Bootloader, version 2）是Grub的第二版。Grub 2对Grub的接口进行了完整到重写，基于PUPA（<a title="PUPA项目详细介绍" href="http://www.nongnu.org/pupa/" target="_blank">详细介绍</a>）项目到研究，Grub 2更模块化并且更方便扩展，Grub 2的一些提升如下：</p>
<ul>
<li>具有图形化界面，支持主题</li>
<li>模块化加载</li>
<li>夸平台的兼容性</li>
<li>支持脚本</li>
<li>自定义的启动项目定义</li>
<li>修改分区命名</li>
</ul>
<p><strong>Grub 2结构</strong></p>
<p>Grub 2包含下面几个部分：</p>
<ul>
<li>/boot/grub/grub.cfg 文件</li>
<li>/etc/grub.d/ 文件夹</li>
<li>/etc/default/grub 文件</li>
</ul>
<p>下面开始一个个介绍。<span id="more-10001"></span></p>
<p>grub.cfg类似Grub中的 /boot/grub/menu.lst。里面的格式于menu.lst差不多，但是现在不允许你通过直接修改该文件到方式来修改启动项，因为该文件是在执行“update-grub”或者&#8221;update-grub2”之后，根据上面说到2、3两项动态生成到，也就是说，如果你修改了这个文件当下次这两个命令被执行了，你修改到内容就会背覆盖。我发现这两个命令应该经常会自动执行的，因为上次我修改了启动画面的背景，需要通过这两个命令重新生成grub.cfg，但是后来我忘了用这两个命令，所以背景一直没有生效，当时还很纳闷，不知道怎么回事，不过今天开机用了会儿，系统又更新，装完之后重启就 好了，然后我突然想到上次可能忘了执行这命令了，没想到系统更新会自动执行，：）。</p>
<p>grub.cfg文件中主要包含两个部分，一部分是各个启动项的定义，第二部分是启动界面的设置。你可以直接用gedit打开该文件看其中的内容。既然grub.cfg不能修改，那也没什么好详细说的了，稍微研究下就能看懂里面是怎么写的。下面就介绍一下Grub 2的另外两个部分。</p>
<p>Grub 2的另外两部分内容其实就分别对应于grub.cfg中的两部分内容。首先 2. /etc/grub.d/ 文件夹中定义各个启动项，其中的文件代表了一个或多个启动项，命名规范都是“两个数字_名称”，前面的两位数字确定这个或这多个启动项在启动界面的位置，默认的 “00_“是预留给“00_header“的，“10_&#8221;是预留给当前系统内核的，&#8221;20_&#8221;是预留给第三方程序的，除了这些你都可以使用，增加自己的，比如 05_ , 15_，数字越小越前面。这里的文件好像是代码，我还没研究透，不会自己写，只会改，：（，要加油学习了。当执行前面说的“update-grub”或者&#8221;update-grub2”命令之后，这个文件夹中的文件就是用于生成 grub.cfg 中启动项的定义的。</p>
<p>Grub 2的最后一部分是 3. /etc/default/grub 文件，该文件主要是启动界面的配置，比如默认的启动项，等待用户选择启动项的时间等。文件内容很简单，就是一些键值对，详细的可配置属性可以参考<a href="https://wiki.ubuntu.com/Grub2" target="_self">Grub 2的Wiki</a>中“grub (/etc/default/grub)”这一节。当执行前面说的“update-grub”或者&#8221;update-grub2”命令之后，这个文件的内容就用于生成 grub.cfg 中启动界面的设置。</p>
<p><strong>总结</strong></p>
<p>好了，通过上面的介绍，应该对Grub 2有些了解了，聪明的你应该想到要怎么修改默认启动项了，有下面三种方法：</p>
<ul>
<li>根据以前修改 /boot/grub/menu.lst 的方法那样直接修改已经生成好的 /boot/grub/grub.cfg。这个方法的优点是简单，缺点是修改之后会被&#8221;update-grub&#8221;命令覆盖掉。</li>
<li>修改 /etc/grub.d/ 中启动项的顺序，将你想要默认启动的项顺序设置为较小的值。优点是修改不会被&#8221;update-grub&#8221;命令覆盖掉，好像没啥缺电，只有另外的程序修改为比你的值更小了才会成为默认启动。</li>
<li>修改 /etc/default/grub 中默认的启动项，设置该文件中 GRUB_DEFAULT 为你想要的值，这个值是生成的 grub.cfg 中各个启动项的从0开始的下标。该方法优点是修改不会被&#8221;update-grub&#8221;命令覆盖，缺电是当启动项的顺序变化之后，下标也就变了。。。</li>
</ul>
<p><strong>示例</strong></p>
<p>在写这篇文章的时候，我的环境是这样的：安装了Ubuntu 9.10，内核是Linux 2.6.31-14，后来两次更新之后变成Linux 2.6.31-16，在安装Ubuntu之前是用win7的，现在是双系统，现在的启动项有（根据已经生成的 /boot/grub/grub.cfg得到）：</p>
<ul>
<li>&#8220;Ubuntu, Linux 2.6.31-16-generic&#8221;</li>
<li>&#8220;Ubuntu, Linux 2.6.31-16-generic (recovery mode)&#8221;</li>
<li>&#8220;Ubuntu, Linux 2.6.31-15-generic&#8221;</li>
<li>&#8220;Ubuntu, Linux 2.6.31-15-generic (recovery mode)&#8221;</li>
<li>&#8220;Ubuntu, Linux 2.6.31-14-generic&#8221;</li>
<li>&#8220;Ubuntu, Linux 2.6.31-14-generic (recovery mode)&#8221;</li>
<li>&#8220;Memory test (memtest86+)&#8221;</li>
<li>&#8220;Memory test (memtest86+, serial console 115200)&#8221;</li>
<li>&#8220;Windows 7 (loader) (on /dev/sda1)&#8221;</li>
</ul>
<p>呵呵，好多，我本来想根据第二种方法先删掉几个启动项的，不过想想以后可能还是会用到的，就先留着吧，所以采用第三种方法修改。现在在 /boot/grub/grub.cfg 有这么一行“set default=&#8221;0&#8243;”，注意这里的下标是从0开始的，相当于我现在的默认启动项是上面的第一个“Ubuntu, Linux 2.6.31-16-generic”，我要改为默认启动win7，所以应该将默认启动项改为 8，用下面的命令调出gedit。</p>
<blockquote><p>sudo gedit /etc/default/grub</p></blockquote>
<p>修改/etc/default/grub中<span style="color: #ff0000;">GRUB_DEFAULT=0<span style="color: #000000;">为<span style="color: #ff0000;">GRUB_DEFAULT=8<span style="color: #000000;">。</span></span></span></span></p>
<p>用下面的命令重新生成 /boot/grub/grub.cfg：</p>
<blockquote><p>sudo update-grub</p></blockquote>
<p>执行后显示：</p>
<blockquote><p>rextu@rextu-laptop:/etc/default$ sudo update-grub<br />
Generating grub.cfg &#8230;<br />
Found Debian background: moreblue-orbit-grub.png<br />
Found linux image: /boot/vmlinuz-2.6.31-16-generic<br />
Found initrd image: /boot/initrd.img-2.6.31-16-generic<br />
Found linux image: /boot/vmlinuz-2.6.31-15-generic<br />
Found initrd image: /boot/initrd.img-2.6.31-15-generic<br />
Found linux image: /boot/vmlinuz-2.6.31-14-generic<br />
Found initrd image: /boot/initrd.img-2.6.31-14-generic<br />
Found memtest86+ image: /boot/memtest86+.bin<br />
Found Windows 7 (loader) on /dev/sda1<br />
done</p></blockquote>
<p>这时候在执行：</p>
<blockquote><p>sudo gedit /boot/grub/grub.cfg</p></blockquote>
<p>可以看到其中的<span style="color: #ff0000;">set default=&#8221;0&#8243;</span>已经变成<span style="color: #ff0000;">set default=&#8221;8&#8243;</span>了。大功告成，restart，哈哈。</p>
<p>The post <a href="https://www.xiaomingtu.com/archives/10001">如何修改Grub 2（Ubuntu 9.10）的系统启动项</a> appeared first on <a href="https://www.xiaomingtu.com">Xiaoming Tu - Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.xiaomingtu.com/archives/10001/feed</wfw:commentRss>
			<slash:comments>105</slash:comments>
		
		
			</item>
	</channel>
</rss>
