Celebrazio Net

Contact Us

Timely Maintenance of your Gentoo Linux Computer

Gentoo provides a lot of great help and documentation online. This is an attempt to add to that and help keep a little sanity here as I go through a maintenance period every few months. I don't do regular maintenance on the system, with emerge sync and emerge world all the time. I prefer to upgrade once and be done with it -- until I make time to do the next one. This time, I went 12 months between system tune-ups. This procedure was successful in two separate Gentoo systems (home and work), both simultaneous tune-ups after 12 months.

Objectives of the maintenance

  • Review USE flags and CFLAGS, other emerge settings.
  • Upgrade kernel
  • Upgrade to modular X
  • Upgrade to GCC 4.1
  • Add cool tools: KDE Basket, Eclipse SDK, etc.
  • Remove obsolete, redundant crufty packages.
  • Do the Java Upgrade, shown here: Gentoo Java Upgrade
  • Emerge everything with the new toolchain, kernel, and USE config.
  • Fine-tune the maintenance procedure a little. Old maint. procedure can be viewed here: Celebrazio Gentoo Maintenance 2005

Local References:


First, upgrading only once in a while, as opposed to a more frequent basis, requires that we re-think the settings and configurations in use.

 root@system% cat /etc/make.conf
 root@system% cat /etc/portage/package.mask
 root@system% cat /etc/portage/package.keywords
 root@system% emerge -pv world 
 root@system% emerge --info 
 root@system% equery --help
 root@system% equery u packagename
        # gives USE flags of that packagename
 root@system% qlist -I xf86
        # very good tool for listing packages. 
 root@system% less /usr/portage/profiles/use.desc

The first 3 lines here are to read and check over the masked packages or any other special keywords settings. If these were set up for a reason a few months ago, maybe that reason has since disappeared. Check out the Gentoo Portage handy site to learn whether a package at the version level you want is stable (x86) or not (~x86) now. This site also has an excellent USE flags reference. And check dependencies and reverse dependencies if you want. Equery is also useful to learn about the packages. Emerging with --info gives the USE settings, among other things. Don't Overlook Gentoo's own Package Repository either.

In the "emerge -pv world" line above, we are mainly trying to check whether there are any blocking issues. If you get blocking issues now, then you'll need to resolve them before trying to emerge world. Search the forums for your specific blocking issue. There are various possibilities for fixing the issue: sometimes just unmerge something you don't want, other times use a package.mask or package.keywords
Package.mask might look like this:


It is a good time now, before any time has been spent, to verify that USE settings are as wanted. If you are upgrading PHP or Apache, maybe the USE settings have changed. Here is one way to keep your USE values tidy after modification: quickly re-organize them alphabetically, then just paste back to the file /etc/make.conf. If you do this script, leave whitespace around the quote marks that surround all the flags.

root@system% cat /etc/make.conf | grep "USE=" | grep -v "^#" | awk '{ for (
i = (NF -1); i >= 2; i-- )  print $i}' | sort | xargs echo

According to Gentoo (the weekly newsletter), most tampering with FLAGS are not beneficial:

Warning: Using anything beyond -O2 -fomit-frame-pointer -march/-mcpu/-mtune in CFLAGS or CXXFLAGS (and -mieee, -mabi etc. on selected archs that tell you to do this), and using anything at all in LDFLAGS or ASFLAGS, is usually not worth the trouble for most users. There's usually very little benefit, if any, high risks, and large amounts of time spent on frustrating tuning that could be enjoyed doing far more interesting things.

All of which is good enough for me. I move on with these Flags to the next steps. During this maintenance I found that the [qt] USE Flag was obsolete, and I needed to add the [qt3] Flag (and / or qt4).

Profile Upgrade 2005.1 to 2006.1

First Reference: Gentoo Documentation, Upgrading
According to this guide, it's pretty easy to change profiles (at the time of writing, it was being changed from 2005.1 to 2006.1). So it can be done like this, first changing the symbolic link:

 root@system% rm /etc/make.profile
 root@system% ln -s ../usr/portage/profiles/default-linux/x86/2006.1  /etc/make.profile
