Skip to content

Windows key in aptosid/sidux/debian

The default install of aptosid (formerly sidux) maps the windows key to compose (Multi_Key), which is used for entering special characters with key combinations. This drives me nuts, because (a) I use the windows key as a modifier for launching my most common applications and (b) I never need to enter the special characters. Today I finally figured out why this is happening, and how to resolve it properly without an xmodmap band-aid.

Continue reading ‘Windows key in aptosid/sidux/debian’ »

simulating network delay in Linux

At work we are having a problem with OpenWRT, where daemons like wifidog and dnsmasq can’t get information about the wan network interface when they’re started if the wan uses DHCP and it takes too long to get a lease. I was having trouble reproducing the issue, so I decided to force some extra delay with netem. Here are the commands I used to add massive delay to all DHCP traffic going to my DHCP server, which is running on eth3:

tc qdisc add dev eth3 root handle 1: prio
tc qdisc add dev eth3 parent 1:3 handle 30: netem delay 5000ms

# Only the first rule should really be necessary, since we are delaying the outgoing
# traffic from 67 (bootps) to 68 (bootpc).
tc filter add dev eth3 protocol ip parent 1:0 prio 3 u32 \
   match ip sport 67 0xfff flowid 1:3
tc filter add dev eth3 protocol ip parent 1:0 prio 3 u32 \
   match ip dport 67 0xfff flowid 1:3
tc filter add dev eth3 protocol ip parent 1:0 prio 3 u32 \
   match ip sport 68 0xfff flowid 1:3
tc filter add dev eth3 protocol ip parent 1:0 prio 3 u32 \
   match ip dport 68 0xfff flowid 1:3

# Also delay pings so we can more easily see it working
tc filter add dev eth3 protocol ip parent 1:0 prio 3 u32 \
   match ip protocol 1 0xff flowid 1:3

See also: another blog posttc filters documentation (lartc), tc manual (pdf)

Installing Python 2.6 in Sidux/Debian/Ubuntu

Install Build Requirements

If you have the appropriate deb-src entries in your sources.list files, then you can do this:

apt-get build-dep python2.5

Replace 2.5 with the default version in your distro. Unfortunatly in sidux this wanted to install emacs (NEVAR!!!!) and remove my password manager (the unstable repo has been changing rapidly since the new debian release). I used this instead:

apt-get install build-essential blt-dev libbluetooth-dev libbz2-dev libdb4.5-dev
   libffi-dev libgdbm-dev libncurses5-dev libncursesw5-dev libreadline5-dev
   libsqlite3-dev libssl-dev tk8.4-dev

It worked for me, but the list may be incomplete.

Install Python, libraries, etc

See my article about installing 2.6 in Cent OS – most of it is distribution agnostic. To build/install psycopg2 you will probably need to install libpq-dev.

Installing Python 2.6 in CentOS 5 (or RHEL5)

CentOS 5 uses python 2.4, and replacing it is not really on option since yum and other core packages depend on it. My solution is to compile 2.6 and use /opt or /usr/local for the prefix. I also create a virtualenv with the new python executable, so when I’m in the environment 2.6 becomes the default python. It also isolates all my python libraries for a given project. Most of this article is actually distribution agnostic, and the yum build requirement install will likely work on other versions of CentOS and other RedHat derivatives like Fedora.

Continue reading ‘Installing Python 2.6 in CentOS 5 (or RHEL5)’ »

sidux kernel upgrade without dist-upgrade

Update: sidux is now called aptosid, updated package name.

Debian “lenny” was released mid Feburary, and since then experimental packages have been making their way into sid much more quickly then usual. This makes dist-upgrade a bit dangerous, but kernel upgrades are not installed when doing a normal upgrade. Here’s a shell command I use to upgrade just the sidux kernel:

dpkg -l *2.6-aptosid-amd64 | grep '^ii'  | awk '{print $2}' | xargs apt-get -y install

Replace amd64 with 686 if you’re not running 64-bit. This works because all of the sidux kernel packages (image, headers, *-modules) end with 2.6-sidux-amd64 (2.6-sidux-686).

To remove old kernels, I use kernel-remover from the sidux-kernelhacking package.

855GM tv-out not supported by new intel driver

