Translation(s): English - Français - Castellano


This page is intend to describe how devices running Apple's iOS operating system (such as the iPhone and iPod Touch) are supported in Debian (DebianSqueeze). For simplicity, both devices will be referred to as an iPhone. This page does not describe any support for running Debian on the iPhone or the iPod Touch.

Note: Apple doesn't support GNU/Linux for syncing an iPhone, and there seem to be very, very few alternatives to Apple's tools.

This page is still an early draft, some information contained in this page may be inaccurate or even wrong.

(Obviously, contribution to this page are welcome).

Programs

Tools

Tools and programs useful to iPhone users in debian

Orphan:

Syncing music to an iPhone or iPod Touch

These instructions explain how to set up your iPhone so that you can sync (copy music) from Debian Squeeze using a program such as Rhythmbox. Once configured, your iPhone will work on any GNU/Linux machine, without having to rerun these instructions.

1. Prepare the iPhone

1. Create an initial audio database, if one does not exist already.

Add at least one song with iTunes using Microsoft Windows, which creates a database on the iPhone which is needed for the rest of the instructions to work. [There may be a way to copy an initial database file using only Debian; if you know how, please edit this wiki page.]

Alternatively, downloading a free podcast via iTunes on the iPhone itself should suffice.

2. Install packages

On Debian Squeeze

Install the following packages :

aptitude install rhythmbox-plugins libimobiledevice-utils ifuse libplist-utils python-plist gvfs-backends gvfs-bin gvfs-fuse

