Gentoo Linux: Keeping the system up-to-date

I’m a Linux nut.  Gentoo is my flavor of choice for the high level of configurability ( if that’s not a word, I just made it one. 😀 ).   I also love automation, that’s why my .bashrc file has a good amount of aliases and a full bin directory that does just about everything I need.  When it comes to keeping Gentoo up to date, I have an “update” alias that is as follows:

update alias:

$ alias update="sudo layman -S && sudo eix-sync && remerge"
  • First thing first: you may ask… sudo? This allows me to run this command as any user who’s allowed to gain root privs. From there, any following commands are able to sudo without a password.
  • The && allows me to queue commands but halt the whole sequence with a C or upon failure of one of the commands ( where a ; will just move on to the next command ).
  • First thing I do is layman -S. If you don’t have any overlays and/or don’t know what layman is, remove that.
  • After syncing layman, we do an eix-sync which gives you a nice diff at the end of the sync. You’ll need to emerge eix if you haven’t already.
  • Last but definitely not least… is remerge… What’s this you say? well.. it’s an alias that actually goes before the update alias. It’s a command that I can run at any time knowing it won’t sync, so I don’t have to worry “will I get banned from the portage server I’m syncing from because I’m syncing too often???”

remerge alias (belongs before the update alias b/c it’s used in update.):

$ alias remerge="sudo emerge --update --newuse --deep --with-bdeps=y --tree @world && sudo eix-update && sudo dispatch-conf && sudo emerge --depclean && sudo eclean distfiles && sudo revdep-rebuild"

So there you have it. In your .bashrc, put the remerge alias on one line, then update on the line that follows. This will practically do a full system update.

One thing to watch out for is kernel updates. When you get those, emerge –depclean will trigger a removal of the old kernel. When I see that, I open a new tab and run the following:

$ su
$ cd /usr/src/linux/
$ make oldconfig
$ makekernel

makekernel alias:

$ alias makekernel="sudo make -j5 && sudo make modules_install && sudo make install && sudo cp arch/x86_64/boot/bzImage /boot/kernel && sudo module-rebuild rebuild"

That builds the the kernel and places the new bzImage where I have my grub confguration expecting it. I know some people modify the /boot/grub/grub.conf file and have version numbers and what not but I get enough kernel updates that doing so is a pain. In my configs, grub is simply expecting /boot/kernel.

Lastly, the module-rebuild rebuild comes in very handy with Virtualbox, as after a kernel update, virtualbox-guest-additions usually wants to be recompiled.

One thought on “Gentoo Linux: Keeping the system up-to-date

  1. Hi Beshoy,
    Isn’t copying bzImage not necessary when you have already doing ‘make install’? That copies a vmlinuz, config and Systemmap file to /boot and grub can use it. Also, there is no ‘make’ (the one which compiles bzImage and modules). Is ‘make -j5’ same as ‘make’ with MAKEOPTS=”-j5″?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.