Gentoo-isms #3 – Updating Gentoo

If updating on the commandline, Gentoo uses the very powerful emerge command of (the python based) Portage, the Gentoo package manager. (See Wikipedia – Portage for a good brief summary.)

However, with that great power and with Gentoo comes lots of options… There are also additional utilities and steps needed to keep your Gentoo system updated and clean of hubris…

Keeping Gentoo updated can be broken down into the steps:

  • Update (resync) the repositories databases and caches;
  • Check if anything needs updating;
  • Run the updates compiles and update any updated or new configs;
  • Update for any affected reverse dependencies;
  • Update for any package dependent updaters;
  • Clean up any out-of-date or no longer used hubris.

All easy enough but the detail is easily forgotten and all that lot is mindlessly very repetitive. But also, the updates are something that should be checked and watched if you are running any sort of critical or customized system. Or why else are you running a sleek Gentoo system?

(Aside: Note that there are some very good Gentoo derivative distros that give you the configurable greatness of Gentoo but without the tedium of the fine detail of the updates. Well worth a look if you want something that works with a single click!)

Hence, here are a few of my ‘short-cuts’ to break the updates tedium into memorable manageable easily typed chunks. All the more easily typed with the power of bash command completion.

Special note: The below aliases give the gist for my example. There are other ways to do this. This is Gentoo after all!

Special note #2: I use layman, eix, python and perl. You will need to adjust those according to your usage. For example, just

alias emsync='emerge --sync'

will be enough for most users to resync with the distro repositories.

To run through for an update, my sequence of aliases are:

BACKUP FIRST and check your backup has worked!

To resync the repositories and update the eix index:

alias emsync='layman -S && emerge --sync && eix-update' 

To see what an update will do (“-p” option) and then to actually do an update:

alias empvduw='emerge -vDNup world'
alias emvduw='. /etc/portage/make.conf && ( date -R ; nice emerge -vDNu world ; date -R ) 2>&1 | tee /var/tmp/emerge_world.log' 

Note: Keeping a timestamped log of what happens is always a good idea.

Once an update has completed and whatever configs have been updated (if necessary), then to run a reverse dependencies update and to run the package specific updaters:

alias emrevdep='. /etc/portage/make.conf && ( date -R ; nice revdep-rebuild && echo -e "\n\n" && python-updater && echo -e "\n\n" && perl-cleaner --all && echo -e "\n\n" && eclean-dist --destructive ; date -R ) 2>&1 | tee /var/tmp/revdep_python_perl.log'

Then finally, to check what can be cleaned up and then if ok, to run a cleanup:

alias empdclean='emerge --depclean -p'
alias emdclean='emerge --depclean'

As with all examples of ‘great power’ and ‘Gentoo’, use with care and with your own understanding!

Comments welcomed for any other hints/tips for keeping Gentoo updated and clean.

Enjoy!

Martin

Leave a Reply