Linux and Your iPhone / iPod Touch
Not content with the roadblocks Apple had erected for users who wanted to connect to their digital devices (that they had paid for, natch), Apple decided to up the ante with its iPod Touch and iPhone series. This meant that a whole new round of reverse engineering was necessary just so that, and this bears repeating a thousand times, users could connect to a device that they paid for and actually access content they legally possess. Does that make sense to you? Me neither. Welcome to the 21st century.
First the good news - with recent developments in the libgpod library, as well as ifuse and iphone libraries, it's relatively simple to enable your Linux box for iPhone content syncing with gtkpod. The bad news is that things are still a bit rough around the edges, but I'll demonstrate the workarounds.
For the sake of this post, I was using a 2nd generation iPod Touch with firmware listed as version 2.2. The first thing to do is make sure you have a recent versions of libgpod, libusb, usbmuxd, libplist, libiphone, and ifuse installed. Below is a list of the versions you'll need. The really great news is that I found functional .debs for all of these:
- libusb 1.03
- usbmuxd 1.0.0
- libplist 0.16
- libiphone 0.9.4
- libgpod 0.7.2 (maybe - more on this later)
If you're using the most recent version of any distribution, libusb and libgpod should be fine. For the rest, add this repo to your sources.list:
deb http://ppa.launchpad.net/jonabeck/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/jonabeck/ppa/ubuntu karmic main
Then add the repo key and install some packages:
$ sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com F0876AC9
$ sudo apt-get install ifuse
$ sudo apt-get install libiphone-utils iproxy
(for some other tips, see this blog comment)
Now you should be able to connect your iPhone / Touch with a USB cable and mount it with this command:
ifuse <mount point>
You'll have to have root privileges unless you modified your user permissions as explained in the blog link above.
If you find that you're unable to mount the device with ifuse, you'll need to clone the libgpod git repository and compile from source. One thing this has that the libgpod included in Karmic does not is the automatic creation of a mount point in /media. That is, with the vanilla libgpod in Ubuntu, I had to create a directory in /media, and with the fresh from git compiled libgpod, I didn't. I honestly couldn't tell any other difference, but I was using an iPod Touch with generation 2 firmware. If you're using 3rd generation firmware, you may need the git repository regardless. In any case, if you find you need the bleeding edge libgpod, you'll need these packages: git-core, autoconf, libtool, libglib2.0-dev, intltool, gtk-doc-tools, sqlite3, libsqlite3-dev, zlib1g-dev, libxml2-dev, checkinstalldo and (if you want to be able to manage album covers) libgtk2.0-dev. Next, run this:
$ git clone git://gtkpod.git.sourceforge.net/gitroot/gtkpod/libgpod
$ cd libgpod
$ CFLAGS="-g -O0" sh autogen.sh --prefix=/usr
$ sudo make install
Now we get to disclaimer territory - the following steps will probably work fine. Then again, they may not. *Follow them at your own risk!* If I were you, I'd make a backup of whatever you like to store on your device. For the following instructions to work, you'll need to have a music library already created by iTunes. If not, you'll want to stop now and create one before proceeding.
Make sure your device is still mounted and create the iTunes_Control/Device/ directory. Next, get your device UUID and use it to create a file called "SysInfoExtended" by running
$ lsusb -v | grep -i iSerial
$ ipod-read-sysinfo-extended <uuid> <mountpoint>
The "ipod-read-sysinfo-extended" binary is included in the libgpod-common package. Without it, you'll need to compile libgpod from source.
The resulting file - iTunes_Control/Device/SysInfoExtended - should be a relatively large XML file, and should not be empty.
And now for the fun stuff - start with gtkpod. You should now be able to load your iPod Touch or iPhone and see your music database. You should also be able to sync music to your music database. You'll need to test what happens when you go back to iTunes to make sure it recognizes your newly synced music from gtkpod. Beyond basic syncing and playlists, you may run into bugs. Buyer beware :)
One thing I noticed is that, for whatever reason, my mounted iPod was not recognized by any KDE apps, including the Dolphin file manager and Amarok, even though the 'df' command showed that it was definitely there. In Gnome, Nautilus did recognize the newly mounted volume, although rhythmbox, like Amarok, still couldn't find the iPod. I attribute this to the fact that this is still fairly fresh code and multimedia software hasn't quite adopted to volumes mounted by ifuse.
For more details and lots of great commentary, see this blog post at marcansoft.com, which was the inspiration for this post and the source of my info.