# Hybrid Major Gentoo Upgrade Process

## rac

Hybrid Major Gentoo Upgrade Process

This document describes a procedure to make major upgrades to a Gentoo system, such as when changing versions of GCC.  This is not the only way to upgrade your system.  It may not be the best way to upgrade your system.  I have used it to upgrade two machines so far, and the very few problems that ensued were completely the result of pilot error and were easily corrected.

The goal of this upgrade procedure is to minimize downtime.  The main requirement for this upgrade procedure is a free disk partition.  If you have free disk space, but not in a separate partition, look into a partition resizing program such as GNU parted.  I call it a hybrid because it's halfway between upgrading your system in place and reinstalling from scratch when booting from an installation CD.

For the purposes of this post, we will call the running Gentoo system 1.2 and the desired upgrade system 1.4.

1. Compile a kernel in your 1.2 environment that can read all filesystems both of the 1.2 and 1.4 systems.  If you are changing filesystems as part of this upgrade, you need a kernel now that will be able to read them all.  Install this kernel and reboot with it.

2. Make the filesystem that will become your 1.4 root on the free partition you have set aside for this purpose.  For the rest of this post, this partition will be called /dev/hdb1.  The root of your 1.2 installation is /dev/hda1.

3. Download a stage tarball for the new Gentoo installation.  Note that some people (see later in the thread for details) have had trouble using stage 3 tarballs.  I used a stage 1.

4. Make a mount point in your 1.2 root for your 1.4 system.  I called mine /mnt/womb.

5. Mount /dev/hdb1 on /mnt/womb

6. Use "tar xvjpf" to untar the stage tarball across /mnt/womb.

7. Bind-mount /proc on /mnt/womb/proc: 

```
# mount -o bind /proc /mnt/womb/proc
```

8. Open a new terminal or console and chroot into /mnt/womb: 

```
# chroot /mnt/womb /bin/bash
```

9. Back in your 1.2 environment, copy some essential files into /mnt/womb/etc: 

```
# cp /etc/make.conf /mnt/womb/etc

# cp /etc/resolv.conf /mnt/womb/etc
```

10. If you want to make changes to /mnt/womb/etc/make.conf, do so now (for example, if you want to specify some compiler flags that were not supported by the compiler in your 1.2 installation).

11. In the womb: 

```
# env-update

# emerge sync
```

12. If you are installing from a stage 1 tarball, in the womb, run the bootstrap.  In order for it to have minimum impact on the responsiveness of your system while it is working, 

```
# nice /usr/portage/scripts/bootstrap.sh
```

13. If you are not installing from a stage 3 tarball, in the womb: 

```
# nice emerge system
```

14. Look at /var/cache/edb/world in your 1.2 system.  Chances are, there are some packages in there that you don't really want.  I emerged the packages I really wanted by hand in the womb.  If you have a large world file, or don't want to do it this way, I suspect you should be able to copy /var/cache/edb/world to /mnt/womb/var/cache/edb, edit it and then run "emerge world".  This is not recommended if you are using a stage 3 tarball.  BB had trouble with copying the world file.  See the rest of the thread for details.

15. Compare your /etc directories.  I used 

```
# diff -ru /etc /mnt/womb/etc
```

16. Copy files (such as ssh server keys) from /etc to /mnt/womb/etc, make modifications to the files in /mnt/womb/etc to make them be as you want them.

17. Set your bootloader up to boot either gentoo12 or gentoo14.  With GRUB, all that should be needed is to copy your existing gentoo12 setup and change the kernel boot parameter for the root directory from root=/dev/hda1 to root=/dev/hdb1.

18. Make your user account in the womb.  Try to give it the same UID as the one in your 1.2 system - it will make things easier.

19. If /home is not a separate partition, copy whatever part of it you want to save to the equivalent place under /mnt/womb/home.  Repeat for /usr/local or any other major directories on your root partition that you want to be able to use immediately with 1.4.

20. Set up /etc/hostname and /etc/localtime inside the womb.