I tried to connect my aging Inspiron 700m to my TV with S-Video, which has worked well in the past, only to discover that tv-out is no longer supported with the new intel driver (see this discussion at Ubuntu’s bug tracker ). And the old driver is no longer included in debian/ubuntu/sidux.

I installed the xorg-video-intel-i810  driver from etch (now oldstable) with –force-conflicts; the newer versions are dummy packages for the intel driver. Then I copied over my old xorg.conf, but it still used the intel driver. Plus apt refuses to do anything because of the conflict.

Perhaps I will need to compile the xorg 7.1 source and install over the debian packages? What a f#*&ing pain in the ass. Or maybe i810 is still maintained in 7.3+, but not packaged? More on this later when I find a solution.

UPDATE: I finally got old xorg installed, only to encounter worse bugs than no S-video out – I can’t get any dual head working. I suspect that 6.8 may work, but the older the release the harder it is to get it compiled. For now I will be booting into Windows XP whenever I need S-Video. I’d be curious to know if anyone has success with 6.8 (or any other solution).

Multicast routing UPnP traffic with Linux

I use my Linux desktop, which has both wired and wireless network adapters, to connect my Xbox 360 to the wireless network. My wireless driver (rt73usb in 2.6.28) does not support source address spoofing, which is needed for bridging, so I used routing instead. This broke UPnP IGD port forwarding, which uses multicast and doesn’t normally traverse a router. My solution: static multicast routing with smcroute.

Continue reading ‘Multicast routing UPnP traffic with Linux’ »

pulseaudio module-combine arguments

I installed pulseaudio 0.9.13 in sidux (from experimental), and discovered that the FAQ about sending playback to two devices simultaneously is out of date. The correct syntax is:

load-module module-combine sink_name=combined slaves=output0,output1

i.e. the master argument is no longer used. I discovered this by looking at src/modules/module-combine.c:

        "sink_name=<name for the sink> "
        "slaves=<slave sinks> "
        "adjust_time=<seconds> "
        "resample_method=<method> "
        "format=<sample format> "
        "channels=<number of channels> "
        "rate=<sample rate> "
        "channel_map=<channel map>");

It’s always refreshing to see such clear code!

Some clients don’t seem to respect set-default-sink. I used pavucontrol to move the streams, but when playing youtube videos the process didn’t show up, so I was stuck with single card output.

UPDATE: Pulse remembers stream/sink associations, so if you run a program before using set-default-sink combined, then you will need to move it manually with pavucontrol. I also fixed my problem with flash/youtube. I was using flash 10 through nspluginwrapper, which was ignoring my asound.conf settings making pulse the default and using my sound card directly. Switching to the native 64-bit flash plugin (installed from marillat experimental) fixed the problem.

“How not to erase an old hard disk”, a new comedy by bda

The Cast:

  • bda, veteran Linux user of 9+ years
  • Dell Dimension P166, long time resident of basement storage unit
  • Inspiron 700m laptop, secondary computer used regularly by bda

bda – “I should get rid of this old P166. Maybe goodwill will accept it? But first I need to purge the disk”.
P166 – silence
bda takes disk out of P166, places in enclosure, and connects to laptop runnin Arch Linux
bda – “$ mount /media/hda5 /mnt; ls /mnt; rm -rf *”
bda – (thinking) “maybe I should shred the files… that might be harder if they’re already deleted”
bda hits CTRL-C to stop the rm command
bda – “$ apropos shred”
laptop – weird error message
bda – “$ ls”
laptop – same error message
bda – (thinking) “Oh f@*&”


Yes. I rm -rf’ed my laptop. Luckily it only got to /bin and /etc. I was even able to recover my list of installed packages by copying /bin and /etc/pacman* from the live cd to the laptop root, chrooting, and running “pacman -Qqe > …”. My old ubuntu /etc backup is also still intact. Still it’s going to be a pain reconstructing all the configuration chages I’ve made since installing arch.

error: ‘malloc’ was not declared in this scope

Translation: You are a bad person and did not include stdlib.h. Older versions of gcc let you get away with this. Not so with 4.3. I had similar errors for strcmp when not including string.h.

I got this trying to compile my thesis code on my laptop. The exact same code worked on my desktop, the difference being that my laptop is running intrepid, which uses gcc 4.3 by default. After blaming m12, I came across this and realized that it really was my fault.