Pages

September 22, 2008

Samba: passwords

Samba drove me nuts until I figured out that it keeps its own database of passwords. In other words, for each user that you intend to permit access for in Samba, you must also create a password. It's easy enough to do:

sudo smbpasswd -a <username>

but if no one tells you this, you will go nuts trying to figure it out. Not even the official Samba HOW-TO gives you a decent clue about this.

Apparently, you can set Debian Etch up to sync Samba and user passwords, but I haven't gone there yet.

September 20, 2008

Music Playing Daemon: setup

I've been having way too much fun with MPD lately. It is now my default tool for music listening at home. I am using Music Player Minion, Ario, and QMPDClient on my Windows laptop to control the server, gmpc as a Linux GUI client (Etch doesn't have Ario or QMPDClient), mpc for terminal one-offs, and ncmpc for SSH sessions. Phew. I haven't gotten around to trying Bluetooth devices, etc. It's all quite cool.

As with many things Linux, setting up MPD can be a bit confusing. Below I describe my current setup, which was designed for a reasonable but not paranoid amount of security. It's all quite geeky. If you are not capable of this level of geek, you might want to stay away from MPD until you are.

I will assume that you have already installed MPD and (optionally) Samba. You can point MPD at any directory for it's source of music. Since it's a server and gets launched at system startup (at least in Debian Etch and therefore SkinnyDebbie), I decided the best place to store files is in a system directory rather than directory inside a user's home directory.

So here's what to do:

Make a group called music:

sudo groupadd music

Now create a directory to store your music collection -- I suggest /srv/media/music. Set the directory to be owned by mpd and of the music group:

sudo chown mpd:music /srv/media/music

Note: The group name created above does not need to match the directory name.

Set /srv/media/music so that members of the group music have write permission and all other have read permission:

sudo chmod 775 /srv/media/music

Note: /srv and /srv/music need to have their read and execute bits set for everyone. This will happen by default on most systems, but if this isn't the case in your case:

sudo chmod 755 /srv
sudo chmod 755 /srv/media


Edit /etc/mpd.conf so that MPD points to the new directory
music_directory         "/srv/media/music"
playlist_directory "/srv/media/music"
While you are in /etc/mpd.conf, to make MPD is reachable by clients outside the localhost, comment out the line:
bind_to_address    "localhost"
by placing a # in front of it. Now is also the time to set a MPD server password if you want one, change its port number, etc.

Add users you want to be able to manage the music collection to the "music" group

sudo usermod -a -G music <username>

Note: the user must logout and log back in for changes to take effect.

Optional: if you are using Samba to share files on the network, create a share called "Music" and make it fully public by adding to /etc/smb.conf:
[Music]
path = /srv/media/music
browseable = yes
read only = no
Linux's underlying permissions will keep members who are not in the "music" group from writing to the directory. Note that whatever you copy into this folder will be owned by the user who copied it in. Therefore permissions must allow MPD to read all files. This will happen by default on most systems, but if you have problems you can check this.

Be sure to update the MPD database when you add new music:

mpc update

You might consider is setting up a cron job to periodically update the database.

September 16, 2008

Oldschool wireless

There's a really good guide to setting up WiFi without using NetworkManager at http://ubuntuforums.org/showthread.php?t=202834.

Why would you want to do this? Because when you do, the wireless LAN connection comes up automatically when you boot the machine. This is a really good idea if you are running any servers (e.g., the outrageously fun MPD). Of course it's a really bad idea to run a server off a wireless connection whether it comes up automatically or not, but sometimes you just can't snake cables where you want your machine to be. And if you're not running any servers, it spares you the bother of having to type in connection authorization at login. If you do a lot of roaming, then giving up NetworkManager (or the similar netapplet) may not be such a great idea; but if you don't, this approach may save you from some bother.

The only things I would add to what is posted in the Ubuntu forum are:
  1. You can include more that one interface in the /etc/network/interfaces file.
  2. If you use a network interface card that is removable (PCMCIA, USB, etc.) you may get better results if you specify it as allow-hotplug rather than auto.
  3. If you do specify an interface as allow-hotplug rather than auto, issuing the
    sudo /etc/init.d/networking restart
    command won't bring up the interface(s). To do that you will need to issue
    ifup < the_name_of_the_interface >
My main SkinnyDebbie test machine has one PCMCIA slot and no built-in networking. I tend to swap out a wireless and a wired Ethernet card. My /etc/network/interfaces file looks like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
#auto eth0
iface eth0 inet dhcp

allow-hotplug ath0
#auto ath0
iface ath0 inet dhcp
wpa-driver madwifi
wpa-ssid ufart
wpa-ap-scan 1
wpa-proto WPA
wpa-pairwise TKIP
wpa-group TKIP
wpa-key-mgmt WPA-PSK
wpa-psk <>
Of course, your details will differ.

September 09, 2008

MadWifi and SkinnyDebbie

My main SkinnyDebbie test machine is an Acer TravelMate 508T laptop. It has no built-in Ethernet. I don't think I need to say that it has no built-in WiFi. It has one PCMCIA slot.

I use a 3Com OfficeConnect 10/100 LAN adapter card (PCMCIA) for Ethernet connectivity. I've never had to do anything special to make the lappy's networking go with any Linux distribution I have tried. It just works "out of the box." I also have a D-Link DWL-G630 WiFi card (also PCMCIA). It works "out of the box" in Xubuntu, but not in SkinnyDebbie. This is a summary of how I got it to work.

