Attansic L1 Gigabit Ethernet driver for Debian

m2v.jpegI just got a new ASUS M2V motherboard to replace a braindead server that would lock up on POST about 75% of the time. The new motherboard has a built-in Attansic L1 Gigabit Ethernet Adapter that is supported in Linux >= 2.6.21, but its driver is still missing from the daily Debian netinst CDs.

04:00.0 Ethernet controller [0200]: Attansic Technology Corp. L1 Gigabit Ethernet Adapter [1969:1048] (rev b0)
        Subsystem: ASUSTeK Computer Inc. Unknown device [1043:8226]
        Flags: bus master, fast devsel, latency 0, IRQ 25
        Memory at fbcc0000 (64-bit, non-prefetchable) [size=256K]
        Expansion ROM at fbca0000 [disabled] [size=128K]
        Capabilities: [40] Power Management version 2
        Capabilities: [48] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
        Capabilities: [58] Express Endpoint IRQ 0
        Capabilities: [6c] Vital Product Data

I tried David Johnson’s pre-compiled driver for AMD64 but it didn’t work right away, so I compiled AtL1Linux_v1.0.41.0 for the stock 2.6.18-4-486 kernel in the official Debian 4.0 netinst CD and tested it. Although it was supposed to work right out of the box I kept getting “invalid module format” messages. So I stripped out the version information with

$ objcopy -R .modinfo atl1.ko

and it worked immediately. I completed the installation and I will upgrade the server to 2.6.21-2-amd64 over the weekend. So here is a atl1.ko for 2.6.18-4-486 that should work just fine.
By the way, I stripped the version information off David’s atl1.ko but I didn’t get a chance to test it because I was in a hurry. Here it is anyway in case someone finds it useful: atl1.ko for 2.6.18-4-amd64.
Oh, by the way, the M2V has four PCI slots but no built-in VGA adapter, and most PCI-e video cards are so thick that the first slot becomes unusable. Since I bought this motherboard precisely to maximize the number of available PCI slots in the server… well, it just sucks.
[tags]asus,m2v,attansic,debian,linux,driver,atl1,amd64[/tags]

Moving from MyISAM to InnoDB: bulk table conversion

A couple of years ago Ludovico Magnocavallo tackled the issue of bulk conversion of MySQL tables from MyISAM to InnoDB with an elegant bash snippet.

for t in $(mysql --batch --column-names=false -e "show tables" mydbname); do
  mysql -e "alter table $t type=InnoDB" mydbname;
done

The original post also suggests using grep to limit the scope of the conversion to just a few tables.
(It seems that now Google *does* yield practical answers to this question ;-)
[tags]bash,mysql,innodb[/tags]

?HOWTO: Recover an empty kcontrol tree

empty kcontrolLast night I opened KDE control center to change my desktop settings and I was shocked when I found that kcontrol was empty but for the OBEX Devices panel. Alll the modules that were supposed to be inside kcontrol where inside the KDE “Lost and Found” folder instead. A superficial search in the KDE mailing lists returned a few matches about this problem on KDE4 (did you know that kcontrol is currently unmaintained and that it’s gonna die real soon now?) but I’m currently in KDE 3.5.5 so that doesn’t apply to me.
Tonight Google came to the rescue: after digging a bit more I found this post in the debian forums which mentions that this might be a bug in a debian package and spells out the answer to my problem:

$ sudo ln -s /etc/xdg/menus/applications-merged/kde-essential.menu /etc/xdg/menus/kde-applications-merged/kde-essential.menu 

recovered kcontrolVoilá! Now my kcontrol is fully populated again.
[tags]kcontrol, kde, debian, linux[/tags]

?HOWTO: Enable the SATA CD-ROM Drive in the Dell Latitude D620

After a few weeks using the auxiliary battery instead of the CD-ROM drive, I needed to read a DVD. Surprise! It didn’t work. Reboot. Still no luck.
dmesg didn’t show anything about IDE, and /proc/ide was empty. It was like the CD-ROM didn’t exists at all.
The explanation might be that the CD-ROM is a SATA drive, not PATA. Graham William’s GNU/Linux Desktop Survival Guide holds the key to enable the drive. In short:

# echo "libata atapi_enabled=1" >> /etc/mkinitrd/modules
# cp /boot/initrd.img-`uname -r` /boot/initrd.img-`uname -r`.bak
# mkinitrd -o /boot/initrd.img-`uname -r`
# reboot

Voilá.
(Part of the ongoing Debian GNU/Linux on Dell D620 saga.
[tags]Dell, D620, SATA, cdrom[/tags]

?HOWTO: Run VMware Player under Debian GNU/Linux

VMware PlayerVMware has made available VMware Player for free for a few months now. I had been having problems making it run under the latest kernels in Debian GNU/Linux until I found out about the Czech University vmware-any-any patch. Of course, this is unsupported, so YMMV.

A typical installation run would go like this:

$ cd /tmp
$ wget http://download3.vmware.com/software/vmplayer/VMware-player-1.0.2-29634.tar.gz
$ tar -zxvf VMware-player-1.0.2-29634.tar.gz
$ cd vmware-player-distrib
$ sudo ./vmware-install.pl

Answer the questions about installation directories, initscript dirs and such, but *do not configure VMware yet*. I repeat: do not configure VMware yet.

Now we’ll patch the source with vmware-any-any

$ cd /tmp
$ wget http://ftp.cvut.cz/vmware/vmware-any-any-update104.tar.gz
$ tar -zxvf vmware-any-any-update104.tar.gz
$ cd vmware-any-any-update104
$ sudo ./runme.pl

This will patch the vmware-config.pl script, the kernel modules source code and the VMware binary itself if necessary. Now you may run vmware-config.pl when prompted. Please note that for this you must install the linux-tree-2.6.xx package for your current kernel version, and the source must be unpacked under /usr/src/linux. This is supposed to work fine when you have installed just the kernel headers instead, but I always go for the full kernel because -as you may have noticed- I compile a bunch of stuff into my kernel anyway.
After module compilation vmware-config.pl will prompt for network configuration and prompt to enable the Google searchbar (!). The last lines in the configuration should be something like this:

The configuration of VMware Player 1.0.2 build-29634 for Linux for this running
kernel completed successfully.

You can now run VMware Player by invoking the following command:
"/opt/vmware-player-1.0.2-29634/vmplayer".

Enjoy,

--the VMware team

Now you may head back to VMWare’s site to download a pre-configured appliance to run in your brand-new VMware player installation. Or go to EasyVMX to build your very own virtual machine. In any case, remember to drop a line to thank VMware for releasing this kick-ass product for free!

[tags]VMware, virtualization, debian, linux[/tags]

xorg.conf configuration for nVidia TwinView on the Dell D620

I managed to get TwinView working on the Dell Latitude D620 under Debian GNU/Linux and I’ve been using it for a few weeks now without any problem whatsoever.

The key section in /etc/X11/xorg.conf is this:

Section "Device"
        Identifier      "Generic Video Card"
        Driver          "nvidia"
        BusID           "PCI:1:0:0"
        Option "TwinView"
        Option "MetaModes"                "1280x1024, 1440x900; NULL, 1440x900"
EndSection

Section "Monitor"
        Identifier      "Generic Monitor"
        Option          "DPMS"
        HorizSync       28-72
        VertRefresh     43-60
EndSection

Section "Monitor"
        Identifier      "External Monitor"
        Option          "DPMS"
        HorizSync       28-72
        VertRefresh     43-60
EndSection

I’m using an external 1280×1024 LCD, and I use the KDE control center (Peripherals/Display) to switch between metamodes. The nice thing is that whenever the X server starts and it doesn’t sense the external display it automagically defaults to using only the built-in display. Moreover, TwinView handles gracefully the “hole” below the 1440×900 display. Now what I’d really like to do is to specify that the primary monitor is the built-in display instead of the external LCD, but that can wait a bit longer.

Of course, you can download the complete xorg.conf I’m using, with my finely-tuned (right) TrackPoint and TouchPad configuration.

[tags]nVidia, TwinView, Dell, D620, Debian, GNU, Linux, Xorg[/tags]

?HOWTO:Get over subversion’s DB_VERSION_MISMATCH error

After running several updates on a particular server during the weekend, this morning I got a report that svn was down. a quick insection of libapache2-svn error log turned out this error message:

[Mon Aug 21 12:24:18 2006] [error] [client 172.26.0.73] (20014)Error string not specified yet: Berkeley DB error for filesystem /var/lib/svn/db while opening environment:\nDB_VERSION_MISMATCH: Database environment version mismatch
[Mon Aug 21 12:24:18 2006] [error] [client 172.26.0.73] Could not fetch resource information.  [500, #0]
[Mon Aug 21 12:24:18 2006] [error] [client 172.26.0.73] Could not open the requested SVN filesystem  [500, #160029]
[Mon Aug 21 12:24:18 2006] [error] [client 172.26.0.73] Could not open the requested SVN filesystem  [500, #160029]

After googling it I found out that this has been reported as Debian Bug#342508, which promptly refers you to read /usr/share/doc/subversion/README.db4.3.gz. The recipe works just fine, and I reproduce it here for completeness:

# cd /var/lib
# mv svn svn-maint
# cd svn-maint/db
# db4.2_checkpoint -1
# db4.2_recover
# db4.2_archive
# svnlook youngest ..
# db4.3_archive -d
# cd /var/lib
# chown -R www-data.www-data svn-maint
# mv svn-maint svn

In the same document there’s a note that recommends to migrate the repository from DBD to FSFS. Since I’ve seen some serious trouble with OpenLDAP’s Berkeley DB backend before and the SVN database is over 1GB right now, I’ll schedule a mainteinance window for this migration ASAP.

[tags]Subversion, Debian, BerkeleyDB[/tags]

μHOWTO: Install perl libraries in bulk

When you have to install packages that live out of dpkg, don’t you hate to install their dependencies by hand? I do.
Even though this is exactly what CPAN.pm does, there is a Debian way: If you have another machine with the correct dependencies already installed, you can use dpkg to copy those over.
For instance, this one-liner requests installation of the same Perl libraries that live in another machine:

$ ssh original.machine.com 'dpkg --get-selections'|grep '^lib.*perl'|grep 'install$'|dpkg --set-selections
$ sudo aptitude -f install

You may replace the first regexp to whatever your want (e.g. “^libapache-mod” for perl modules, “^lib.*java” for Java libraries and so on).
Gotta love Debian.
[tags]Debian, Perl, linux, apt, sysadmin[/tags]

Add swap space to Linux

This is an old sysadmin trick, but a good one all the same.
Suppose that you finished installing a brand-new Debian GNU/Linux server, and for whatever reason you forgot to set aside some space for a swap partition. Or you correctly got some swap space at installation time but now you desperately need some more. Well, despair not. It’s a little known fact that you can have swap space in a file on top of the filesystem instead of using a dedicated block device.
This simple recipe will give you 2Gb of swap space. Here we go:

# mkdir /var/swap
# chown root.root /var/swap
# chmod 700 /var/swap
# dd if=/dev/zero of=/var/swap/01.swp bs=1024 count=2M
# chown root.root /var/swap/01.swp
# chmod 600 /var/swap
# mkswap /var/swap/01.swp

Now add this newly created swap space to your /etc/fstab:

/var/swap/01.swp       none    swap    sw              0 0

Teoretically, you won’t get the same performance as using a dedicated block device, and if the file actually gets fragmented it might drop rigt to the floor, so if you try this at all do it as soon as possible after installation. So if what you’re trying to do is to *increase* your available swap space instead, you may add a priority option to give preference to the block-device swap space:

/dev/hda1              none    swap    sw,pri=1              0 0
/var/swap/01.swp       none    swap    sw,pri=2              0 0

And just this time activate the swapspace with addswap (The initscripts will do it on every boot thereafter):

# swapon -av

That’s all there is to it. I particularily like how newer BOFH generations look at this with some skepticism at first, and with endless amazement later.

[tags]Debian, GNU, Linux, swap, sysadmin[/tags]