Installing Java on Ubuntu — meant to be easy, right?

Август 22nd, 2012 | Posted by elenst in Pensieve - (Комментарии отключены)

Actually, I was installing Cassandra. But this is another story, I’m afraid will be coming soon.

So, Cassandra wants Java, specifically
Depends: openjdk-6-jre-headless (>= 6b11) but it is not going to be installed

JDK wants tzdata-java, no specifics:
Depends: tzdata-java but it is not going to be installed

tzdata-java wants tzdata, but…
Depends: tzdata (= 2011k-1) but 2012b-0ubuntu0.11.10 is to be installed

Fun, isn’t it? It’s not like I’m trying to pull Java from some obscure repository.

Some digging revealed that 2011K-1 lives on Ubuntu Main repository, while 2012b (or even 2012e) on Ubuntu Proposed Main repository. There wasn’t the Proposed Main repository on my source list… I wonder where it was pulling it from. (Maybe it was from the Cassandra repo? I didn’t think about it back then.) Anyway, even although my source list is nearly pristine, I prefer to think that it was a problem with my configuration, rather than suspect that the Ubuntu main repository offers conflicting packages.

And ‘anyway’ again, since we’re already playing with 2012e, I’d rather they give me both of that.
So, I added the Proposed Main repository. No luck, still the same incompatibility. I tried to remove the Main repository. No luck again. Well, there are many default Ubuntu repositories in the sources.list, I didn’t feel like playing with them all, especially since apt-get update is annoyingly slow. So, I replaced /etc/apt/sources.list with a dummy one which contained only the Proposed Main repository:
deb http://archive.ubuntu.com/ubuntu/ oneiric-proposed main

And voila!

Stupid workaround, but fast if you know what you want, but don’t know exactly what you’re doing.

I even remembered to restore the initial sources.list afterwards, but of course I forgot to ‘apt-get update’ it, and spent a couple of fancy minutes trying to figure out why now Cassandra refuses to install, pretending it had never been there…