Upgrading Gentoo 2007.0 to 10.0

So I left all these servers running gentoo a couple years ago. Now, after all this time (and uptime!), I want to install something.

Error:

emerge -av portage

These are the packages that would be merged, in order:

Calculating dependencies |
!!! All ebuilds that could satisfy ">=dev-lang/python-2.5" have been masked.
!!! One of the following masked packages is required to complete your request:
- dev-lang/python-2.5.4-r3 (masked by: required EAPI -1, supported EAPI 0)
- dev-lang/python-2.6.2-r1 (masked by: required EAPI -2, supported EAPI 0)
- dev-lang/python-2.6.2-r2 (masked by: required EAPI -2, supported EAPI 0)
- dev-lang/python-2.6.4 (masked by: required EAPI -2, supported EAPI 0)
- dev-lang/python-3.1.1-r1 (masked by: required EAPI -2, supported EAPI 0)
- dev-lang/python-2.6.3 (masked by: required EAPI -2, supported EAPI 0)

For more information, see MASKED PACKAGES section in the emerge man page or 
refer to the Gentoo Handbook.
(dependency required by "sys-apps/portage-2.1.6.13" [ebuild])

Hm. Yeah, I’m way out of date.

Solution: I found other sites that talked about forcing a python/portage install but I that sounded a little harsh. Instead, I found a snapshot of portage-2008.0 and replaced my /usr/portage with the contents of that.

 cd /usr
 rm -rf portage # or mv portage xxx
 wget http://gentoo.mirrors.tds.net/gentoo/releases/snapshots/2008.0/portage-2008.0.tar.bz2
 tar -xjpf portage-2008.0.tar.bz2
 cd /etc/
 rm make.profile
 ln -s /usr/portage/profiles/default/linux/x86/2008.0 make.profile
 emerge -av portage

That took me to portage-2.1.4.4.

From there, I can now go back to current 10.0 portage and emerge -av portage to get up to the current portage state.

Yeah, I really didn’t want to do a re-install.

Using Multiple Python Environments With Gentoo

It’s been some time since Python 2.5 became stable and released. Version 2.5 has plenty of new features that have helped me in deciding that it was time to go ahead and start using it for primary development of all my new projects. One of the reasons I was still using version 2.4 is that Gentoo hadn’t upgraded 2.5 to the stable package system.

I decided to go ahead and unmask version 2.5 anyway. Installing Python 2.5 isn’t very complicated and I’ll leave the details out. I’ll just mention that after unmasking Python with the ~x86 keyword and installing the package, you’ll need to run the python-updater. Python-updater had it’s own problems with not being able to find some packages it thought needed to be re-emerged but I found pretty much all of those were unneeded old dependencies and I simply un-emerged them.

When you update Python, you can still get to your old version of Python by tacking on the version number to the python command, e.g., /usr/bin/python2.4. Since the Python updater uses emerge to install your python dependencies in the site-packages of your Python installation and emerge unmerges the old versions, your old Python probably doesn’t have all the site-packages any longer. This is only an issue if you find you need the old Python.

For me, I have a couple applications that didn’t quite want to work with Python 2.5 for some reason. I decided to use VirtualEnv to work on those applications.

