Ubuntu / Linux news and application reviews.

Update: This article is no longer up to date. See this instead: Easy Way To Sync Your iPhone With Rhythmbox, Nautilus, Etc. In Ubuntu

We wrote a quick guide on how to mount your Ipod / iPhone in Ubuntu but that was for Jaunty. Also, it seems that's not working for everyone. So Web Upd8 reader StoneCut wrote a complete (see this huge comment) how-to, for mounting your iPhone on a "virgin" (fresh install) Ubuntu Karmic Koala and I decided to post it here so more people would be able to find it (thank you, StoneCut).

First off, apply all available system updates for Karmic Koala:
sudo apt-get update && sudo apt-get upgrade

Now, let's get started !

Open a terminal (Applications -> Accessories -> Terminal) and type this:
sudo gedit /etc/apt/sources.list

Add this at the end:
## Custom sources for iFuse and other iPhone stuff
deb http://ppa.launchpad.net/jonabeck/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/jonabeck/ppa/ubuntu karmic main

Save and exit.

Get Repo Key and install iFuse and Utils via Terminal:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com F0876AC9
sudo apt-get update && sudo apt-get install ifuse
sudo apt-get install libiphone-utils iproxy

Also reload UDEV rules with the new device rules in a terminal (you can do a reboot to be sure, too):

sudo udevadm control --reload-rules

Connect your iPhone and check if usbmuxd got launched automatically (it should be once you connect your iPhone, if not try a reboot):
ps ax | grep usbmuxd

We can now run a test whether SSH via USB is already possible. Run this in one terminal window (this will map local port 2222 to your iPhone's SSH Port 22):
sudo iproxy 2222 22

Run a test whether you can SSH-connect to your iPhone via USB now in another terminal window:
ssh -p 2222 root@localhost

Ok, let's make the mountpoint for our iPhone (we need this particular mountpoint for GTKpod):
sudo mkdir /mnt/ipod
sudo chmod 777 /mnt/ipod/

Let's edit a config file.
sudo gedit /etc/fuse.conf

-> Remove the "#" in front of "user_allow_other", save and exit.

Next, open "System" -> "Administration" -> "Users and Groups" in Ubuntu Menu. Click on the little key at the bottom to unlock it for making changes. Then, select your username and click on "Manage Groups".

Find the "fuse" group and double-click on it. Make a checkmark next to your name in the window that opens. Click on OK and close all dialogs. You're now in the "fuse" group.

Next, completely log out and in again - do a reboot to be safe. This is important !

Open up a terminal again. Let's verify we're really in the "fuse" group:

-> You should see some group names, among them should be "fuse".

We can now mount the phone as regular user after connecting it (run "ps ax | grep usbmuxd" -without the quotes - to verify that usbmuxd is listening if you want):
ifuse /mnt/ipod/

We can also unmount as regular user (a sudo shouldn't be necessary):
fusermount -u /mnt/ipod/

Ok, now let's compile libgpod4, but first we probably need to install 'git':
sudo apt-get install git-core

We'll also need to install all these packages in order to be able to compile our source:
sudo apt-get install autoconf libtool libglib2.0-dev intltool gtk-doc-tools sqlite3 libsqlite3-dev zlib1g-dev libxml2-dev checkinstall libiphone-dev libgtk2.0-dev

Alright, let's grab the libgpod4 source via GIT:
git clone git://gitorious.org/~marcan/libgpod/marcan-sandbox/
cd marcan-sandbox/
git checkout origin/iphone30
CFLAGS="-g -O0" sh autogen.sh --prefix=/usr

Ok, let's compile the source:

Before we can create and install our new package, we need to get rid of the "original" libgpod first:
sudo apt-get remove libgpod-common

Ok, let's create a DEB out of our new libgpod4 package and install it:
sudo checkinstall

Just hit Enter at the question "Should I create a default set of package docs ?".

Next, enter a description, for example "Libgpod4 SVN", then hit ENTER and ENTER again on the new line to end editing the description.

Now enter "2" and hit ENTER to edit the package name. Type in "libgpod4" and hit ENTER.

Now, choose "11" and hit ENTER. Type in "libgpod4" again and hit ENTER.

Finally, enter "3" and hit ENTER. Type in this as version: "0.7.3" and hit ENTER again.

When you're back just hit ENTER without any numbers and the package will be compiled and installed. (If you want to remove it later type in "dpkg -r libgpod4" (without the quotes).

Ok, now mount the device with "ifuse /mnt/ipod/" (if not still mounted) and create the "iTunes_Control/Device" directory:
mkdir /mnt/ipod/iTunes_Control/Device/

Then, get your UUID:
lsusb -v | grep -i iSerial

It's the first number and should be 40 characters long. Then, run:
ipod-read-sysinfo-extended <uuid> <mountpoint>

(mountpoint here is /mnt/ipod/)

This should generate a file named iTunes_Control/Device/SysInfoExtended.

Make sure it’s not empty and whatnot; it should be a large-ish plist (XML file) with a bunch of info.

Now, we can just install GTKpod (make sure it doesn't try to install any other libgpod stuff)
sudo apt-get install gtkpod

Mount the iPhone:
ifuse /mnt/ipod/

Next, launch GTKpod.

It should show your device, click on "Load Ipod(s)" and you will be able to see that GTKpod indexes your songs on the iPhone in the status bar. Once done, it will display the contents. Do not worry about all the debug information that gets displayed to you - it's only for developer purposes and troubleshooting).

You can now fill up your iPod app with music using GTKpod. Don't forget to safely remove the device via right-click in GTKpod when you're done. The next time you launch the iPod app it will take a little while to update the database but then you're set. The reason for this is that libgpod is currently for OS 3.0, so if you sync with 3.1.2 then the iPhone will need to update the database when you launch the iPod app. Apparently the key for 3.1.2 music db is discovered, though, so this minor inconvenience should go away at some point in the future.


Please note: In order to be able to access your iPhone it should NOT BE LOCKED !