I then reinstalled the virtual package linux-image-2.6 which installed linux-image-2.6.31-17-generic (2.6.31-17.54) and the problem returns
How did you reinstall it?
How can I get dpkg or aptitude to do a clean installation of the latest kernel?
The latest distro kernel will show up in your updates notification. Use that.
Try not to mix package install methods. Use dpkg, aptitude or apt-get consistently.
However, it looks like:
run-parts: executing /etc/kernel/postinst.d/nvidia-common
File "/usr/bin/nvidia-detector", line 9
except NoDatadirError, e:
SyntaxError: invalid syntax
... which is a bit like:
... there is a syntax change which the "nvidia-common" package. Perhaps remove the nvidia packages you have, reconfigure the kernel, then reinstall the packages. We expect trouble with packages associated with proprietary drivers. Of course, you can go into the source code and correct it
you are told the line number.