21. Reboot into your 1.4 system.

22. Use rc-update to specify programs that you want to run on startup.

23. Reboot again to make sure that the boot process goes smoothly.

24. If you have forgotten something from your 1.2 root partition, you can mount it somewhere and copy things from it.

25. If you have major problems, just reboot back into 1.2 and do more research.  Your 1.2 installation should still be intact.

26. If you can afford it, save the partition that used to be your 1.2 root so that you can use it as root when you do your next major upgrade.

Comments, clarifications, questions, suggestions and feedback welcome.

EDIT: added a warning about stage 3 tarballs, thanks to Bloody Bastard for taking the time to report back on this issue.

EDIT2: caveat about copying world file especially when using stage 3 tarballs, thanks to BB again for the report.

----------

## pjp

This announcement may also be of interest.

----------

## pilla

I'm in step 14, using a stage 3 tar ball.

The method of copying /var/cache/edb/world and running emerge world didn't work. Maybe I'm missing some flag to force emerge of all packages in world.

----------

## arkane

he means to copy /var/cache/edb/world to /mnt/womb/var/cache/edb/world.

It's a file that contains everything that your non-womblike 1.2 system has in it's worldfile... because it is the worldfile  :Smile: 

----------

## pilla

Yes, exactly what I did.

 *arkane wrote:*   

> he means to copy /var/cache/edb/world to /mnt/womb/var/cache/edb/world.
> 
> It's a file that contains everything that your non-womblike 1.2 system has in it's worldfile... because it is the worldfile 

 Last edited by pilla on Wed Sep 18, 2002 5:00 pm; edited 1 time in total

----------

## arkane

what happens when you run "emerge -p world" ?

----------

## pilla

Nothing... =P

```

emerge -p world

These are the packages that I would merge, in order.

Calculating world dependencies ...done!

```

 *arkane wrote:*   

> what happens when you run "emerge -p world" ?

 

EDIT I'm chrooted there.

----------

## arkane

interesting.. well I'm in the starts of trying this myself, so I will see whats going down  :Razz: 

----------

## pilla

OK, please keep me updated.  I'm now in the process of emerging perl to then emerge XFree... XFree aborted because of lack of perl. Shouldn't it have a dependency? 

EDIT Probably because I have copied world...

 *arkane wrote:*   

> interesting.. well I'm in the starts of trying this myself, so I will see whats going down 

 

----------

## arkane

yeah it should, but I never went without perl so I donno  :Very Happy:   The dependancies for xfree-4.2.1 don't say anything bout perl in there though.

I'll keep ya posted.. I'm doing stage1 so it'll take a lil.

----------

## pilla

xfree-4.2.0-r12 depends on perl, ncurses, pam, zlib....

I'm doing it by hand. 

 *arkane wrote:*   

> yeah it should, but I never went without perl so I donno   The dependancies for xfree-4.2.1 don't say anything bout perl in there though.
> 
> I'll keep ya posted.. I'm doing stage1 so it'll take a lil.

 

----------

## rac

 *Bloody Bastard wrote:*   

> OK, please keep me updated.  I'm now in the process of emerging perl to then emerge XFree... XFree aborted because of lack of perl. Shouldn't it have a dependency? 
> 
> EDIT Probably because I have copied world...

 

Did you emerge system before the world business?  I show perl in my /etc/make.profile/packages, so I would have thought that perl should come in in the "emerge system" step.

----------

## pilla

Yes,  I think the only package added was python.

I'm running in troubles to compile X, first 4.2.0-r12 failed (looks like it didn't like my chrootd enviro  :Cool:  )  and now I'm struggling with 4.2.1

 *rac wrote:*   

> 
> 
> Did you emerge system before the world business?  I show perl in my /etc/make.profile/packages, so I would have thought that perl should come in in the "emerge system" step.

 

----------

## rac

Which stage tarball did you use?  I used a stage 1.

----------

## pilla

stage 3. 

 *rac wrote:*   

> Which stage tarball did you use?  I used a stage 1.

 

----------

