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

Eject Your Kindle and Reconnect under Linux

I am Your User suggested a method to eject your Kindle in Linux. While his method works, you don’t need to specify the partition number. E.g.

$ sudo eject /dev/sdd

where /dev/sdd is the device file of the Kindle.

But what if you want to reconnect it back without plugging in and out the usb cable? You can add the -t switch.

$ sudo eject -t /dev/sdd

Even though it prints the following error:

eject: CD-ROM tray close command failed: Input/output error

it works, and the Kindle reappears in KDE.

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 Searching for Updates without emerge

NVidia driver fails to initialize after X restart

This is mainly a note to myself. Sometimes when the X server is restart it complains that nvidia driver couldn’t be initialized and that no screens were found. This may be a result of a version mismatch between X11’s and the kernel’s nvidia module. The solution is to

modprobe -r nvidia

before restarting the X server.

Blocking IP Range using UFW

Uncomplicated Firewall (ufw) is one of the greatest frontends to IPTables I’ve encountered. It is very simple to use and I just wish it was also available for Gentoo. Up until recently everything went smoothly for me and ufw, but we hit some rough waters when I’ve tried to block an IP range.

To block an IP or IP range in ufw you should do

sudo ufw deny from 188.162.67.197/21

Continue reading Blocking IP Range using UFW

Using Amarok Generated Playlists (m3u) on Sansa Clip

Few days ago, for the first time, I’ve created a playlist using Amarok for files on my Sansa Clip player. To my surprise (and disappointment) when I’ve unplugged my Sansa Clip and powered it, the playlist showed up empty, unlike playlists which originated in Windows. As I keep my music collection organized in Amarok, the situation seemed to be very uncomfortable.

I’ve decided to compare one of the working playlist files and the “empty” Amarok generated playlist. Two things were noticeable:

  1. Amarok uses forward slashes, like in a Linux environment, and the working playlist used backward slashes.
  2. The working playlist used relative paths without any prefix – directly beginning with the path. Amarok prefixed the relative paths with a dot-slash (./).

After noticing those things I’ve modified my Amarok generated playlist to look like the Windows generated one, and voila, it worked. I tried going through Amarok’s configuration dialogs to find some option controlling the format of generated m3u playlists, but couldn’t find any (I’m using Amarok 1.4.10). So with my newly found wits I’ve looked for a way to make using the playlists easier. I’ve came up with the following one-liner:

find -name "*.m3u" | xargs -I{} sed "s/^\.\///;s/\//\\\\/g" -i'' {}

The command should be run in the MUSIC directory of the Sansa Clip’s filesystem. It recursivey looks for m3u playlists and for each one strips any leading dot-slash and replaces forward slashes with backward ones. It can be used to easily convert all your playlists to the format understandable by Sansa Clip.

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 Upgrading All KDE Related Packages in Gentoo

Installing Lighttpd-1.4.22 on Ubuntu 8.04

I had some problems with the lighttpd-1.4.19 that comes with Ubuntu 8.04, mainly it’s problems of handling the HTTP header Expect: 100-continue (which older versions of Lighttpd return error 417). The problem was fixed in Lighttpd-1.4.21, but 1.4.22 is the newest version so I’ve decided to install it.

As I mentioned before, Ubuntu doesn’t have lighttpd-1.4.22 for 8.04, and it’s also not available in the updates or backports repositories. Fortunately, I’ve found that the package is available from Debuian Sid (unstable). Here are some instructions on how to install it.
Continue reading Installing Lighttpd-1.4.22 on Ubuntu 8.04