More About the iPod and the Penguin

Learn how to get the most out of your iPod with Linux.

I’m a bit of a latecomer to the iPod and portable digital music player craze, but I recently purchased a 60 GB iPod and now I’m hooked. It’s hard to resist bringing your entire music collection with you on the go.

Of course, I quickly found myself wanting to sync my iPod with my favorite operating system, the Penguin. Alas, I discovered that if you’re an iPod owner who likes to use it with any system other than Mac or Windows, you’re a third class citizen (at best). But fear not, my fellow aquatic bird lovers, you can get your iPod working with Linux. However, the road is winding and some obstacles must be overcome.

Getting Started

I assume that most of you have a 2.6- based version of Linux. If not, I suggest you get one, otherwise the entire exercise that follows is a no-go. I’ve tested all this stuff with SuSE Linux 10, Ubuntu 5.10 “Breezy”, Debian 3.1 “Sarge”, and Fedora Core 4 and Core 5.

With a suitable distro booted up, connect your iPod to it’s USB cable, and connect your USB cable to your PC. If you’re running the GNOME desktop, you’ll probably see a iPod icon appear on your desktop, and if you click into it, you’ll be able to browse the directory structure on your iPod and copy files back and forth. (See Figure One.)

FIGURE ONE: Browsing an iPod from GNOME