## rac

 *Bloody Bastard wrote:*   

> stage 3.

 

 :Sad: 

I hope this doesn't mean that this howto is worthless for people who prefer stage3 installations.  I had no problems compiling xfree 4.2.0-r12 at all.

----------

## pilla

I'm not sure the stage 3 tarball is working very well. I've read something about problems in stage 3 for 1.4rc1.  I booted with the new installation just to compile XFree and I'll be able to tell you if it is a problem of the chrooted environment or not in a few minutes

 *rac wrote:*   

>  *Bloody Bastard wrote:*   stage 3. 
> 
> I hope this doesn't mean that this howto is worthless for people who prefer stage3 installations.  I had no problems compiling xfree 4.2.0-r12 at all.

 

----------

## pilla

XFree 4.2.0-r12 compiled when I booted in the new (1.4rc1)  partition. 

Looks like the problem was the chrooted environment... I hope I can compile other stuff using chroot and XFree was my only problem...

 *Bloody Bastard wrote:*   

> I'm not sure the stage 3 tarball is working very well. I've read something about problems in stage 3 for 1.4rc1.  I booted with the new installation just to compile XFree and I'll be able to tell you if it is a problem of the chrooted environment or not in a few minutes
> 
>  *rac wrote:*    *Bloody Bastard wrote:*   stage 3. 
> 
> I hope this doesn't mean that this howto is worthless for people who prefer stage3 installations.  I had no problems compiling xfree 4.2.0-r12 at all. 

 

----------

## arkane

Well, I'm in the middle of compiling X, and it hasn't complained at all.  I did a stage1 install.  I checked and Perl was installed before, so it probably is a stage3 issue, most definately.

I wanted to add that I run LVM (Logical Volume Management) so I had to add some extra steps in there.  I had to copy the /usr/src/linux/.config to /mnt/womb/usr/src/linux after emerging the sources, then run "make oldconfig".  Then, I compiled everything (make dep ; make clean bzImage modules modules_install).  Then, after that was over, I copied the /mnt/womb/usr/src/linux/arch/i386/boot/bzImage to /boot/bzImage-gcc3, and I ran "lvmcreate_initrd 2.4.19" in order to create my initrd-lvm-2.4.19.gz initrd file.  I then copied that file from /mnt/womb/boot/initrd-lvm-2.4.19.gz to /boot/lvm-initrd-2.4.19-gcc3.gz.  For some reason it kept mounting my default /etc/fstab stuff, even after doing that so I stuck in a kernel parameter in my /boot/grub/menu.lst that read "root=/dev/nostripevg/devellv" which is the partition I'm using for the gcc3.2 test.

It booted properly, but for some reason my sis900 module had unresolved symbols.  I'll worry about that after X compiles.

----------

## pilla

Everything else (KDE3.1, Gnome, Gnome2,....) compiled. But I had to compile XFree booting in this partition. I'm almost done with my install step 14. Just a few packages.......  :Cool: 

----------

## pilla

Thanks, rac, I could upgrade my gentoo using your manual. 

BTW, seems like grub install is making a lot of victims. I would suggest to use the old grub (from your gentoo 1.2)  if somebody is going to upgrade using this manual.

I'll report also some problems with arts and kdemultimedia (kde 3.1beta1), they have problems with -fframe-omit-pointer and gcc 3.2 (I had it compiled with 2.95 and no problems at all). I'll also request an ebuild for gcc 2.95 not to erase my gcc 3.2 (I'm afraid of installing it right now).

Everything else seems to work for me. Thank you again.

----------

## pilla

A warning about copying /var/cache/edb/world from your Gentoo 1.2 to your Gentoo 1.4, in a stage 3 tarball install. Don't to this, because looks like portage looses its capacity of detecting dependencies for packages in it....

For example, I was trying to install crafty, which depends on icc. I had some problems, it looked like installed (damn, a ebuild bug....) but I couldn't find the installed files. Then, I realized icc wasn't installed and therefore it didn't compiled correctly.

----------

