From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.77) (envelope-from ) id 1Spn1Z-000472-N3 for garchives@archives.gentoo.org; Fri, 13 Jul 2012 21:03:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 96DAEE0684 for ; Fri, 13 Jul 2012 21:03:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 85F5CE074E for ; Fri, 13 Jul 2012 18:06:54 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 92D841B4035 for ; Fri, 13 Jul 2012 18:06:53 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 617) id 4024320063; Fri, 13 Jul 2012 18:06:52 +0000 (UTC) From: "Sven Vermeulen (swift)" To: gentoo-doc-cvs@lists.gentoo.org Subject: [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en: grub2-migration.xml metadoc.xml X-VCS-Repository: gentoo X-VCS-Files: grub2-migration.xml metadoc.xml X-VCS-Directories: xml/htdocs/doc/en X-VCS-Committer: swift X-VCS-Committer-Name: Sven Vermeulen Content-Type: text/plain; charset=utf8 Message-Id: <20120713180652.4024320063@flycatcher.gentoo.org> Date: Fri, 13 Jul 2012 18:06:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-doc-cvs@lists.gentoo.org Reply-to: docs-team@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: e53ea98e-921a-493e-9472-d0493c7a5f76 X-Archives-Hash: eacbc0637eba76e83b8737e09bc5f3c7 swift 12/07/13 18:06:52 Modified: metadoc.xml Added: grub2-migration.xml Log: Fix #316603 (part 1) - introduce grub2 migration guide Revision Changes Path 1.240 xml/htdocs/doc/en/metadoc.xml file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/meta= doc.xml?rev=3D1.240&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/meta= doc.xml?rev=3D1.240&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/meta= doc.xml?r1=3D1.239&r2=3D1.240 Index: metadoc.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v retrieving revision 1.239 retrieving revision 1.240 diff -u -r1.239 -r1.240 --- metadoc.xml 22 Apr 2012 03:37:37 -0000 1.239 +++ metadoc.xml 13 Jul 2012 18:06:52 -0000 1.240 @@ -1,8 +1,8 @@ - + - 1.161 + 1.162 nightmorph cam @@ -322,6 +322,7 @@ /doc/en/hpc-howto.xml /proj/en/base/embedded/gnap-userguide.xm= l /doc/en/grub-error-guide.xml + /doc/en/grub2-migration.xml /doc/en/usb-guide.xml /doc/en/liveusb.xml /doc/en/fluxbox-config.xml @@ -994,6 +995,9 @@ install_other + + upgrade + install_other 1.1 xml/htdocs/doc/en/grub2-migration.xml file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/grub= 2-migration.xml?rev=3D1.1&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/grub= 2-migration.xml?rev=3D1.1&content-type=3Dtext/plain Index: grub2-migration.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D GRUB2 migration from GRUB Legacy The goal of this guide is to provide you with a smooth migration from GRU= B Legacy to GRUB2. 1 2012-07-13 Background
What's Grub?

Grub is one of the most commonly found boot loaders in use on non-embedde= d Linux machines. The role of Grub is to facilitate the Linux kernel being = loaded from your disk into memory and start executing the Linux kernel.

So Why Migrate?

Firstly, GRUB Legacy is no longer maintained and as such no longer receiv= es updates. GRUB Legacy was created at a time when the developers felt safe = in making several assumptions which no longer hold true today. For example, GRUB Legacy is unable to boot from disks larger than 2TB and assumes that newer filesystems wouldn't come to replace /boot.

GRUB2 aims to be more robust, more portable, more powerful and is maintai= ned with a cleaner code base. GRUB2 supports more hardware configurations, mo= re filesystems and more drive layouts than its predecessor.

Migration to GRUB2

Migration to GRUB2 is fairly straightforward: it will be pulled in as par= t of your regular upgrade process by your package manager. If it is not pul= led in automatically, you can always install sys-boot/grub:2.

Boot Drive

The first important part is to understand what your bootable drive is. Fo= r many people it will be /dev/sda. The easiest way to find thi= s is to look at how your existing GRUB Legacy is setup by viewing /boot/grub/grub.conf. An example one is provided below.

You must have your /boot mounted to be able to view these fi= les. It should be as simple as mount /boot to mount /boot.
default 0
timeout 30
splashimage=3D(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 3.2.12
root (hd0,0)
kernel /boot/kernel-3.2.12-gentoo root=3D/dev/sda3 quiet dolvm
initrd /boot/initramfs-genkernel-x86_64-3.2.12-gentoo

Based on the above file we know that (hd0) is the boot drive but w= e must map this to a real device. To know this you must view /boot/grub/device.map. An example one is provided below.

(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb

Based on the above file we know that /dev/sda is the boot dr= ive.

=09
Installing and Configuring GRUB2

The next step is to install and configure GRUB2 on your /boot partition without removing GRUB Legacy from your MBR. The example below uses /dev/sda but you must replace it with your boot drive p= ath. The first step installs the necessary GRUB2 files to /boot/grub2, while the second step scans your available kernels and generates a suitab= le config file to /boot/grub2/grub.cfg.

# grub2-install --grub-setup=3D/bin/true /dev/sda
Installation finished. No error reported.
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/kernel-3.2.12-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.12-gentoo
done
GRUB2 has strict naming requirements for kernels and initramfs images. A kernel must be named kernel-${version} while an initramfs must be named initramfs-${version}, initramfs-genkernel-${version}, initramfs-genkernel-${arch}-${version}, initrd-${version}.img, initrd.img-${version}, initrd-${version}.gz, or initrd-${version}. Together with ${version}, the filename must match a corresponding kernel that is available in /boot.
Chainloading GRUB2 from GRUB Legacy to test the setup

Because a broken GRUB configuration could mean an unbootable system, we want to test our GRUB2 configuration before making it permenan= t. To do this we will chainload GRUB2 from GRUB Legacy. This is done by addi= ng a new section into /boot/grub/grub.conf. An example is shown below.

Beaware that your root maybe different from (hd0,0) used in the example and make sure you reuse the same root value from your /boot/grub/grub.conf.
default 0
timeout 30
splashimage=3D(hd0,0)/boot/grub/splash.xpm.gz

title GRUB2 Chainload
root (hd0,0)
kernel /boot/grub2/i386-pc/core.img
boot

title Gentoo Linux 3.2.12
root (hd0,0)
kernel /boot/kernel-3.2.12-gentoo root=3D/dev/sda3 quiet dolvm
initrd /boot/initramfs-genkernel-x86_64-3.2.12-gentoo

At this point you should reboot your machine and select the GRUB2 Chainload from the GRUB menu when your machine begins to boo= t. You will be presented with another GRUB menu which should advertise itsel= f as GRUB 2.0.0 or higher at the top and show your available kernel(s) to b= oot. Should this not work, simply reboot your system and pick your normal boot option instead of GRUB2 Chainload.

Replacing and removing GRUB Legacy

At this point if everything worked successfully you can replace GRUB Lega= cy and remove it from your system.

Since you've rebooted your system, you may need to mount /boot again. You should also take note to use your boot drive path instead of /dev/sda.
# grub2-install /dev/sda
Installation finished. No error reported.
# rm -rf /boot/grub/

At this point you can use your package manager to remove sys-boot/grub= :0. The migration is complete.

Maintaining GRUB2

Whenever you install a new kernel, you must perform the next step so that your GRUB2 configuration recognizes the new kernel.

You must have your /boot partition mounted for this step.
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/kernel-3.3.8-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.3.8-gentoo
Found linux image: /boot/kernel-3.2.12-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.2.12-gentoo
done
FAQ / Known Problems / Gotchas

Content to come.