Linux bits and pieces

This page collects various things that took me a while to figure out in Linux, so it serves both as my personal memory backup and a searchable resource for others to save you some work.

NetworkManager vs. USB GPS


While on the desktop I like Gentoo's way of network configuration a lot, my laptop has a somewhat more noob-friendly configuration, if only to be able to show others how to do things without starting every sentence with a scary “sudo vi”. In that respect I quite like NetworkManager; it ususally lets one plug in new hardware like WiFi or UMTS sticks and it Just Works. Sometimes it's a bit overzealous though, like when it started grabbing each and every USB serial device in Ubuntu 12.10, and when I tried to download GPS data from my tracker using mtkbabel, it would complain:

ERROR: Opening serial device /dev/ttyACM0: Device or resource busy at /home/mb/bin/mtkbabel line 1731.

The problem is fortunately pretty easy to fix (credits go to Michael Croes), although the solution does involve a “sudo vi” to create /etc/udev/rules.d/70-mm-blacklist.rules:

ACTION!="add|change", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end"
# This is for a BTQ-1000 GPS tracker; add any other device ID
# as shown by lsusb here
ATTRS{idVendor}=="0e8d", ATTRS{idProduct}=="3329", ENV{ID_MM_DEVICE_IGNORE}="1"


TrippLite UPS on nut


The latest TrippLite UPS models with USB ID 09ae:2010 aren't officially supported in nut 2.4.3 as included with Debian Squeeze yet; the driver will complain “Can't claim USB device” and “could not detach kernel driver from interface”. That's a permissions problem easily fixed using an extra line in /lib/udev/rules.d/52-nut-usbups.rules:

ATTR{idVendor}=="09ae", ATTR{idProduct}=="2010", MODE="664", GROUP="nut"

Use udevadm to reload the rules or just re-plug the USB cable to get it recognized correctly.

Compiling MGA drivers


Compiling the Matrox MGA drivers isn't the usual “./configure && make && make install” incantation; independently from your distribution (as far as I can tell) it fails with a compile error. To fix it:

  1. In src/mga_dacG.c, add an #include "binding.h" near the top (fixes the “'UCHAR' undeclared” error)
  2. Configure with CFLAGS="-DUSEMGAHAL" ./configure
  3. make as usual

You may have to get the Matrox HAL library from your distro's package as for some reason it's not being built from the same source and I was too lazy to investigate because it happened to work like this.

SSHFP records in MaraDNS


MaraDNS doesn't support SSHFP records directly but using its RAW records they can easily be recreated. As ssh-keygen only outputs BIND-format records, they have to be massaged a little:

ssh-keygen -r |
perl -ne '/(\S+) IN SSHFP (\d) (\d) ([[:xdigit:]]+)/ &&
print "$1\tRAW 44\t\\x0$2\\x0$3",
(map { "\\x$_" } $4 =~ /(..)/g),

Trackman Marble FX vs. HAL evdev, yet again


Oh, GREAT! The folks seem to have realized that HAL is not what they want. While I can fully understand that decision, it means yet another way of setting up your input devices. Now it looks more like the old way, with xorg.conf and all, and the keyboard entry will have to be fixed as well:

Section "InputDevice"
    Identifier "Mouse1"
    Driver     "evdev"
    Option     "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse"
    Option     "Name" "TrackMan Marble FX"
    Option     "Vendor" "Logitech"
    Option     "AngleOffset" "10"
    Option     "EmulateWheel" "true"
    Option     "EmulateWheelButton" "8"
    Option     "YAxisMapping" "4 5"
    Option     "EmulateWheelInertia" "8"

Section "InputDevice"
    Identifier "Keyboard1"
    Driver     "evdev"
    Option     "AutoRepeat" "500 30"
    Option     "Device" "/dev/input/by-path/platform-i8042-serio-0-event-kbd" 
    Option     "XkbModel"	"evdev"
    Option     "XkbLayout"	"us"

Trackman Marble FX vs. HAL again


