Linux Box Admin
Trusted Remote Administration
logo

Tilde
What's new
Articles
Micro HowTos
About
Contact



Fresh Micros




iPod Exodus - Mac - Linux
(1 vote)
Friday, 21 July 2006
  iPod Exodus: Mac to Linux
exclusive content published on July 21, 2006

I recently installed Fedora Core 5 and wanted to use my Mac formatted (HFS+) iPod Nano with it. I had read mixed reports about iPod/Linux compatibility so I didn't expect it to be easy. The transition was mostly undemanding, but the minor problems I encountered weren't what I expected.

iPod acquisition

During my fling with the Mac earlier this year, I was impressed enough to purchase an iPod Nano. The "iPod halo effect" is supposed to work the other way around. People are supposed to buy an iPod and be so impressed they purchase a Mac. I used the HFS+ formatted Nano with iTunes and the Mac for about three months. A subsequent hardware failure on my wife's laptop caused a cascade of hardware shuffling, depriving me of the Mac. It was time for me to head back to Linux anyway, so now I'm running Fedora on my x86 laptop. Of course, I wanted to continue using the iPod.

Getting gtkpod

After reviewing iPod software for Linux, I decided to try gtkpod. It looked like a mature program that supported the 5th generation Nano. I made short work of the installation by running:
yum -y install gtkpod

ipod icon on desktop

The version that installed was 0.99.4. I attached the iPod to a USB port and it was recognized by Fedora, assigned to device /dev/sda3, and mounted at /media/disk/. There was no configuration required on my part.

I took this information, started gtkpod, and selected Edit > Edit Preferences to fill in the "iPod Mount Point" field. Next, I clicked the "Read" button and all the music on the iPod appeared in gtkpod. To this point, it was smooth sailing.

Dumping tunes to disk

I wanted to backup all the music on the iPod to disk and gtkpod made it easy. With all tracks selected, I chose "File > Export Tracks from Database" and told it where to dump the files. Soon, a complete backup of all audio files was on disk. Each file was named Artist - Track. (note: all my audio files are MP3, I don't know if the DRMed music from iTunes can be exported this way.)

Unexpected problem writing iTunes.db

The next step was to add a new track to the iPod. Since it was mounted and I could read from it, I made the mistake of thinking I could write to it. After selecting a file to add in gtkpod, I tried the "Sync" button. Instead of the new track being added, I received this message: "Error trying to write iTunes.db".

After some research, I discovered that the Linux HFS+ driver can't write to a volume with journaling enabled. From this page, I found two solutions. One was to backup the iPod and reformat it without journaling. The second option was to plug the iPod into a Mac and turn off journaling from the command line. Since I had a Mac at my disposal, that seemed like the easiest and safest choice.

The Mac won't "keep it up"

One command from the terminal in OS X can disable journaling on the iPod:
diskutil disableJournal /dev/diskXs3
where /dev/diskXs3 is the device assigned to the iPod. The "diskutil list" command shows you which device it in OS X the iPod is using. In my case, it was /dev/disk1s3.

The trouble was that seconds after I attached it to the Mac, it unmounted. Just as in Linux, when the iPod was first detected, a nice icon appeared on the desktop. Also, iTunes was automatically started and a sync was run. Since there was nothing to be updated, the Mac unmounted the iPod and the desktop icon went away.

I had no luck trying to mount it manually, even as root. There must be some elegant way to keep the iPod mounted, but I was under time pressure to get off the Mac (long story). My ugly hack was to download a couple of podcasts from iTunes to force the iPod to stay mounted long enough for me to run the command to disable journaling.

I grabbed the podcasts, readied a terminal, and triggered a sync from iTunes. This forced it to mount and gave me the time I needed. I ran the command and received a message indicating success: "Journaling has been disabled on /dev/disk1s3".

Back to Linux

In Fedora, the iPod automounted as device /dev/sda3 to /media/disk, but the directory was owned by root. I had to give myself write permissions to the directory.

After that, gtkpod was able to add tracks and write the iTunes.db with no errors. Browsing around the iPod after the sync, everything looked orderly and played correctly. Within gtkpod, I was able to edit the MP3 tags and write the changes to the iPod. I was also able to delete tracks. No muss, no fuss.

A few gtkpod tips

To play a track within gtkpod, simply select a track, right click and choose "Play Now". The default player in gtkpod is xmms, but it can be changed to any audio player in the preferences.

The default gtkpod configuration provides two sort lists in the top half of the screen. I found it confusing so I changed it by entering "1" in Edit > Edit Preferences > Display tab > Number of sort tabs.

Rhythumbox and Banshee

These applications are full featured media managers with many advanced features. I experimented a little with each to determine the state of iPod integration.

Rhythumbox could see the iPod and play the music on it, but had no obvious facility for updating it. The Banshee interface is very similar to iTunes. It recognized the iPod and gathered detailed information about it. It had a "Synchronize iPod" button to write changes, but when I tried it, I got an ominous warning that it might break the iTunes.db or make it incompatible with iTunes. I decided to save the Banshee experimentation for another day.

Podcasts

One of my favorite features of iTunes is it organizes podcasts and makes them easy to manage. You can subscribe to as many as you want and they are automatically loaded on your iPod. I didn't think I could the podcast features exactly, but I needed another program to at least retrieve them.

With many podcast clients available, there is sure to be one to your taste. As a shell script true believer, BashPodder was my choice. As you might suspect, BashPodder is written in Bash and uses various GNU utilities to track and retrieve podcasts.

BashPodder basics

BashPodder uses a configuration file, bp.conf, that contains a line for each podcast feed. When I first ran BashPodder, I trimmed the list down to a few of my favorite feeds. It creates a subdirectory based on the date (in YYYY-MM-DD format) where it stores the podcasts for that day.

It keeps a log file, podcast.log, to prevent it from downloading a podcast that has already been downloaded. The first you run it, there is no log file so it downloads all available podcasts from that feed. I am not sure how to prevent that from happening.

After that first run, BashPodder grabbed podcasts consistently and with ease. I set it up in cron to run once a day, then I uploaded each podcast using gtkpod. A healthy community has grown around BashPodder and there a number of enhancements to add features to it.

Set your iPods free

Despite a few hiccups dealing with HFS+, it was easier than expected mating the iPod with Linux. For people with a Fat32 formatted iPod, it should be painless, unless you have purchased music from the iTunes store. I don't know how iTunes DRM protected music behaves in gtkpod or Linux, so be aware of that caveat before beginning your exodus.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License.
 

Copyright © 2006,2007 Linux Box Admin.

 
My NHL fan blog