[follow the guide and change the values in the 2nd line to fit your gentoo]
[next it is a good time to] 
 root@system% emerge --sync

There is no 'emerge sync' again until the very end, so try to do this step at the beginning of your maintenance window. Try to do this sync as close to the following build steps as possible -- to ensure freshness. Next, check on any blocking issues that you found above. If you still have any blocking issues at 'emerge -uvDNp system', they will need to be cleared now.

 root@system% emerge -Ca xorg-x11 virtual/x11

As part of my simultaneous modular X upgrade, I needed to unmerge xorg at this point. I will later re-emerge it after the toolchain build is complete.

Toolchain Build

It is best to refer to the official Gentoo GCC Upgrade Guide for these next steps, if you are upgrading major GCC version.

It is good to write all the names to a file, in the order in which they will be emerged. It sometimes happens that your emerge command does not complete through the entire list. It may get snagged on a single package. Normally, you would have to re-issue the whole "emerge system" command -- all the packages. But this way, you won't need to repeat from the start. Just edit your input list and continue where the "emerge" command left off. Here, I captured the package list from 'emerge -puvDN system' and formatted it into this format [=dev-libs/openssl-1.2], one per line. Then, it can be passed in to emerge, so the command is:

 root@system% emerge -uvDNp system > /my/inputfilename.txt
 root@system% cat /my/inputfilename.txt | perl -nle '$_ =~ s/^\[ebuild........\] /=/; print ;' >
 root@system% cat /my/inputfilename2.txt | awk '{ print $1 }' > /my/inputfilename3.txt
 root@system% emerge -uvDNp `cat /my/inputfilename3.txt`
 root@system% emerge -uvDN  `cat /my/inputfilename3.txt`

This is the equivalent of 'emerge -uvDN system' but simplified a bit (for dummies?) In my case, after this point, I realized I needed to upgrade Java. I also did "etc-update" as prompted, and did "python-updater" since python was changed. This also meant emerging several more packages to catch the python changes (python-updater took care of these emerges). I threw an "env-update" in there too. And since I changed GCC version, there was a config for that too. And one for perl. I also did a reboot in there (not shown) to make sure the system came up with the proper environment in place.

 root@system% /usr/bin/java-check-environment
 root@system% java-config-1 --set-system-vm 1
 root@system% etc-update
 root@system% gcc-config --list-profiles
 root@system% gcc-config <desired number>
 root@system% gcc-config --get-current-profile
 root@system% python-updater
 root@system% perl-cleaner
 root@system% env-update 

Again, the gentoo-portage.com reference is handy in determining whether I want it, or whether there are any reverse dependencies. Equery is good here too. Next I create a new input file. In this maintenance, I am updating my gcc, glibc and other toolchain items, so I want to emerge the entire system with the new toolchain now. (world will come later). Read and take notes of all the emerge warnings and messages - there will be a long list - copy it down now before it's gone.

 root@system% emerge -evp system > /my/inputfilename.txt
 root@system% cat /my/inputfilename.txt | perl -nle '$_ =~ s/^\[ebuild........\] /=/; print ;' >
 root@system% cat /my/inputfilename2.txt | awk '{ print $1 }' > /my/inputfilename3.txt
 root@system% emerge -eav `cat /my/inputfilename3.txt`
 root@system% [say Yes]
 root@system% tail -500 /var/log/emerge.log 
  [ you might need this to view progress if the emerge has broken down
    without completing]
 root@system% revdep-rebuild -p

Modular X Instructions

Followed the Gentoo Documentation for upgrading to modular X: currently available at http://www.gentoo.org/proj/en/desktop/x/x11/modular-x-howto.xml

Preparation and World

If anything is blocking your world build, you can unmerge it now. For that matter, if anything is just crufty, not needed, or obstinate, you can nuke it now. Check reverse dependencies first though.

 root@system% emerge -uvDNp world
 root@system% equery depends obsoletepkg
 root@system% emerge --unmerge obsoletepkg
 root@system% emerge --unmerge stupidpkg
 root@system% emerge -uvDNp world > /my/inputfilename.txt
 root@system% cat /my/inputfilename.txt | perl -nle '$_ =~ s/^\[ebuild........\] /=/; print ;' >
 root@system% cat /my/inputfilename2.txt | awk '{ print $1 }' > /my/inputfilename3.txt
 root@system% emerge -uvDNp `cat /my/inputfilename3.txt`
 root@system% emerge -uvDN  `cat /my/inputfilename3.txt`
  [ updates my world ]
 root@system% emerge -p --depclean

