tulrich.com
☰ Menu+  instagram  tuffy  ringing ear  rentals 

geekstuff | gameswf | Textweb | Chunked LOD | dumbuild

Cheat sheets: CVS | cygwin | Debian | Emacs | MythTV

Debian tricks

Note on these tips: the fact that these notes exist at all points to usability problems with Debian. These problems should be fixed, and hopefully that will happen. Meanwhile, Debian has a reputation as being a difficult distro for Linux newbies. Ironically, I find that Debian is actually the easiest Linux distro to use. The really big usability problems, IMO, are:

Nevertheless, in my experience Debian is still miles ahead of OS's I have used (including Windows) for general usability and maintainability, once you've inhaled the Kool Aid.

On to the tips.


Don't use dselect

For installing and removing software, dselect is hard to use. I recommend any or all of:

How to get back to Gnome when the Linux gremlins have somehow switched you to KDE

I think there are some lurking scripts that randomly mess with this setting on my laptop, just to test my sanity. There's nothing more dismaying than typing "startx" and seeing the wrong desktop manager show up. Google is useless for finding the solution, which it turns out is very simple:

# update-alternatives --config x-session-manager

Then select gnome-session or kde2 or whatever floats your boat. "startx" should now do what you want it to.


Some important menu-driven configuration commands, in case you entered the wrong stuff during install

# modconf        # install kernel modules, e.g. for your oddball network card
# base-config	 # timezone and some other stuff, followed by package config
# dpkg-reconfigure xserver-xfree86      # X Windows settings
# alsaconf       # try to autodetect your sound card (if you installed ALSA)

DNS and such

For DHCP, make sure to install "dhcp-client"

My /etc/network/interfaces looks like this; this sets up the first Ethernet card to do DHCP:

# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
# first network card
auto eth0
iface eth0 inet dhcp

Kick it into action using "ifup eth0"

As far as I can tell, DHCP is supposed to automatically put entries in resolv.conf (to set up your DNS servers) and possibly /etc/hostname as well. For some reason that didn't work for me on my last install; it might be some deficiency with my DHCP server, which is a LinkSys broadband router. Anyway, I had to hack /etc/hosts to make it look like this:

127.0.0.1 localhost
127.0.0.1 sheep.winthrop.tulrich.com sheep

I'm not sure if that's 100% kosher; it seems wrong to use 127.0.0.1 as the host address, instead of the IP address from eth0, but it seems to work for me.


Sound notes

These relate to ALSA. ALSA is the latest sound driver tech for Linux. You need to install these packages:

alsa-base
alsa-modules-XXXXX  (where XXXXX is your kernel version)

Then, to detect your sound card and set up the kernel modules, you run

alsaconf

If you're like me, alsaconf didn't work quite right; you might have to do the following:

ln -s /etc/alsa/modutils/1.0 /etc/modutils/alsa
update-modules

That'll probably be fixed by the time you read this.

When everything is working, you should see "snd-pcm", along with a bunch of other snd-* modules, in the output of "lsmod". "snd-pcm" is the wave output driver, AFAIK.

Permissions: by default, normal users don't have access to the audio devices. Pretty annoying, but oh so secure... I guess if you're running a server this might marginally make some sense. Anyway, an easy solution is to add users to the audio group:

adduser <username> audio

Your group settings won't be updated for existing processes, so you may have to log out and back in to be able to play sounds.


CDROM

The installer seemed to put the right entry in fstab for me. However, by default, the permissions on /dev/cdrom are set so that only root can access the CDROM; fix that with:

chmod 666 /dev/cdrom

On another machine, /dev/cdrom disappeared after I upgraded to kernel version 2.6.8. I eventually discovered, after much fruitless poking into the intricate world of udev, that I just needed to add the line "ide-cd" to the file /etc/modules . WTF?


NVIDIA video cards

The default drivers work fine, but the 3D isn't fast. You need to install:

nvidia-kernel-common
nvidia-glx
nvidia-glx-dev   (if you're going to do any OpenGL development)
nvidia-kernel-XXXXX    (where XXXXX is your kernel version)

Then you probably need to do "dpkg-reconfigure xserver-xfree86" and choose "nvidia" instead of "nv" as your video driver.

If you're wondering if it worked, try running "glxgears"; the animation should be smooth.

If your kernel version does not have an nvidia-kernel-XXXXX package, then you must build a version of the module from source. Scary? Actually it isn't, due to the magic of "module-assistant"! Install:

nvidia-kernel-source
module-assistant

Run "module-assistant", and you will get a curses UI that handles all the details. Choose "SELECT", then mark the nvidia-kernel module and press OK, then choose "BUILD", and magic should happen.


Compiling kernel modules

In general, if you need to compile a kernel module from source, try module-assistant first. If you run a stock kernel, like me, then also install kernel-headers-XXX for your kernel. If the module sources have Debian packages, you may be able to do it entirely from the module-assistant UI. If they don't have Debian packages, then download the sources to /usr/src/modules/..., run module-assistant and select "PREPARE" to set up all your symlinks, and then "cd /usr/src/modules/some_module_xxx" and then "make install".


Hooking up your iPod

This can be done beautifully, so it's all automated and works even better than on Windows. "gtkpod" is the name of the app that you will use to manage the iPod. The other magic words are: 2.6 kernel, udev, autofs, hotplug. There are some instructions out on the net to describe the autofs part, so that the iPod is mounted automatically when you plug it in and access /mnt/ipod, and is unmounted automatically after 2s of idle time.


Wireless G

I bought a Netgear WG311NA PCI card, which uses the Texas Instruments ACX111 chipset. Apparently this is a fairly common 802.11g chipset. I ran into various troubles getting it to work. The first problem I had is that I tried to install the wrong driver. Apparently there's an earlier version of the Netgear WG311 that uses a different chipset supported by the madwifi driver. My googlings had convinced me I needed madwifi. I compiled and installed madwifi, only to belatedly discover, when it didn't work, that my card does not use that driver. Lesson: pay attention to the output of "lspci", to identify the chipset; don't rely on Google and manufacturer model numbers.

Note: I discovered that if you're running a 2.6 kernel, you don't need "linux-wlan-ng". Uninstall it, and don't waste your time trying to compile the modules from source, like I did... Do install "wireless-tools" though; this gives you "iwconfig", "iwlist", etc.

So there's an open-source driver for this card, at http://acx100.sourceforge.net . I compiled and installed it, using Craig's excellent HOWTO at http://www.houseofcraig.net/acx100_howto.php . The good news is that installation went relatively smoothly, and that the driver works. The bad news is, no WEP (encryption) support! I must have WEP.

It turns out that there's another way to get this card up, using ndiswrapper from http://ndiswrapper.sourceforge.net. ndiswrapper is an open-source wrapper that sits between the Linux kernel and the manufacturer's Windows driver for the card. I have no philosophical problem with wrappers or emulators for drivers, especially if it saves me from having to go exchange a card. Compilation of the CVS sources and installation went very smoothly here as well, with one glitch: after doing "modprobe ndiswrapper", "dmesg" showed the following error:

[...]
ndiswrapper (NdisMAllocateSharedMemory:990): Failed to allocate DMA
 coherent memory. Windows driver requested 409600 bytes of un-cached memory
ndiswrapper (ndis_init_one_pci:1510): Windows driver couldn't initialize
 the device
[...]

Fortunately I found the solution here http://thread.gmane.org/gmane.linux.drivers.ndiswrapper.general/3121 , which is to add these lines to /etc/sysctl.conf, and run "sysctl -p" to update the settings:

kernel.shmmax = 67108864
kernel.shmall = 67108864

Then "rmmod ndiswrapper" and "modprobe ndiswrapper" to re-load the driver; the dmesg errors are gone, and "iwconfig" shows my card under "wlan0".

My /etc/network/interfaces has this in it:

iface wlan0 inet dhcp
   wireless_mode managed
   wireless_rate 54M auto
   wireless_channel 6
   wireless_essid XXXXX
   wireless_key XXXXXXXXXX

(Replace the X's with your values) Then, "ifup wlan0" brings the interface up, "ifdown eth0" to turn off the wired interface, and I'm on the net without a wire.

Whew. That was way too much work!

tu@tulrich.com |