upgrading a gentoo box that hasn’t been upgraded since 2007

I was given root today in a gentoo box that nobody had upgraded since 2007. As expected the “emerge –sync; emerge -uDavt world” showed a lot of blockages.

I tried to solve each one but I got stuck while trying to upgrade portage to In order to upgrade portage I had to upgrade sandbox, but sandbox couldn’t be ugraded correctly due to portage being unable to handle .tar.lzma files.
The box had sandbox-1.2 installed and it was unable to upgrade to sandbox-1.6. The error was:

unpack sandbox-1.6.tar.lzma: file format not recognized. Ignoring.

Upgrading lzma-utils, tar and a few other packages did not work. In the end I edited the sandbox-1.6-r2.ebuild and changed the src_unpack function from:
src_unpack() {
unpack ${A}
cd "${S}"
epatch "${FILESDIR}"/${P}-disable-qa-static.patch
epatch "${FILESDIR}"/${P}-disable-pthread.patch
epatch "${FILESDIR}"/0001-libsandbox-handle-more-at-functions.patch

src_unpack() {
unpack ${A}
cd /var/tmp/portage/sys-apps/sandbox-1.6-r2/
tar --lzma -xvf sandbox-1.6.tar.lzma
mv sandbox-1.6/ work/
cd "${S}"
epatch "${FILESDIR}"/${P}-disable-qa-static.patch
epatch "${FILESDIR}"/${P}-disable-pthread.patch
epatch "${FILESDIR}"/0001-libsandbox-handle-more-at-functions.patch

cd /usr/portage/sys-apps/sandbox/; ebuild sandbox-1.6-r2.ebuild manifest

After this edit, sandbox emerged properly, so portage emerged properly too. Everything else worked as expected…

HOWTO remotely install debian over gentoo without physical access

The Task
Last year, me and comzeradd set up a Gentoo server for HELLUG according to our plot to help Gentoo conquer the world. Unfortunately Gentoo is out of HELLUG’s administration policy, all servers must be Debian. We didn’t know that, so after a small flame :), we decided that we should take back the server to somebody’s home and re-install Debian over it, the problem was that the server was located at University of Athens campus which is a bit far from downtown Athens where comzeradd lives. I also live 500km away so we were pretty much stuck. Months passed and nobody actually had enough free time to go to UOA‘s campus and take the server to their house. …In the meantime manji joined us as an extra root for the server.

One Saturday night while chatting at IRC (what else could we be doing on saturday night ??) we had an inspiration, why not install Debian remotely, without taking the server home. Even if everything got eventually borked it couldn’t get any worse than going there, taking the server home and fixing it, just like we would do any way. So we gathered on a new IRC channel with some more friends that are really good with Debian and started the conversion progress.

The Server
The interesting part about the server was that it had 2x250Gb IDE disks. The Gentoo setup had these disks partitioned to 4 software raid devices + swap partitions.

commandlinefu.com random entry parser

I’ve written a small perl script to parse random entries from the extremely usefull commandlinefu.com website. Quoting from their site:

Command-Line-Fu is the place to record those command-line gems that you return to again and again.

The script code is very “clean”. I can almost say that it’s written in a very python-ish way.
Sample output:%./cfu.pl
CMD: for (( i = 0; i < 100; i++ )); do echo "$i"; done
URL=http://www.commandlinefu.com/commands/view/735/perform-a-c-style-loop-in-bash. Title=Perform a C-style loop in Bash.
Description: Print 0 through 99, each on a separate line.
CMD: rsync -av -e ssh user@host:/path/to/file.txt .
URL=http://www.commandlinefu.com/commands/view/20/synchronise-a-file-from-a-remote-server Title=Synchronise a file from a remote server
Description: You will be prompted for a password unless you have your public keys set-up.

You can get it from here: commandlinefu.com random entry parser perl script

As far as I’ve tested, it works out of the box on default perl installations of Debian, Gentoo and Mac OS X.

Severely degraded harddisk performance on sata_sil by athcool

I am writing this post to provide some statistics on athcool + sata_sil usage. The results are horrible.

Athcool is a small utility, enabling/disabling Powersaving mode for AMD Athlon/Duron processors.
The homepage of the utility has a big fat warning as well:

WARNING: Depending on your motherboard and/or hardware components, enabling powersaving mode may cause:

* noisy or distorted sound playback
* a slowdown in harddisk performance
* system locks or instability

The Gentoo ebuild also has these warnings:

ewarn “WARNING: Depending on your motherboard and/or hardware components,”
ewarn “enabling powersaving mode may cause:”
ewarn ” * noisy or distorted sound playback”
ewarn ” * a slowdown in harddisk performance”
ewarn ” * system locks or unpredictable behavior”
ewarn ” * file system corruption”
ewarn “If you met those problems, you should not use athcool. Please use”
ewarn “athcool AT YOUR OWN RISK!”

Ignoring all these warning I was using athcool for years on my old desktop box filled with 2 IDE disks. Never had any real problem at all, except for a some performance loss. The problem appeared when I first used a sata disk on motherboard’s, Gigabyte GA-7VAXP-A Ulta, sata controller which uses the sata_sil module.