After this completes, it is a successful update of the world. But not a complete tune-up yet. Need to keep the depclean step until last. Always pretend this, it's not safe to let it run.

 root@system% revdep-rebuild -p
 root@system% revdep-rebuild

You may run into issues with a package or 2 here or there. Don't lose heart. Usually an emerge of one thing or another cures it all. After researching on gentoo-forums, it's common to find a workaround. This was a success.

I manually pick through the depclean list, and get rid of stuff. My success rate was about 50%: about half the stuff depclean wanted to toss, I was worried so I just left it in. 50% I manually unmerged. In this case, I had a list of about 16 items and got rid of 8.

Rebuilding the Kernel

After this revdep-rebuild, it was time for me to rebuild kernel. I needed a couple references:

I also had to make sure I had the correct value in /etc/localtime
and basically followed these guides. Things to remember: copy over your .config file to the new kernel build directory; run 'make oldconfig'; recommended run 'make menuconfig' just to eyeball it; and edit the grub.conf file. Read the kernel help info by typing a question mark at 'make menuconfig'. I think these instructions are a little later in the Handbook. Remember the grub.conf file. Also follow the instructions to load grub into the MBR. My kernel rebuild failed for a simple reason: I forgot to rebuild NVidia drivers. Just follow directions on the NVidia Guide -- it needs to be done with every new kernel. The iron law of NVidia. There was a "modprobe nvidia" in there too.

 root@system% cp -ip /usr/src/linux-2.6.14-gentoo-r4/.config /usr/src/linux/
  [copies my previous .config ] 
 root@system% make oldconfig
 root@system% make menuconfig
  [maybe some things to confirm, tidy up]
 root@system% make && make modules_install
  [ just following the documentation ]
 root@system% mount /dev/sda1 /boot
 root@system% vim /boot/grub/grub.conf
 root@system% shutdown -r now
  [ the reboot -- let's see if it's sea-worthy ]
 root@system% emerge -eav  `cat /my/inputfilename3.txt`
  [gives me the new world]
 root@system% revdep-rebuild -p
 root@system% revdep-rebuild
  [ you might need to take care of some things before you can rebuild ]

Also, KDE upgrade to 3.5.5 did not go smoothly. I needed just one little thing: to upgrade my ~/.xinitrc so startx would manage the startkde command properly. This is for those who prefer to issue the "startx" command manually.

After this, came the fun stuff of new emerges: eclipse SDK, Basket, and other new tools and games I thought of.


I realized I was going to lose the csh program -- no longer supported. Oh well, unmerge that early. When all is done, I need to bring in a replacement to run those csh scripts:

 root@system% emerge -av tcsh
   [ gives me an improved C shell, which symlinks to /bin/csh
     for the sanity of my existing scripts.   ] 

I found a lot of old kernels, grub entries, and gentoo sources directories that won't be used any more. Better clean those up:

 root@system% rm -i /boot/kernel-2.4.24-pre6-gentoo
 root@system% emerge -av --unmerge gentoo-sources-2.4.24
 root@system% vim /boot/grub/grub.conf
 root@system% rm -rf /usr/src/linux-2.4.24_pre6-gentoo
   [ get rid of old kernel entry, kernel file and directory.   ] 

A wrong entry in make.conf for Rsync Excludes. Get rid of RSYNC_EXCLUDEFROM, move to PORTAGE_RSYNC_EXTRA_OPS

And when all the above is confirmed, and the system seems stable, I do:

 root@system% emerge --sync

Tune-up complete!

SysInfo: Linux 2.6.18-gentoo-r2 | Intel(R) Pentium(R) 4 CPU 2.20GHz 2193.191 MHz
Mem: 242 used / 248 total / 6 Free  [|||||||||*]

1998-2017 Celebrazio.net