Using the iPod on Linux

Caveats:

  • This is rather Fedora Core 3 centric with dashes of Ubuntu thrown in. C’est la vie.
  • This works for me. If it breaks your iPod, you get to keep all the pieces.

Case closed.

System Overview

As a quick overview, here is my system description:

  • A generic Centrino Laptop with USB2 ports
  • Fedora Core 3 updated to latest
  • Linux 2.6.10
  • iPod 4G with 3.0.2 Firmware (Mac Formatted)
  • gtkpod 0.87.3 (self-built RPM with Evolution2 Sync scripts)

The Laptop

As mentioned above, the laptop is a fairly generic Centrino laptop (you can search for it using the ‘G200N‘ moniker on Google) which runs Linux fairly well. With the usual exception of ACPI, but that’s another tale in itself.

Fedora installed effortlessly, but the Sound Card gave me a huge amount of grief. Ubuntu, on the other hand, had the Sound Card down pat, but HAL, Dbus and Gnome-volume-manager tried to get cute. In all, then, an acceptable albeit imperfect match.

The iPod

I got my wife an iPod for Christmas last year; and the first thing I had to do, of course, was make sure that it would play nice with the system.

Since the iPod is by nature a fancy storage device, it connected just fine with both our systems; after remembering to specify ‘hfsplus’ as the file system, of course.

Most new iPods seem to preconfigured for Macs, with Windows configuration being done by the software on initial connection. While this was absolutely ideal in my opinion, it did mean that there was a couple of potential trip-holes I had to become aware of.

fdisk

The default Linux fdisk does not recognise the Mac partition table.

While this is certainly not a major issue, it can cause some confusion if you’re not aware of it. Fortunately parted does recognise the HFS table and allow you to manipulate it at need.

To be honest, you should never need this facility, but it sure is good knowing it is available.

Partitioning Differences

Due to the different ways Mac and Intel partitioning fits together, you will find that the Mac and Windows Partition numbers differ.

The Windows iPod has two partitions:

  1. /dev/sd*1 – The Firmware
  2. /dev/sd*2 – iPod Data

The Mac iPod, however, has three partitions:

  1. /dev/sd*1 – The HFS Partition Map
  2. /dev/sd*2 – The Firmware
  3. /dev/sd*3 – iPod Data

In both these cases the Firmware partition seems to be 32Mb in size, and since the is no guarantee nor, it would seem, any easy way of determining the end of the image on the physical drive you’ll have to backup the whole partition if you are planning on upgrading the firmware.

The other thing to bear in mind, of course, is that you also need to remember which Partition the Data lives on.

udev, hal & gnome-volume-manager

Both system run Gnome 2.8; and so both are also udev enabled. While this is, once again, not astrophysics, it does mean that udev needs to be configured for the iPod.

On Fedora this was as easy as creating a file named 10-ipod.rules in /etc/udev/rules.d/, containing the following:

# udev rule to create /dev/ipod</pre>
BUS="scsi", SYSFS{model}="iPod", KERNEL="sd?3", NAME="%k", SYMLINK="ipod"

One of the things this gives you, is a /dev/ipod symlink to the actual data partition on the iPod.

Ubuntu, if I recall, was not much more complicated.

gnome-volume-manager, if fortune favours you, will detect the iPod on plugin and auto-mount it for you. One thing you’ll have to be aware of is that unmounting the iPod device does not actually have the iPod give you the go-ahead to remove it from its USB umbilical. If the device unmounted successfully, though, it is quite save to unplug it.

The Firmware

My iPod arrived configured with Firmware version 3.0.1, so my first course of action was to attempt to upgrade it to version 3.0.2.

Finding the Firmware

Going to Apple‘s site, I downloaded the MacOS X .dmg disk image containing the Firmware upgrade (the latest is iPod2005-02-23.dmg as of this writing).

Since I knew that .dmg files are Disk Images used by Apple and others to distribute their installation files, my first step was to go looking for something that would convert .dmg files into something I could use. This I finally found in a Perl script called, reasonably enough, dmg2iso.

After running the downloaded Firmware .dmg file through it, I had my .iso file. Which, characteristically by now, most perversely refused to mount on loop-back. I finally figured mounting the .iso as a hfsplus file system on the loop-back device.

Next up was finding the Archive which contains the Firmware images in the Disk Image. This I tracked down to a file called “Archive.pax.gz“, located in the “iPod.mpkg/Contents/Resources/iPod*.pkg/Contents” directory within the image.

Some minor investigation later answered the next question: The file is a Gzip compressed CPIO file.

Snooping in this file finally led me to the actual firmware images in /Applications/Utilities/iPod Software Updater.localized/iPod Updater *.app/Contents/Resources/Updates/.

The naming convention of these files is a bit confusing:

Firmware-1.1.5
Firmware-10.3.0.2
Firmware-2.2.3
Firmware-3.2.5
Firmware-4.3.0.2
Firmware-5.4.0
Firmware-6.2.5
Firmware-7.2.5

But I have managed to determine that Firmware-4.3.0.2 is the new version of the 4G iPod. Strangely, the Firmware-4.3.0.2 and Firmware-10.3.0.2 files are identical; I’m not certain whether there’ll be a divergence between the two images at a later stage.

Upgrading the Firmware

Once I had the new firmware safely extracted, I could upgrade it on the iPod.

The process for this is quite simple, if slightly dangerous. Once you start the upgrade, make certain you complete it. It is very difficult to destroy an iPod, but I’ll refer you to the disclaimer at the top of the page.

My iPod is seen as /dev/sdb; I’ll be using that device in my examples.

  1. Back up your current firmware. No, I’m not joking.
    dd /dev/sdb2 ./iPod-firmware.backup
  2. Copy the new firmware onto the device:
    dd Firmware-4.3.0.2 /dev/sdb2
  3. Plug the iPod into the FireWire cable connected to the charger.

After the device boots up, you’ll be running the new release of the firmware.

Managing the Music

An iPod doesn’t mean too much without getting music onto and off of it. Fortunately that is a lot easier on Linux now…

As the cornerstone of my iPod experience, I’m glad to announce that the new version of gtkpod supports Smart playlists and all iPods bar the Shuffle. It also has wonderfully complete documentation available online at it’s site.

I use the following trio of programs to get music from CD onto iPod:

  1. Grip (with id3v2 enabled),
  2. EasyTAG 1.99.3 (once again, with id3v2 enabled) and lastly
  3. gtkpod 0.87.3 (with mpeg4ipv2 for AAC)

But, like all things, even here there are things you need to watch out for:

  • AAC/MP4 is only supported if the mpeg4ipv2 library was present when you built gtkpod.
  • The earlier versions of EasyTAG were both cumbersome and ugly.
  • Grip, by default, compiles without id3v2 support, which gets a bit sticky when you add songs with long titles.

And what about iTMS? Since I live in South Africa and neither Apple nor their iTMS deigns to acknowledge our existence, I would be unable to access it regardless. No loss there…

Problems

As Linux is very low on Apple’s list of priorities, we find ourselves left to our own resources if problems loom.

File System Corruption

One of the most frightening of potential problems on Linux is if the iPod’s file systems gets marked as dirty.

As always, the first thing to do is to not panic.

Find the hfsplusutils package (for Fedora it should be on Fedora Extras) and install.

Then, with the iPod connected, run fsck /dev/sd[ab]3. If that still doesn’t work, try hpmount /dev/sd[ab]3 followed by hpumount /dev/sd[ab]3

Problem solved. (We hope)

Leave a Reply

Your browser is out-of-date!

Update your browser to view this website correctly.Update my browser now

×