Tuesday, 16 October 2007

Adept Package Manager shows BREAK for libasound2-dev

Funny thing a package manager, you would think it would be pretty easy but when you actually look at it in detail, you realise there are lots of grey areas. For instance, suppose you add a special repository for maybe a future release of Kubuntu and that repository includes an updated library such as libasound2 v1.0.14. Now suppose you update from your current 1.0.13 version - all fine. You now remove the repository link from sources.list, what should happen? Should it tell you your library is too new and offer to downgrade it? Well, perhaps not surprisingly it doesn't, it keeps your newer version unless you manually remove it.
What happens if you then try and install some non-futuristic software that requires libasound2 version 1.0.13? It's not going to find it and it won't install, it will tell you BREAK for the top level package (in this case libasound2-dev). Quite a subtle error but a bit of digging should help you work it out. You could simply remove the libasound version 1.0.14 surely and then do another install and you will get the 1.0.13 version that you should have but there in lies another problem. If you choose to remove libasound, it very cleverly also attempts to remove all of the packages that depend on it since they can't run without the library installed - in this case it was about 70 other packages - bummer.
The solution? Well although i prefer to use the GUI wherever possible, a command called apt-get (the get part of adept package manager) allows you to install a named version of a package, even if a newer one is installed. What it effectively does is replace the new one with the named one without uninstalling all the dependent packages in the process - sweet!! In my case, the command was:

sudo apt-get install libasound='1.0.13-1ubuntu5'

Friday, 5 October 2007

Building the NVidia driver for multiple kernels

Well I am one of the lucky people who has a notebook that is so new the nvidia driver that comes with Kubuntu does not support the graphics card. Fortunately NVidia have invested time and money supporting the Linux community and have developed a Linux installer that compiles kernel modules with the relevant drivers for the cards. Sweet.
You can download the install from nvidia.com, my one is called NVIDIA-Linux-x86_64-100.14.11-pkg2.run but presumably this will be updated from time to time. It is dead simple, you can simply type:

sudo sh ./NVIDIA-Linux-x86_64-100.14.11-pkg2.run

and it does the biz but bear in mind that you have to make sure you have your linux kernel header packages installed because the run package will need them. The instructions on the nvidia site will suffice but I had another problem...
The installer by default builds the module for the currently running kernel which might be mostly fine but what do you do when either you are upgrading the kernel or you have several bootable kernels?
Once the run package is executed, it should install "nvidia-installer" and this is the baby that does the hard work. There are two switches that you should be aware of. Firstly if you are running the installer to build a driver for a kernel that is not running, you must use:

sudo nvidia-installer --kernel-name='2.6.22-10-generic'

The name is how the installer will look for the source directories so you have to get it right. If you don't install the linux-headers packages for the target kernel you will get an error.
The second switch that is important is for when you already have the driver installed for one kernel and you want to build it for another one without uninstalling the current one, use:

sudo nvidia-installer --kernel-module-only

You might need to combine the two flags depending on whether your current kernel image is the target.
If you want to build the driver for a new kernel after it is installed, simply press esc in the grub menu and boot the recovery mode for the kernel, you will be logged in as root. Type "telinit 3" which will boot you to a text login (you can theoretically do this with a broken X driver by pressing ctrl-F2 or something but it didn't work for me). Log in and then run the second flavour of nvidia-installer above and then you don't have to fuss about knowing the exact kernel name to pass to the installer. Once this is done, type "startx" and it should be fine.

Building Ardour2 on Kubuntu

Well, I have been trying to build ardour2 on Kubuntu since it hasn't been added to the Ubuntu repositories and have followed the instructions on ardour.org. They are basically OK but I did come across a problem I thought I would share.
Trying to install one of the libraries required (libasound2-dev) Adept Package Manager told me it couldn't be installed - that classic "INSTALL (break)" message! It wasn't immediately obvious what had happened but basically I had used some newer repositories to get a newer kernel - this kernel was needed for my wifi driver. The new repositories had offered me an upgrade to libasound2 (from 1.0.13 to 1.0.14) which I had obviously selected to upgrade. After removing the new repositories from sources.list I was left with a new library installed which the dev package didn't want (fair enough!).
The complication was that trying to uninstall the new library (to reinstall the right version) would remove every package on the PC that relies on it. That happened to be about 50 applications so this wasn't an option. Fortunately there was an option to install a named release using the command-line:

sudo apt-get install libasound2='1.0.13-1ubuntu5'

This effectively replaced the currently installed one with the version I specified which made adept happy again.