New Distro #73
OK, so I've started to play with Ubuntu. Kick-ass distribution. Installed without a hitch on a server, a desktop machine, 4 Sony laptops and one Dell laptop. And by 'installed' I mean: got the screen resolution, sound, and network cards right, first try, no human intervention. Two different kinds of wireless network cards in that group, and the server's network card is a funky dual Intel one that no other distribution has picked up yet out of the box. Knoppix couldn't even do that.There's one small problem, and it is small (smaller than I thought it was, even): not all Debian packages are available out of the box. They only support a subset (a large subset) of Debian's recent vintage packages.
I needed winbind, first thing, and that package is not in Ubuntu. So I did what I have been told time and again never to do: I added the Debian sid archive to /etc/apt/sources.list and fired up Synaptic to install the winbind package. This went off without a hitch, but on my next upgrade I ended up upgrading hundreds of packages to sid, since sid is now slightly more recent than Ubuntu for very uninteresting reasons.
Oops
This messed up Ubuntu's nice desktop layout. Realizing I didn't want to keep it that way, I then removed the sid repositories from sources.list and then downgraded to the Ubuntu versions of a few of the desktop packages using an old apt trick:$ sudo apt-get install gnome-system-tools=1.0.0-0ubuntu7
This was fine, got my desktop back to pretty again. I knew I still had loads of "foreign" packages installed on my system, but I resolved not to think about it too hard.
But pretty soon I needed another package. This one happened to be python-dev. The Python package structure in Debian (and therefore Ubuntu) is a rat's nest of weird, exact-version dependencies. If you try to mix repositories on Python, you will end up reinstalling hundreds of packages, even using the trick above. Wait, that's an exaggeration: in my case, the number was actually 76 packages that had to be reinstalled because I • already had Debian's sid version of Python installed and • needed to install one from Ubuntu. In order to use the apt trick above to fix this problem, I would have had to look up the most recent Ubuntu version of all 76 of those packages (using apt-cache showpkg) and then type each one on the command line. If I'm smart, maybe I could write a little Python code to help me build the list, but it would still be a monstrous pain in the ass.
I have torn my hair out on this issue many times before, when I did things like install Debian sarge and then install everything from backports.org, or try to add one sid package to a woody system and end up installing hundreds of unwanted packages. My conclusion has always been: you can't go back. You're stuck with your mixed repositories, and you'll end up upgrading everything under the sun. Hope everything keeps working right! :-)
You Can Go Home Again
Turns out that's not true. The solution turns out to be quite simple. There's a file called apt_preferences by the man page. It's in /etc/apt/preferences. It controls where you get packages from, and under what conditions, when you have multiple sources in sources.list. It makes filters by combining groups of three facts:- What packages the filter applies to, with "Package:"
- Where those packages come from, with "Pin:"
- How high a priority you want to set for the filtered packages, with "Pin-Priority:"
Package: *
Pin: release a=warty
Pin-Priority: 1001
Once you've made this setting, just do an apt-get upgrade. I don't promise it'll be smooth as glass; packages aren't tested for downgrading, let alone downgrading across distributions. At worst you will have to run it a few times, and possibly manually select a few packages to remove completely to prevent conflicts, but it does work. I just used it to downgrade 466 packages from sid to warty. :-)
So then they tell me about the universe repository, which is where I should have found winbind. . .
By the Way
Don't forget to change your apt_preferences back to the way it comes out of to the box (missing). Just delete it when you're done. Otherwise, you won't get security updates, because warty/security doesn't match the Pin you specified in apt_preferences. Once you've gotten rid of the preferences file, do another apt-get upgrade and you'll re-get the most recent security updates.Update
In addition to universe, I recently learned how to enable the multiverse repository and I feel it deserves a mention because useful things like browser plugins live there. Add this to your sources.list:
deb http://archive.ubuntu.com/ubuntu/ warty multiverse
1 comment:
Hi,
I just wanted to say thanks. This hint helped me a lot.
Just to make something a little more clear, the file is called preferences and it's put in /etc/apt. I originally created an apt_preferences file in /etc/apt :) When I did I had an error E: read error about trying to read from a directory rather than a file.
Post a Comment