Keep a Debian fresh thanks to cron-apt

As I mentioned in an old comment, I use cron-apt to keep my Debian servers fresh.

This post is just a quick reminder to my future self, about how I setup cron-apt on my machines.

First we install the package:

aptitude install cron-apt

Then we configure it:

sed -i 's/# MAILON="error"/MAILON="always"/g' /etc/cron-apt/config
sed -i 's/# MAILTO="root"/MAILTO="kevin@deldycke.com"/g' /etc/cron-apt/config

That’s it !

Using latest stable Kdenlive with a development version of MLT

Today I stumble upon a bug in the Kdenlive 0.7.8 running on my Kubuntu 10.10: the crop filter was messing with the display ratio of my video clips. Digging the web I found a bug report that was really close to my problem. According to the comments, this issue was fixed in the upcoming version of MLT. Is that bug the one I encountered ? The only way to find out was to install the development version of MLT. Here is how I did it…

First, make sure to use the latest stable Kdenlive stack for you system. For me, the Sunab’s alternative repository for Kubuntu 10.10 was the ultimate source:

sudo apt-get update && sudo apt-get install kdenlive

The idea is to keep the version of Kdenlive installed above, and replace the pre-packaged MLT on our system with a custom development version of our choice.

But first, we’ll install all the libraries required to build MLT from sources:

sudo apt-get install libavdevice-dev libswscale-dev libvorbis-dev libsox-dev libsamplerate-dev frei0r-plugins-dev libdv-dev libavformat-dev libquicktime-dev libxml2-dev libsdl-dev libsdl-image1.2-dev

Let’s now remove the installed MLT. If we use apt-get or KPackageKit, this will remove Kdenlive. So we’ll use the following command to remove MLT while ignoring all the dependencies:

sudo dpkg --remove --force-depends libmlt2 libmlt++3 libmlt-data melt

At this point, and every time we try to use it, apt will complain of broken Kdenlive dependencies, and will try to remove it. This mean we can’t upgrade other packages on the system.

To avoid this issue, I tried to freeze the state in which Kdenlive and MLT are, by setting the hold flag on kdenlive, kdenlive-data, libmlt2, libmlt++3, libmlt-data and melt packages. I tried with both dpkg and aptitude, but unfortunately it doesn’t work as expected. So we’ll continue our hack anyway…

Let’s get MLT sources:

git clone git://mltframework.org/mlt.git

The command above will give you the latest development version. But if you target a particular revision (like commit 21a3f68 in my case), you have to use this additional command:

git checkout 21a3f68

We can now follow the procedure detailed in the Kdenlive manual:

cd mlt
./configure --prefix=/usr --enable-gpl
make clean
make
sudo make install

That’s it ! Now you can launch Kdenlive, and if you run the wizard, you’ll see that the MLT version on your system is the latest:

Oh, and by the way, it fixed my problem with the crop filter ! :)

Finally, if you want to revert the mess we created on the system, you have to remove the MLT we built in place:

sudo rm -rf /usr/lib/libmlt*
sudo rm -rf /usr/lib/mlt*
sudo rm -rf /usr/lib/pkgconfig/mlt*
sudo rm -rf /usr/include/mlt*
sudo rm -rf /usr/share/mlt*

I came with the list above by searching my system with the following command:

sudo find / -path "/home" -prune -or -iname "*mlt*" -print -or -iname "*melt*" -print

Then, we can let apt handle Kdenlive and MLT properly and get back to the pre-packaged binaries:

sudo apt-get remove kdenlive && sudo apt-get update && sudo apt-get install kdenlive

eAccelerator for PHP5 on Debian Lenny

eAccelerator is an open-source PHP accelerator, optimizer, and dynamic content cache (to quote the official website of the project). It can effectively speed-up PHP processing on a server by caching bytecode.

As Wikipedia tells you, several tools of this kind exists. Why choosing eAccelerator in particular ? I really have no clue… I’ve never used any of these tools, so I had to start somewhere. That’s as simple as that !

Now, I have a Debian server as a target system. Unfortunately, eAccelerator is not bundled in Lenny. Browsing the web, I found some personal repositories of people kindly sharing their deb packages, like Andrew McMillan and schnuckelig.eu. The former provides a version of eAccelerator for the i386, the latter for the amd64 architecture. In this how-to, I’ve combined the 2 repositories to give both 32 bits and 64 bits users a chance to use eAccelerator on Lenny.

Let’s start the installation ! First, add the following lines to your /etc/apt/sources.list file:

deb http://debian.mcmillan.net.nz/debian lenny awm
deb-src http://debian.mcmillan.net.nz/debian lenny awm
deb http://debian.schnuckelig.eu/ lenny main contrib non-free

To kill annoying warning messages, register the cryptographic fingerprint of each repository:

$ gpg --keyserver keyring.debian.org --recv-keys 0x8f068012;
$ gpg --export --armor 0x8f068012 | apt-key add -
$ wget -O - http://debian.schnuckelig.eu/repository-key.gpg | apt-key add -

Then, update your package database:

$ aptitude update

And finally, you can install eAccelerator for PHP5 without any pain:

$ apt-get install php5-eaccelerator

Happy fine-tunning !

dpkg, APT & Aptitude commands

  • List all installed packages:
    dpkg -l
    
  • List all recently installed packages:
    zcat -f /var/log/dpkg.log* | grep "\ install\ " | sort
    
  • Install a package from a lower-priority repository, like the backport repository:
    apt-get -t squeeze-backports install my-package
    
  • Force reinstallation of a package:
    apt-get -d --reinstall install my-package
    dpkg --install --force-confmiss /var/cache/apt/archives/my-package.deb
    
  • Clean aptitude local cache:
    apt-get clean
    
  • Uninstall a package throughly (both program files and configuration):
    apt-get remove --purge my_package
    
  • Force removal of a package while ignoring all dependencies:
    dpkg --remove --force-depends libsomething
    
  • Remove orphaned pakages:
    deborphan | xargs apt-get -y remove --purge
    
  • Show the changelog of a package (here, the linux kernel of Ubuntu):
    aptitude changelog linux-generic
    
  • Which package contain a given file:
    apt-file search file_to_search
    
  • Get the list of files of a package:
    apt-file list package_name
    
  • Remove dpkg lock file:
    rm /var/lib/dpkg/lock
    
  • Hold a package with either dpkg or aptitude:
    echo "kdenlive hold" | dpkg --set-selections
    
    aptitude hold kdenlive
    
  • Unhold a package:
    echo "kdenlive install" | dpkg --set-selections
    
    aptitude unhold kdenlive
    
  • List holded packages:
    dpkg --get-selections | grep hold