The Steps

  1. To install virtualenv, you need setuptools. That package was one of the packages transfered to the 2.5 site-packages install and was no longer available with python2.4.

    To get around the issue, use ez_setup.py to install a 2.4 version of setuptools instead of using emerge.
    cd <working dir>
    wget http://peak.telecommunity.com/dist/ez_setup.py
    /usr/bin/python2.4 ez_setup.py setuptools

  2. I simply used the virtualenv command that came with python2.5 but changed the interpreter to by python2.4 instead of python.

    cp /usr/bin/virtualenv .
    # edit virtualenv to have the correct interpreter line
    vim < or whatever editor > virtualenv
    ------ snip local virtualenv ------
    +#!/usr/bin/python2.4
    -#!/usr/bin/python
    ------ snip ----------------------
    ./virtualenv --no-site-packages <virtual env install dir>
    cd <virtual env install dir>/bin/
    ln -s python2.4 python
    cd <working dir>

  3. Use the old python in it’s virtual environment:

    source <virtual env install dir>/bin/activate
    python
    Python 2.4.4 (#1, Mar 5 2008, 10:47:15)
    [GCC 4.1.2 (Gentoo 4.1.2)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>>

Anyway, that’s it. You can have a virtual environment that uses any version of Python you like on your system. I imagine this procedure would be somewhat similar on pretty much any Linux Distribution.

Gentoo with an Intel DQ35MP Motherboard

I’m slightly sad to see my old radeon 9600 card with Compiz being obsoleted. My motherboard in that machine shorted out somewhere and I was left with a bricked machine. Since the product was essentially about 5 years old, I decided to go ahead and buy new equipment. I’m now the proud owner of an Intel Core 2 Duo E6750 with an Intel DQ35MP Motherboard. I copied my old hard drive data to a new drive and am back up and running without a lot of headaches.

What better opportunity to explain how to get Gentoo working on this hardware. Continue reading “Gentoo with an Intel DQ35MP Motherboard”

Keeping a process running

Have you ever had a process that dies on occasion? For me, I hate that situation and prefer to fix the software as opposed to have a monitor that restarts the process when it dies. I’ve run into a case lately however, that has defied me for a solution to my dying process. I think it may be a hardware related issue but haven’t tracked down the cause yet. Anyhow, I read an email on the Provo Linux User Group in which the poster referred to PS-Watcher. I thought I’d give it a try for kicks.

After installing the program and reading through the documentation, I found that PS-Watcher is really quite nice. In addition to monitoring the results of the ps command, you can add custom actions that occur at the beginning or ending of the monitor cycle ($PROLOG and $EPILOG). You can also customize actions to be taken based on the number of processes, memory size, and a few other useful metrics.

For most situations where you want to monitor a process and take action, I think PS-Watcher will probably do the job nicely. After all this however, I decided what I really wanted was a little script that did a custom restart of my particular web server when the test URL wasn’t functioning properly. I decided to simply run it on a scheduled interval with cron. I’ve placed the script below for all to glean information from or make fun of as appropriate. Feel free to provide some additional tips as I don’t claim to be a “Bash Jedi Master”. The following script sends a request to the web server and parses the response for a string that lets us know the server is working properly.

#!/bin/bash

user="<the user my process is running under>"
port="<the port>"
okresp="^OK$" # I configured a test URL that returns OK if the server is up and running right.

# make a simple HTTP request to send
req="GET /lbuptest HTPP/1.0

"
# send it using netcat
resp=$(echo "$req" | nc localhost $port)
# test for the ok string
ok=0
echo "$resp" | grep $okresp 2>&1 >> /dev/null && ok="1"

# you could really place whatever actions you want here.
if [[ $ok != "1" ]]; then
/etc/init.d/<my process init script> restart
fi

The process I’m having trouble with is a TurboGears web application. I don’t think this is a Python problem however. Like I mentioned before, it only happens on this one server so I think I’ve got a hardware problem. Either way, if you found this page searching for TurboGears information, you might as well be interested in my TurboGears Init Scripts.

Gentoo and the Next ATI Drivers (Catalyist 7.11)

As of a couple days ago, ATI released their next drivers for Linux. The drivers were previously announced to be versioned 8.43.x but ATI has converted to a new numbering system that follows the popular YEAR.MONTH notation. The 7.11 drivers therefore accurately represent their release date in November, 2007 and are what would have been 8.43.x.

Anyway, there isn’t a Gentoo ebuild for these drivers and there may never be one. When I checked, there wasn’t even a bug filed to have one created. The 8.42.3 drivers eventually made it into portage as a masked package (~x86) with the consensus that they will never be marked stable. The 7.11 drivers will probably not even make it that far since the list of changes is rather minimal and nobody has posted any benefit to upgrading to them. You can read the Gentoo forum on the subject for more details if you like.

Anyway, it looks like we’ll be waiting for 8.1, or whatever the next release date happens to be, to find out if we finally get a faster AIGLX implementation for X.org.

Update: Well, I guess I called that one wrong. This morning my portage update contained an ebuild for ati-driver 8.433, which is the 7.11 driver I talked about in the article. I still don’t think there is much benefit to upgrading though.

Installing PgAdmin3 1.8.0 with Gentoo Linux

Today, my quest for the latest and greatest software has led me to a new release of PgAdmin3. The Gentoo ebuilds for the project are terribly out of date. Before setting out to install the new version of this software, I decided I better figure out why it hasn’t been added to the official Gentoo portage tree.

The new version of PgAdmin requires wxGTK-2.8.*. There is a request for enhancement open already. The reason it hasn’t been closed is that there were a lot of packages that depended on anything greater that wxGTK-2.6 when they were added to portage. Those had to be fixed before a new wxGTK could be added because the newer wxGTK is not compatible. There is also a request for a newer PgAdmin that is marked that it will be resolved later.

Now, moving on to overcoming all this and getting the software right now. Continue reading “Installing PgAdmin3 1.8.0 with Gentoo Linux”