Since has moved to HAL as a replacement for xorg.conf, some things have indeed become easier. But now you can't just change your config without mucking around in heaps of obscure, stinking XML. I hadn't used my Trackman Marble on Gentoo for quite a while so now I had to face the problem that the below xorg.conf lines didn't work any more. Largely thanks to, here's a roughly equivalent /etc/hal/fdi/policy/mouse-wheel.fdi:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
    <match key="info.product" string="Logitech USB Receiver">
      <merge key="input.x11_options.Buttons" type="string">9</merge>
      <merge key="input.x11_options.EmulateWheel" type="string">true</merge>
      <merge key="input.x11_options.EmulateWheelTimeout" type="string">300</merge>
        <merge key="input.x11_options.ButtonMapping" type="string">1 8 3 4 5 6 7 2 9</merge>
      <merge key="input.x11_options.EmulateWheelButton" type="string">8</merge>
      <merge key="input.x11_options.YAxisMapping" type="string">4 5</merge>
      <merge key="input.x11_options.Emulate3Buttons" type="string">false</merge>

You may want to try the ButtonMapping key—it's not bad, just a matter of taste, and I've probably used the old config (the thumb button next to the ball being used only for scrolling and “middle” actually on the leftmost) for too long to flash my motor memory now.

CUPS: SMB woes


Since we have rather fascist network admins at work who firewalled off the new super duper department printer and allowed access only via some Windoze box, I had to finally set up CUPS to use SMB printing. As if URLs of the form smb://WINDOWSDOMAIN%5Cuser:password@/server.dns.domain/printername weren't enough punishment already, CUPS has more in stock: printing from the commandline using lp worked fine once I got the URL right but apart from OpenOffice hardly any other application got it right. You get to see all the right printer options from the PPD but the actual printing fails with some usually very nondescript message such as "Too many failed attempts". Turns out authentication doesn't work. As this is pretty much a single user machine anyway (and printing through a single account anyway), the cheapest fix is to replace whatever is after AuthInfoRequired in your /etc/cups/printers.conf with "none". Sigh.

USB: connect-debounce failed, port disabled


A lesson I have to re-learn every now and then: Do not change your kernel options needlessly!
I had been plagued by tons of messages like the above in my kernel log and consequently dysfunctional USB devices for a few days. Apparently this has been reported and rereported as a kernel bug in a lot of places since Linux 2.6.16, mostly for laptop chipsets. My problem wasn't as bad though: switching off USB_SUSPEND (“USB selective suspend/resume and wakeup”) fixed it. Well, it sounded like a good idea when I came across this option …

Slow graphics under with Intel chipset


At work I use Debian Lenny on an Intel 82Q963/Q965 graphics controller. Since they started using the intel driver instead of i810, graphics operations and particularly scrolling in terminals were painfully slow and CPU-intensive. As I found out, this can be fixed with a single Device option that enables some sort of “legacy XFree86 acceleration method”, whatever that is:

Option "AccelMethod" "XAA"

Great :-/

Trackman Marble FX in 7.x


Gentoo has stabilized 7.0/7.1, so after the laptop that has always required it for its i915 graphics, I'm upgrading the desktop as well. Following the migration guide, all goes well, only my Logitech Trackman Marble FX ends up with two middle buttons. A little more editing of xorg.conf has it working nicely again: both horizontal and vertical panning in GTK applications plus vertical scrolling using the scroll button:

Section "InputDevice"
        Identifier      "Mouse1"
        Driver          "mouse"
        Option          "Device"      "/dev/input/mice"
        Option          "Name" "TrackMan Marble FX"
        Option          "Vendor" "Logitech"
        Option          "Protocol" "explorerps/2"
        Option          "AngleOffset" "10"
        Option          "Buttons" "5"
        Option          "EmulateWheel" "true"
        Option          "EmulateWheelButton" "8"
        Option          "YAxisMapping" "4 5"
        Option          "EmulateWheelInertia" "8"

I found that adding an

        Option          "XAxisMapping" "6 7"

(which I thought would give me free 2D scrolling) doesn't quite send the right events but causes some annoying jumping back and forth in most web browsers and does nothing in most other software.

Last change: 23-Sep-2013, 16:01

You are not supposed to see this—arachnoids only: nude metal goth porn tits video i phone thai hentai gangbang girls i touch lolita emo slutsparis ghettoschlampen arschgeficktgay geigh salope enculée pédé