I bought the D-Link card because it was listed as Linux compatible at http://linux-wless.passys.nl/ (and because of favorable comments at Newegg). The site says that my card is compatible with MadWifi drivers--drivers that have been developed to support Atheros chipsets. The process below is adapted from MadWifi's own newbie installation guide; however, I had to do some extra stuff and not do some other stuff to make it go in SkinnyDebbie. I expect that the instructions below will work for any MadWifi-compatible card. There are lots of little steps here, none of which are large or complicated, but all of which add up to some tedium. Sorry about that.

Preparation
  1. I started with my wired Ethernet card in the laptop. The WiFi card was not physically in the machine.
  2. Verify that your WiFi card is compatible with the MadWifi drivers at http://linux-wless.passys.nl/. Be sure to check the vendor/product code of your card as well as the product ID because manufacturer's routinely change chipsets in their cards without changing model numbers! If it's not listed as working with MadWifi, then don't install the MadWifi drivers.
  3. Open a terminal and type:
    sudo aptitude install network-manager network-manager-gnome
    This will install a network management system and notification tray applet that takes a lot of the headache out of setting up and signing on to WiFi networks.
  4. When that's done, type
    sudo aptitude install module-assistant build-essential
  5. When that's done, type
    sudo m-a update
    sudo m-a prepare

    The above will install the header files needed to build the MadWifi drivers.
  6. When that's done, type
    geany ~/.icewm/startup
    In the text editor window that opens, right after the line
    xscreensaver -no-splash &
    add the line
    nm-applet --sm-disable &
    Save the file and exit Geany.
Build and install drivers
  1. Download the drivers from the Madwifi home page. I used v0.9.4. If something doesn't work in what follows, it may be because of a version change.
  2. In ROX-Filer, navigate to the *.tar.gz file you downloaded and double click on it to extract it.
  3. Open a terminal and navigate to the directory where you extracted the package. (This may be a good time to get to know ROX-Filer's Window -> Terminal here command or it's keyboard shortcut, `.)
  4. Type the following in the terminal:
    sudo ifconfig ath0 down
    sudo ifconfig wifi0 down

    You will probably get warnings or errors. Don't worry about them.
  5. Now type the following:
    cd scripts
    ./madwifi-unload
    ./find-madwifi-modules.sh $(uname -r)
    cd ..

    This removes any old modules, which you almost certainly don't have anyway. We are now ready to build the drivers.
  6. Still in the terminal, make sure you are at the top level of the downloaded and extracted MadWifi directory and type:
    sudo make
    sudo make install

    Both of the above may take some time. You should not see errors. If you do, curse the Linux gods and give up.
  7. Type:
    sudo geany /etc/modules
    In the text editor window that opens, add the following line to the bottom:
    ath_pci
    Save the file and exit Geany.
  8. Logoff and power down the computer. Replace the wired Ethernet adapter card with the WiFi adapter card.
  9. When you start the computer and login again, you should see a new icon in the notification tray. When you click on it, you will be able to select and sign into available WiFi networks
There remains one minor problem with this setup: every time you reboot your computer and login, you will be prompted to re-enter the passphrase for the network you want to join. Improving on this situation is probably possible, but it's not something I am going to tackle right now. If I do, you'll read about it here.

SkinnyDebbie and the Macintosh PowerPC

I tried loading SkinnyDebbie onto an old Macintosh Cube.

"Linux on PowerPC?" you ask? And at 450 MHz? Debian is one of the few distributions that officially supports the PowerPC architecture. And SkinnyDebbie on i386 at 500Mhz works just fine. So it seemed natural to try.

It worked. In fact, I am really happy not just that it works but also with how well it works. So far I have found only four gotchas--two having to do with SkinnyDebbie and two having to do with Larger Issues. The SkinnyDebbie ones are easy to fix. The Larger Issues are not.

First the SkinnyDebbie stuff:

IceWM's network traffic monitor doesn't work. This is caused by the fact that (at least on my Cube), eth0 gets assigned to FireWire networking and eth1 to Ethernet. The fix is easy: open ~/.icewm/preferences and add eth1 to the list of monitored network devices in the NetworkStatusDevice field. When you restart IceWM, you should now see the network traffic monitor. (Make the same change as root to the corresponding file in /etc/skel to make the change happen for new users as well.)

The volume control is batty. The Cube uses a USB sound card and SkinnyDebbie is currently using ALSA. It turns out that Debian Etch doesn't play perfectly with this combination--on either PowerPC or i386 platforms. I'll say more about this in a later post, but the fix is again simple: use gnome-alsamixer or aumix-gtk instead of alsamixergui and comment out the volume changing hotkeys in ~/.icewm/keys.

And now for the Larger Issues:

Flash is very limited. Adobe doesn't make a version of Flash for Linux on the PowerPC. Why would they? There are a couple open source alternatives--Gnash and Swfdec--but neither will do Flash video. So, no YouTube on PowerPC Linux for you. It's just not possible in any PowerPC Linux at the moment. The best workaround is to download videos with any of the million YouTube download services and then watch them in VLC.

Java is at best a PITA. Sun doesn't make a version of the Java Runtime Environment for Linux on the PowerPC. If you want/need Java, the best workaround seems to be GCJ and its bundled GIJ interpreter. I have had success in compiling command-line apps from scratch in GCJ, but I have not had success with GUI apps using GIJ. This definitely needs more research to see just how viable a solution it is.

I am hoping Lenny (the next Debian release, due later this month) works as well as Etch on this hardware. Should it be enough to make you abandon Mac OS? Given that the next OS X release may not support PowerPC, you might think so. But this isn't really a good enough reason since maintenance support for older OS X releases will likely continue for quite a while. The decision to switch in this case needs to be made based on what you want from the OS and operating environment. OS X is certainly more polished and easier to use than SkinnyDebbie. But it costs more and doesn't let you run at least one thing that makes Linux really attractive.