In KDE, provided you have the kio_ipodslave (http://kpod.sourceforge.net/ipodslave/) package installed, you should similarly be able to browse your iPod in Konqueror via ipod:/ or media:/.

Within the Linux file system itself, the iPod should be mounted automatically in /media/ipod. Furthermore, you can type dmesg at a terminal prompt and look for messages that resemble Figure Two. If your iPod’s been detected and attached as an emulated SCSI device, you’re all set.

FIGURE TWO: dmesg detects iPod hardware

usb-storage: device found at 5
usb-storage: waiting for device to settle before scanning
Vendor: Apple Model: iPod Rev: 1.62
Type: Direct-Access ANSI SCSI revision : 00
SCSI device sdc: 117210240 512-byte hdwr sectors (60012 MB)
sdc: Write Protect is off
sdc: Mode Sense: 6c 00 00 08
sdc: assuming drive cache: write through
SCSI device sdc: 117210240 512-byte hdwr sectors (60012 MB)
sdc: Write Protect is off
sdc: Mode Sense: 6c 00 00 08
sdc: assuming drive cache: write through
/dev/scsi/host7/bus0/target0/lun0: p1 p2
Attached scsi removable disk sdc at scsi7, channel 0, id 0, lun

Now, Doing Something Useful

Great! Your iPod is now a removable hard disk. How about syncing up your music collection, your favorite podcasts, and your picture library? That’s coming, but I’m warning you, this stuff isn’t totally baked yet, and a number of workarounds are required.

Why is getting your iPod synced to your favorite music and podcasts such a pain? Even though the iPod is recognized as a USB storage device in most newer versions of Linux, you can’t just take your .mp3 files and dump them onto your iPod and expect them to play. While the iPod works as a removable hard disk just fine and is fully usable under Linux just like any other USB mass storage device, the iPod has an internal database and a proprietary directory structure and layout that must be created and maintained to play music.

And unfortunately, there’s no standardized interface to the iPod on Linux. There’s no universal library, no agreed upon programming interfaces, nada. Connecting to the iPod requires reverse-engineering, and each open source project for the iPod has implemented support in its own unique way.

To add insult to injury, if you use different sync programs with the same iPod, you can scramble your resident iTunes database, requiring you to re-initialize your iPod and re-sync your whole song library. Hence, if you choose to use any open source iPod programs, you’ll want to stick with the one that best suits your purposes and not mix and match.

Sync Software

gtkpod is an iPod synchronization application written with the GTK tool set, and it’s a pretty robust application. If you’re using Ubuntu Breezy (with “Universe” enabled in your /etc/apt/sources.list) or Debian, you can install gtkpod from the terminal window with a quick sudo apt-get install gtkpod. If you’re using Red Hat or Fedora Core, you can download binaries from the gtkpod web site at http://www.gtkpod.org.

(Alternatively, if you want to actually build the software from source, you’ll need gcc and the GTK development libaries, the libgpod source from the gtkpod project page, and the libid3tag source from the MPEG Audio Decoder project at http://www.underbit.com/products/mad/. Unpack all of the source code and run ./configure, make, and make install in each source code directory to generate a working install of gtkpod. If you’re using a 64-bit Linux, you might need to copy or symlink libgpod.so.0 from /usr/lib64/ to /lib64 before gtkpod will run.)

gtkpod is particularly useful for initializing a virgin iPod fresh out of the box, because gtkpod knows how to create the directory structures that iTunes creates. Choose “Edit& gt; Preferences” and verify that the mount directory for the iPod is specified as /media/ipod. (By default, it might be set to /mnt/ipod, which is the older standard.) Then select “File& gt; Create iPod’s Directories” from the main menu to initialize the device.

Another good iPod sync program is YamiPod (http://www.yamipod.com). I particularly like YamiPod because it’s a self-hosting program, it’s a single executable, it’s pre-built (it’s not open source), and it depends on a single library that comes with the software, libfmodex, which needs to be copied to /usr/lib/. YamiPod is also multi-platform, so you can download a version for Windows and the Mac as well, should you need to share your iPod between several different machines, like your Mac at home and your Linux or Windows box at work. Using YamiPod across the three platforms precludes corruption of the database.

YamiPod does pretty much everything gtkpod does, but it also has some advanced capabilities, such as a feature to repair or recover an iPod file and a feature to backup and restore the iTunes database. I also find YamiPod’s folder and file synchronization more straightforward than gtkpod’s. Using YamiPod, once you set up the folders that you want to sync to your iPod, it’s easy to keep your iPod up-to-date.

iPod-Aware Media Players

In addition to dedicated synchronization software, there are a handful of Linux media players that also support the iPod and can simultaneously act as your synchronization client.

amarok is an extremely sophisticated and mature multi-format media player written for KDE. amarok is able to sync music files to your iPod using the kio_ipodslave library, and is also able to perform more advanced tasks, such as file conversion (.ogg to .mp3). amarok also has many scriptable plug-ins.

On Ubuntu (again, with the Universe repository turned on) and Debian, amarok can be installed with sudo apt-get install amarok. On Fedora, if you do a complete install with the “Extras” disc, or with a complete SUSE 10 install, amarok should be immediately usable.

Banshee (http://www.banshee-project.org/) is a relatively new GNOME media player sponsored by Novell/Ximian and the Mono project. If you’re running SUSE Linux 10, you can install Banshee simply by going into YAST2 and searching on “banshee”. The Banshee Project “Getting Started” page (http://banshee-project.org/Getting_Started) has a list of other distros and how to get the software working on them. However, Banshee is still “betaware,” so it’s still relatively buggy. Also, be advised that Banshee has a lot of dependencies, so unless you’re a seasoned software developer and understand the intricacies of Mono, don’t even try building it from source.

Podcast Aggregation

While Yamipod, amarok, and Banshee have podcast subscription management built-in, the implementation is rudimentary: Using any of the three tools, you can add the URL of the XML RSS file of the podcast to your download list and sync it directly to your iPod.

For more sophisticated Internet-aware Podcast directory support along the lines of what iTunes provides, you’ll want to look at something like CastPodder. CastPodder (http://www.castpodder.net, pictured in Figure Three) is the Linux-based fork of the multi-platform Juice Receiver (http://juicereceiver.sourceforge.net), which was based on the original iPodder concept by podcast pioneer Adam Curry (http://en.wikipedia.org/wiki/Adam_Curry). If you want to find podcasts on the Internet and have the richest possible podcast listening experience on Linux, CastPodder should be on your download list. It’s a robust application that’s really easy to use.

FIGURE THREE: The CastPodder podcatcher application

Strictly speaking, CastPodder doesn’t interact with your iPod. Instead, it downloads podcast files to user-specified directories on your Linux system, which in turn can be synced to your iPod by software like gtkpod, YamiPod, amarok, and Banshee (although CastPodder’s developer, Scott Grayban, plans to support direct iPod syncing of podcasts in the future.) CastPodder is written in Python and uses wxypython (http://www.wxpython.org/) to provide the GTK user interface.

After downloading the CastPodder software, make sure you have the proper dependencies. On Ubuntu and Debian systems, those can be installed with the command sudo apt-get install python python-xmms bittorrent python-wxgtk. On Red Hat and SUSE, you’ll need to install the same subsystems, although the filenames may differ.

Uniquely, at least so far, CastPodder has direct access to many different third-party podcast directories, from which you can browse and choose podcasts to subscribe to, much like iTunes. Indeed, most of the podcasts available on iTunes are accessible from CastPodder, too.

iPod Photo Support

If you’ve got one of the newer iPod’s that has photo sync and photo viewing, there aren’t a lot of options for Linux — it’s an area that’s sorely lacking at the moment, and iPod video support is totally nonexistent. Nevertheless, I did find a nice little Java application, OpenPhotoPod (http://openphotopod.sourceforge.net/), that has basic support for photo galleries and automates the transfer and conversion of photos to the iPod.

Simply download and extract the OpenPhotoPod tarball to a directory, and run its run.sh shell script. Of course, since it’s written in Java, you’ll need a Java Virtual Machine installed, such as the open source jit or Sun’s Java 5.0.

iTunes on Linux

Finally, with a bit of black magic, you can actually get iTunes itself to run on Linux. The first method involves the use of CodeWeavers Crossover Office (http://www.codeweavers.com/) to run the Windows version of iTunes under CodeWeavers’s implementation of WINE. According to CodeWeavers’s documentation (http://www.codeweavers.com/site/support/docs/crossover-pro/troubleshooting# ITUNES-IPOD), a bit of tweaking is required to make iTunes work properly, but it sounds like a worthwhile effort.

The second method, which I’ve actually tested and verifed, is to use the free VMWare Player (http://www.vmware.com/player/) to run a full copy of Windows XP virtualized within Linux. Add the line usb-storage to the /etc/hotplug/blacklist file, attach a USB 1.1 hub to the Linux box, and and then attach the iPod to the hub.

The latter, Rube Goldberg-esque setup has its shortcomings, though. By blacklisting the usb-storage kernel module and reserving its access to VMware, you can’t use any of the application software discussed in this article. Effectively, your iPod is disconnected from your Linux system and only viewable from within your Windows XP VMware virtual machine.

Unfortunately, any other device that uses usb-storage is also disconnected, including your multimedia film readers, USB keychains, USB CD-ROM readers and writers, USB hard drives, and so on. Additionally, because of VMware’s current USB implementation, it only supports transfers at USB 1.1 speeds, and because of kernel issues, you can’t just directly connect your iPod to your Linux box — you have to use a USB 1.1 hub.

Still, if you find the VMWare solution to be attractive, you should check out my previous article on VMWare Player on the Linux Magazine web site at http://www.linux-mag.com/content/view/2433/43/.

Jason Perlow is a longtime contributor to Linux Magazine. You can reach Jason at class="emailaddress">jperlow@linux-mag.com.

Comments are closed.