3. Configuration

  1. Edit the file /etc/fuse.conf:

    • Change the line #user_allow_other at the end of the file to user_allow_other. Or add user_allow_other if the line doesn't exist.

    (Tip: configuration files in etc can only be edited by "root", so you'll need to use sudo. For example, sudo gedit /etc/fuse.conf)

  2. Add the users who will have access to the iPhone to the group fuse using Gnome's Menu System → Administration → Users and Groups (or a command like adduser franklin fuse).

  3. Log out and log back in. This is needed because your gnome session was started before your account was added to the "fuse" group, and so it will not be able to run programs that require group "fuse" permissions.
  4. Connect the iPhone. Hit Cancel if you are asked if you wish to open it as a camera to import pictures.

  5. The iPhone appears on the desktop, with its name ("iPhone of someone"). It's mounted in your home directory in the .gvfs subdirectory. For example, if your username was franklin, it would be mounted at /home/franklin/.gvfs/iPhone of Someone/.

On Debian Squeeze (unnecessary on Wheezy)

  1. Now it's necessary to create the file SysInfoExtended on your iPhone so that applications such as Rhythmbox can use it. In a terminal, do the following:

    1. Create a directory named Device on the iPhone :

      mkdir -p "~/.gvfs/iPhone of someone/iTunes_Control/Device"

      (Tip: Use "tab completion" to save typing. After typing ".gvfs/iP", try hitting the TAB key and the shell will finish typing out "iPhone of someone" for you.)

    2. Obtain the serial number of the iPhone :

      lsusb -v | grep -i iSerial
      The command returns several lines, and one of them will look like :
      iSerial                 3 fb9961044533cd317cb6f2bce3424c2771ae16d6
      In this example the serial number is : fb9961044533cd317cb6f2bce3424c2771ae16d6
    3. Create the file SysInfoExtended in the Device directory with the command ipod-read-sysinfo-extended (supplied by libgpod4) :

      ipod-read-sysinfo-extended fb9961044533cd317cb6f2bce3424c2771ae16d6 ~/.gvfs/iPhone of someone/
      Replace, of course, the serial number and the mount point by the real ones for your machine. Note that the above command is all one long line, despite how it may appear in your web browser.

      (Tip: Double-clicking on a word, such as fb99blahblahd6, in the terminal will highlight it. Clicking once with the middle mouse button in the terminal will paste whatever is highlighted as if you had typed it.)

      [This operation fails with Squeeze version of libgop4 (0.7.2-2+b1), we have the following message : Couldn't read xml sysinfo from _SERIAL_]

On Debian Squeeze or Wheezy

  1. Log out and log back in again. (It's not clear why this is necessary, but may fix the problem if you get an error when attempting to mount the along the lines of "Error: DBus error org.freedesktop.DBus.Error.?ServiceUnknown: The name :1.41 was not provided by any .service files".)

  2. Launch Rhythmbox, Applications → Sound and Video → Rhythmbox. The iPhone should be on the left part. You can now Drag-and-Drop files, as you may be familiar with in iTunes.

4. Done!

You can now use Rhythmbox on any computer to copy/paste music and without having to destroy the playlist, unlike iTunes. You will not need to run these steps again.

5. script it !

after step 3.3 you can use the following script to mount/unmount the iphone. Once mounted just open rhythmbox and the iphone should pop up. I use this method for iphone+fluxbox.

1. install libnotify to have desktop notifications:

2. use the following script to mount and unmount the iphone

#                               -*- Mode: Sh -*-
#!/bin/sh
# iphone ---
#
# Filename: iphone
# Description:
# Author: Mohamed Ahmed
# Created: Wed Dec  1 11:50:01 2010 (+0100)
# Version:
# Last-Updated: Wed Dec  1 17:20:40 2010 (+0100)
#           By: Mohamed Ahmed
#     Update #: 105
# $HeadURL$
#
#

# Change log:
# $Date$
# $Revision$
# $Id$
#
#

function get_device_ids(){
    ## get the Apple vendor id (idVendor) from lsub
    idVendor=`lsusb -v  2> /dev/null  \
        | grep Apple | grep idVendor | awk '{print $2}'`

    if [ -z "$idVendor" ];  then
        echo "idVendor is null - unkown/non-Apple device -- exit"
        exit
    fi

    # get the device serial number (iSerial)
    iSerial=`lsusb -v -d ${idVendor}: \
        | grep iSerial | awk '{print $3}'  | tr -d ' '`

    if [ -z "$iSerial" ];  then
        echo "iSerial is null - unexpected format .. fixme"
        exit
    fi
}

function is_mounted(){
    res=`gvfs-mount -l | grep -i mount | \
        head -1 | awk '{print $4}' | cut -b7- | cut -d/ -f1  | tr -d ' '`

    [[ "$res" == "$1" ]] && mntd=1 || mntd=0
}


function _mount(){
    ## now gvfs mount the device
    gvfs-mount afc://$1/

    # notify the user
    # echo "mouted iphone $iSerial"
    notify-send -t 4000 -u normal "iPhone" \
        "mouted iphone :$1" \
        -i "/usr/share/pixmaps/apple-green.png"
}

function _unmount(){
    ## now gvfs unmount the device
    gvfs-mount -u afc://$1/

    # notify the user                                                           
    # echo "unmouted iphone $iSerial"                                           
    notify-send -t 4000 -u normal "iPhone" \
        "unmouted iphone :$1" \
        -i "/usr/share/pixmaps/apple-red.png"
}

if [ $# != 1 ]; then
    echo "Usage: iphone <mount/umount>"
elif [ "$1" == "mount" ]; then
    get_device_ids
    is_mounted $iSerial

    if [[ $mntd -eq 1 ]] ; then
        # echo "device $iSerial is already mounted"
        notify-send -t 4000 -u normal "iPhone" \
            "device $iSerial is already mounted"
        exit
    else
        _mount $iSerial
    fi

elif [ "$1" == "unmount" ]; then
    get_device_ids
    is_mounted $iSerial

    if [[ "$mntd" -eq 1 ]] ; then
        _unmount $iSerial
    else
        # echo "device $iSerial is not mounted"
        notify-send -t 4000 -u normal "iPhone" \
            "device $iSerial is not mounted"
        exit
    fi
else
    echo "unknown option $1"
    echo "Usage: iphone <mount/umount>"
    exit
fi

# iphone ends here


CategoryPhone