Debian is one of those things that are so meticulously prepared that sometimes it gets boring. When you install it (from cd, usb stick or even windows) takes you through several well thought steps where few things can go wrong (your entire hard disk can be erased, but that's just your own fault) and when its over, it just works. Need anything? Just run apt-cache search rss reader to get a rough description of all matched applications. Something looks interesting? Run apt-cache show akregator to see the description or directly apt-get install akregator to install it. I cannot stand it. I envy users of those operating systems that allow them to spend time defragmenting disks, hunting viruses, installing security updates, restarting the computer to the extent that I think of paying money for those moments of pure enjoyment. And what do I get from Debian? A boring system that works.
Apt pinning
It's very hard not to try to mess something up to make your day brighter, to wipe that plain look from your face, to put back that evil grin. I usually keep only the stable version cd just to be sure, you can never trust anything else but stable. That's why the first thing after installing a fresh debian I switch to testing/unstable/experimental version. It's a lot of fun! Besides this, enable contrib and non-free pools to bring in those dirty and nasty packages on my computer. How do you do that? There is a magical trick to do that and it's called apt pinning. There is a nonexisting file /etc/apt/preferences that should contain the following spell:
Package: *
Pin: release a=testing
Pin-Priority: 650
Package: *
Pin: release a=unstable
Pin-Priority: 600
Package: *
Pin: release a=experimental
Pin-Priority: 550
This tells apt to prefer packages from testing over other pools. And there is how a part /etc/apt/sources.list looks like:
deb http://ftp.lug.ro/debian/ testing main non-free contrib
deb-src http://ftp.lug.ro/debian/ testing main non-free contrib
deb http://ftp.lug.ro/debian/ unstable main
deb-src http://ftp.lug.ro/debian/ unstable main
deb http://ftp.lug.ro/debian/ experimental main
deb http://www.debian-multimedia.org testing main
But the question "why do I need unstable and experimental if testing is preferred?" arises and the answer is simple: to have access to the list of packages, their description and possibility to install them from other versions. To install a package from experimental pool you can use this:
# apt-get -t experimental install kde4
And what's with contrib and non-free? Well, some of the good stuff is illegal but that's not a reason not to have it. Especially if that's a NVidia video card driver.
Resources
- Apt Pools
- Managing Packages with APT
- Apt Pinning
Debian Multimedia
No no, I did not forget! There is that multimedia word in sources.list that implies fun stuff. And it really does. Check out the stuff on Debian Multimedia project to see all those nice codecs and applications. And a tip: do not ignore the FAQ page on Debian Multimedia. This repo is a must for a desktop system.
Resources
Building from source
A keen eye could not have missed the deb-src keywords. They specify the possibility to get the sources for the packages you have installed. Why would you want to do that? For the same reason you are still reading this article - you're a hacker. So, how do I get those sources? Here is it how:
$ apt-get source pidgin
And you don't have to be root! You can look through the sources as an user and the ones you see are the same you would get from the upstream maintainer. Yes, Debian keeps patches for the fixes (some are Debian specific, some did not get into upstream version yet) in ./debian folder along with the build scripts. If you decide to build your own version of the package, possibly with modified sources, you need first to bring all the development packages necessary for building that specific package with the following command:
# apt-get build-dep pidgin
Once apt is done installing them you can build the package. It is usually done as user and needs fakeroot command. After cd-ing in the uncompressed folder issue:
$ dpkg-buildpackage -rfakeroot -b
Maybe you want also to use -nc to prevent loosing your changes in the case the source files are overwritten before building (this depends on the package and may be not true for all cases). Sometimes I even used git or bzr to keep the history of the changes. The result is a set of files among which one or more .dpkg files. You can easily install them with dpkg:
# dpkg -i *.deb
but keep in mind that your package has a lower priority than a Debian package of the same version so you might need to instruct apt to hold it. And in case you find you change useful, feel free to send your patch to the package maintainer using reportbug or reportbug-ng application.
Resources
- Building from source
- Holding Packages
- Git
Building the kernel
Oh, you're a kernel freak downloading the latest versions? Or just rebuilding a Debian kernel? Debian has a tool that helps you build a kernel that integrates nicely with the rest of the system. It's called kernel-package and it provides the command make-kpkg. An usual invocation would look like this:
$ make-kpkg --rootcmd fakeroot kernel_image
And it's not over! There is module-assistant package that provides the m-a command. It helps building external modules for your current kernel. I use it for building nvidia and lirc modules. Here is how I run it:
# m-a auto-install lirc nvidia-kernel-legacy-96xx
Most of the spells are just spoilers and there is no reason for you not to read the man pages for those application or the Debian documentation. You learn to get your driver's permit, learn the tools you're using.
Resources