iPhone/iPod Touch on Linux

For quite some time, using your iPhone or iPod Touch on Linux was a challenge. There were two options – jailbreak it, and connect over wifi – this would let you upload and download music, but not much else. Alternatively, you could run a Windows in a VM and do it that way – not really using it with Linux at all really. However, a project libimobiledevice allowing Linux users to use their iPhones on their OS of choice has reached the 1.0.0 release. This doesn’t mean that you can do everything on Linux with the iPhone that you can do with iTunes, but it’s getting there, and the key things are there, namely:

  • File system access
  • Music Sync with Rhythmbox or GTKPod
  • One way PIM (contacts, calendars etc) sync – device -> computer
  • USB internet tethering
  • SSH tunneling (if device is jailbroken)
  • Installing, uninstalling and archiving apps
  • Manage Springboard

Installation

 

Installation should be relatively straightforward for the mainstream distros. You will need to install libimobiledeviceifuselibplist and usbmuxd. You will also need to make sure that the version of libgpod installed is >= 0.7.90. However, are packages in the official repositories for Mandriva, Fedora and Ubuntu Lucid. There is a PPA for Ubuntu Karmic. There is also a repository for OpenSuse 11.0, 11.1, 11.2 and Factory. Alternatively, if you can’t find packages for your distro, you’ll have to compile from source. You can find the packages from here.

In addition to the above core packages, there are a few other apps that you might want to install to get full access. However, I should warn you, installing them requires you to do some hardcore compiling. You’ll need to download the source from each project’s git repository. I’d suggest you try the USB/ethernet kernel module first, as this website has a very good step by step guide to downloading the source and compiling it. You should then be able to replicate this process for ideviceinstaller (used to install/uninstall/archive apps) and for sbmanager (used to manage icons on springboard). If you’re going to install these packages, then you’ll need to install the -dev or -devel packages for libimobiledeviceifuselibplist and usbmuxd. You’ll also need to make sure you have git installed to be able to download the source.

Syncing Music

Probably the first thing you need to do is to see if libimobiledevice sees your iPhone/iPod Touch. To do so, type ideviceinfo in a terminal, while your device is attached via USB, and you should get a very long list of output. Assuming all that worked, you’ll need to mount your iPhone. I tried to mount the device at /media/ipod, which is where you would expect to find it. However, I have run into a few issues with this. I can only mount to /media/ipod as root, which means applications like rhythmbox and gtkpod can’t read or write to the device, unless they are run as root – not a great idea. So to get around this, I’ve been mounting the device at ~/ipod. To do this, type:

matt2@linux-f215 ==>mkdir ~/ipod
matt2@linux-f215 ==>ifuse ~/ipod
matt2@linux-f215 ==>ls -l ~/ipod
total 0
drwxr-xr-x 2 matt2 users   68 2010-03-20 21:24 ApplicationArchives
-rw-r--r-- 1 matt2 users    0 2010-02-04 17:31 com.apple.itdbprep.postprocess.lock
-rw-r--r-- 1 matt2 users    0 2010-02-04 17:31 com.apple.itunes.lock_sync
drwxr-xr-x 4 matt2 users  136 2010-02-04 17:32 DCIM
drwxr-xr-x 2 matt2 users  102 2010-04-12 12:07 Downloads
drwxr-xr-x 7 matt2 users  238 2010-04-10 08:59 iTunes_Control
drwxr-xr-x 2 matt2 users   68 2009-12-18 21:33 Photos
drwxr-xr-x 3 matt2 users 1768 2010-04-12 12:07 Podcasts
drwxr-xr-x 2 matt2 users   68 2010-02-04 18:32 PublicStaging
drwxr-xr-x 4 matt2 users  272 2010-03-30 21:01 Purchases
drwxr-xr-x 2 matt2 users  102 2010-02-04 17:33 Recordings
drwxr-xr-x 2 matt2 users  102 2010-03-21 06:01 Safari

Assuming you can see the iPhone’s filesystem at ~/ipod, you should be able to fire up gtkpod, specify that your iPhone is located at ~/ipod, and then sync your music from there. Unfortunately, rhythmbox looks for the iPhone to be mounted at /media/ipod. I’m still looking for a workaround for this, but at the moment you can sync music via gtkpod.

Managing Springboard

To manage the icons on the Springboard launcher on your phone, you can do this with the sbmanager program (see above). This is a pretty straightforward application, and little explanation is necessary. Check the video below.

Backup Your Phone

You can backup your phone with a simple command:

matt2@linux-f215 ==>idevicebackup backup /directory/to/backup/to

This little program will simply pull down all of the content from your phone to the directory that you specify. You can then restore this with:

matt2@linux-f215 ==>idevicebackup restore /directory/to/backup/to

Pretty simple really

Internet Tethering

Again, this is pretty simple – once you’ve got the ipheth kernel module installed (see above). To load the module, use the insmod command as root. Once the module is loaded, you should have a new network device (in my case eth0). This operates just like any other network device and you should be able to access the internets using your phone as a 3G modem.

There are other more esoteric functions available with libimobiledevice, but these aren’t really very “desktoppy” so I’ll leave those for another day.