Tag Archives: Gentoo

Debugging File Type (MIME) Associations

I’m having less and less time to blog and write stuff lately, so it’s a good oppertunity to catch up with old thing I did. Back in the happy days I used Gentoo, one of irritating issues I faced was messed up file type associations. MIME type for some files was recognized incorrectly, and as a result, KDE offered to open files with unsuitable applications. In order to debug it I wrote a small python script which would help me debug the way KDE applications are associated with MIME types and what MIME type is inferred form each file.

The script does so by querying the KMimeType and KMimeTypeTrader. The script does 3 things:

  • Given a MIME type, show it’s hierarchy and a list of applications associated with it.
  • Given an applications, list all MIME types it’s associated with
  • Given a file, show its MIME type (and also the accuracy, which allows one to know why that MIME type was selected, although I admit that in the two years since I wrote it, I forgot how it works :))

The script is pasted below. I hope someone that still fiddles with less than standard installations, will find it helpful.
Continue reading

Missing *.la files

Sometimes when you compile a package it fails and complains it can’t find an *.la file for some library that is installed. Recently I had it when compiling dev-libs/gobject-introspection which complained about missing libpng14.la. The solution for this is to run:

sudo lafilefixer --justfixit

It won’t create the .la file, but it will fix the libtool references so nothing points to it so packages will compile fine.

search_for_updates 0.2

This is a small update to my search_for_updates script which have been laying around. The script allows to search for updates from portage without resolving dependencies. Thus, it’s much faster than

emerge -pvu world

The new version lists the best version available for each package which can be updated using the --verbose flag. You can download the new version from here: search_for_updates-0.2.

Kernel Configuration and nvidia-drivers

This is more of a note to myself, as I keep forgetting this. The propriety NVIDIA drivers, provided by the x11-drivers/nvidia-drivers dislikes alternatives. It will refuse to build against a kernel with the rivafb (CONFIG_FB_RIVA) and nvidiafb (CONFIG_FB_NVIDIA) built in or built as modules. Both can be found (and unset) under:

Device Drivers
-> Graphics support
   -> nVidia Framebuffer Support
   -> nVidia Riva support

sudo for X Programs

By default (at least on my machine), it wasn’t possible to open X applications using sudo. For example sudoing xclock resulted in the following error:

$ sudo xclock
No protocol specified
Error: Can't open display: :0.0

The same error appeared even when I executed xclock after running sudo su.
Continue reading

Searching for Updates without emerge

The normal way to see which installed packages have available updates on Gentoo is running

$ emerge -puv world

And then you usually select the packages you really want to update and emerge them. However this workflow has several downsides:

  1. It’s slow. When portage checks for updates this way it fully resolves all the dependencies. This process is unnecessary, as in many cases you aren’t interested in updating all the packages, furthermore in their dependencies.
  2. It may fail. When portage fails to resolve the dependencies, it will either complain or completely fail. If it complains, it isn’t really that bad, except for the time used for resolving the unanswered dependencies. Sometimes it fails completely (usually when masking is involved) and won’t display any of the available packages, hence leaving the user in the dark (except for some dependency error message).
  3. It displays lot’s of output. Many times you’re not interesting in seeing the dependencies that will be updated if you emerge every package in the world file. It’s just confusing and distract you from the interesting updates for packages in the world file.

The following scripts tries to work around these problems. It works by querying the portage API for the best version available for each package in the world file. If that version isn’t installed it reports that there are updates waiting for that package. The script runs faster then emerge -pvu world and only displays the packages from the world file. If you find a package that you want to upgrade you can emerge it separately to see the required dependencies.

Continue reading

Upgrading All KDE Related Packages in Gentoo

Yesterday, Gentoo marked KDE 3.5.10 as stable on amd64. I looked for a way to upgrade all of the KDE related packages, without manually specifying each one of them. Normally one could do

emerge -avu world

but I encountered some nasty conflicts that I didn’t have time, nor will, to resolve at that time. So I’ve looked for a different solution. To my rescue came qlist for the great app-portage/portage-utils package. This package provides a set of very fast utilities to query portage. I’ve used qlist to list all of my installed packages, grep‘ed the list and piped the result as arguments to emerge using xargs.
Continue reading

phpMyAdmin + Lighttpd in Gentoo

Usually installing software in Gentoo is a piece of cake. Just emerge what you want and (with the right USE flags) and everything will be ready for you. However, as today I’ve found out today, installing phpMyAdmin with Lighttpd isn’t trivial as it should be.

In this post I’ll try to walk you through the necessary steps to install phpMyAdmin with Lighttpd in Gentoo.
Continue reading