Finally, it’s working. Mounting the iPhone in Linux over USB. No stupid (ADHOC) wireless connection is required. It also works on non-jailbrroken iPhones. Though, the developers still say that only “developers” should use it. Of course there is still a problem accessing the Media iTunes library on the iPhone – the key Apple uses on the latest iPhone firmwares has still not been discovered. But instead of using the iPod software on the iPhone, I now use the very promissing pwnplayer which is able to play music from the iPod library on you iPhone, as well as MP’3 you copied to a directory on the iPhone. MewSeek, an application for musioc downloading, works very well together with pwnplayer. JPG images from the iPhone Photo Camara can also be accessed.
The project you need to mount the iPhone in Linux is called iFuse. iFuse is a module for the FUSE(Filesystem in Userspace) system. The project contains libiphone, which is used to access USB and does the lower level translations. Unfortunately, I could not find howto’s on the projects main website. But with some googling, I found the answers.
edit: iFuse is now providing DEB and RPM packages on there website now: iFuse. See /usr/share/doc/ifuse/README of their ifuse package for usage instructions.
- Install libiphone (as root)
git clone git://github.com/MattColyer/libiphone.git- ./autgen.sh
- ./configure
- make
- make install
- Install iFuse (as user)
git clone git://github.com/MattColyer/ifuse.gi- ./autgen.sh
- ./configure –prefix=/
- make
- make install
- Generate keys (as user)
- /usr/local/bin/libiphone-initconf
(This will generate some keys required to connect with the iPhone over USB)
- /usr/local/bin/libiphone-initconf
- Mount the iPhone’s root filesystem including the Media partition (as user)
- mkdir /mnt/iPhone (make sure you have write access to the mount mount)
- mount.fuse.ifuse –afc2 none /mnt/iPhone/ -s
(The -s options seem to be related to threading/locking issues and is a workaround)
- Or mount the iPhone’s Media partition only (as user)
- mount.fuse.ifuse none /mnt/iPhone/ -s
- Or mount as root
- mount mount none -t fuse.ifuse /mnt/iPhone
- Unmounting (as user)
- fusermount -u /mnt/iPhone
- Umounting (as root)
- umount /mnt/iPhone
I have been testing this on Ubuntu Intrepid. It would be nice to see GNOME GVFS to automount the iPhone over USB. After some investigation of this matter I must conclude that UDEV, HAL, DBUS, GVFSD, GVFSD-backends are used to do the automounting in GNOME – which is quite complicated
– I could not find any scripting-hooks (or configuration options) in GVFSD to do some BASH magic and auto mount the iPhone in GNOME.
The performance, using Nautilus to copy data from/to the iPhone is:
- Write (computer-to-iPhone): ~750 KB/s
- Read (iPhone-to-computer): ~2.9 MB/s
Not bad – although writing is a bit slow compared to the avg-read time. The iPhone 2.0 seems to be connected over USB 2.0 (480 mbit/s):
T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 27 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 3 P: Vendor=05ac ProdID=1292 Rev= 0.01 S: Manufacturer=Apple Inc. S: Product=iPhone
Alternatives:
- Mounting using SSH/SFTP over ADHOC wifi connection
- iTunnel using modified libiphone
Links:
- http://brandy25.blogspot.com/2009/02/mount-iphone-in-linux-via-usb.html
- https://help.ubuntu.com/community/PortableDevices/iPhone
A small script to mimic a bit the GNOME GVFS auto mounting function:
#!/bin/sh mntp=/home/johan/mnt/iPhone if ! ( mount | grep $mntp ); then mkdir -p $mntp mount.fuse.ifuse -afc2 none $mntp -s notify-send -u normal "iPhone Mounted" "The iPhone is now mounted." nautilus $mntp else fusermount -u $mntp rmdir $mntp notify-send -u normal "iPhone Un-Mounted" "The iPhone is now un-mounted." fi
July 7th, 2009 at 08:07
Hello, I have installed iFuse through aptitude.
I have Debian Squeeze. I have been able to mount the iphone as root (both the Media partition and the root filesystem). As a note, I was able to mount the root filesystem using the –root option.
The problem I’m having is that mount.fuse.ifuse is not visible for my user. And if I access it through /sbin I get the following error:
> No iPhone found, is it connected?
> If it is make sure that your user has permissions to
> access the raw usb device.
> If you’re still having issues try unplugging the device
> and reconnecting it.
I also tried editing my fstab, but got the same results. Does anyone knows how to fix this??
Thanks for everything
July 17th, 2009 at 10:10
Hi,
In ubuntu there is in /etc/group a group ‘fuse’ which I’m member of. Maybe check that. As well as /etc/fuse.conf. Where there is an option allow_other. Fortunately Ubuntu Jaunty is mounting the iPhone automatically. In the end this is what I get from ubuntu in my mount tab:
mount.fuse.ifuse on /media/iPhone type fuse.mount.fuse.ifuse (rw,nosuid,nodev,allow_other)
Indeed –root is now used to mount the root filesystem.
Hope this helped.
July 20th, 2009 at 07:29
Hello, thanx for your reply.
Unfortunately I haven’t been able to solve my problem. I have stated my problem on the debian user mailing list. Could you please read it??: http://www.linux-archive.org/debian-user/330816-mounting-iphone-ifuse-user.html
I’m a member of the fuse group and have changed the fuse.conf file with no luck.
Any help is appreciated.
Thanx again.
July 20th, 2009 at 22:15
No problem. For the time being you could use sudo to access the device as a normal user. It’s probably an access rights problem. Does your user have rights to access the raw usb-dev and is member of the ifuse group? On ubuntu, my user is in the groups: plugdev and fuse. Don’t forget to login again if you changed groups. Did you already read /usr/share/doc/ifuse/README, as I mentioned in the post? I think it contains all the elements to understand how to setup succesfull. Another tip: try strace mount.fuse.ifuse device file mountpoint and see on which file you get an access denied or other problem. Another approach: remove all ifuse packages, and compile from SVN.
July 24th, 2009 at 20:05
I have still to compile from svn, I will try it tonight. I have read the README file and nothing works. I ran the strace command. From what I can tell I don’t have access to the usb device, here’s a copy of some of the output:
open(“/dev/bus/usb/006/002″, O_RDWR) = -1 EACCES (Permission denied)
open(“/dev/bus/usb/006/002″, O_RDONLY) = 3
ioctl(3, USBDEVFS_IOCTL, 0xbfa67610) = -1 EPERM (Operation not permitted)
close(3) = 0
open(“/dev/bus/usb/006/001″, O_RDWR) = -1 EACCES (Permission denied)
open(“/dev/bus/usb/006/001″, O_RDONLY) = 3
ioctl(3, USBDEVFS_IOCTL, 0xbfa67610) = -1 EPERM (Operation not permitted)
close(3)
I’m sorry to bother you again.. if you have any idea on how to solve this I really appreciate it.
Thanx again.
Cheers
July 24th, 2009 at 21:28
Sorry to hear that things are not working yet. The last thing I can help you with is showing you the access rights on my ubuntu system:
lsusb | grep Appl
Bus 001 Device 003: ID 05ac:1292 Apple, Inc.
ls -l /dev/bus/usb/001/003
crw-rw-r–+ 1 root plugdev 189, 2 2009-07-24 22:21 /dev/bus/usb/001/003
id
uid=xxx gid=xxx groepen=…(plugdev),…(fuse)…
ls -l /dev/fuse
crw-rw-rw-+ 1 root fuse 10, 229 2009-07-24 23:35 /dev/fuse
ls -laR /dev/usbmux/
/dev/usbmux/:
totaal 0
drwxr-xr-x 3 root root 60 2009-07-24 22:23 .
drwxr-xr-x 17 root root 4000 2009-07-24 22:23 ..
drwxr-xr-x 2 root root 80 2009-07-24 22:23 7fc71cf43355d53b36be6b601edb982b34aedd7e
/dev/usbmux/7fc71cf43355d53b36be6b601edb982b34aedd7e:
totaal 0
drwxr-xr-x 2 root root 80 2009-07-24 22:23 .
drwxr-xr-x 3 root root 60 2009-07-24 22:23 ..
lrwxrwxrwx 1 root root 20 2009-07-24 22:23 in -> ../../usbdev1.5_ep85
lrwxrwxrwx 1 root root 20 2009-07-24 22:23 out -> ../../usbdev1.5_ep04
ls -l /bin/fusermount
-rwsr-xr-x 1 root root 22064 2009-03-05 18:42 /bin/fusermount
(notice suidbit)
ls -l /sbin/mount.fuse.ifuse
-rwxr-xr-x 1 root root 14000 2009-07-03 07:46 /sbin/mount.fuse.ifuse
Good luck,
Amain
July 27th, 2009 at 16:06
Hello
I followed your instructions but I obtain when I try to mount
sudo mount none -t fuse.ifuse /iphpone/
No iPhone found, is it connected?
If it is make sure that your user has permissions to access the raw usb device.
If you’re still having issues try unplugging the device and reconnecting it.
it is a ipod touch I must add and it is connected
what can I do?
August 1st, 2009 at 01:37
I have the same permission problems with the usb-dev.
Mine shows out like /dev/bus/usb/002/012
after each unmount replug it increments the final digit
So I can never cach up with chown user:plugdev /dev/bus/usb/*.
Frustating .. has to be a way. Right?
August 2nd, 2009 at 16:46
hi,
this does not work with iphone 3g s, every time I try to mount it it says no iphone found and when hal tries to automout it I am getting error saying could not claim usb camera etc.
August 4th, 2009 at 19:40
libiphone supports the iPhone 3G S since end of June. See http://libiphone.lighthouseapp.com/projects/27916/tickets/52-patch-add-support-for-iphone-3gs
August 4th, 2009 at 19:47
@david: see http://libiphone.lighthouseapp.com/projects/27916/tickets/67-udev-rules-for-ubuntu-disable-access-for-non-root-users and maybe browse some more in the ticket system for libiphone. It should give more pointers on how to get udev / hal / usbmuxd / fuse / ifuse etc to work together.
August 4th, 2009 at 19:49
@Uwe Brauer: see http://libiphone.lighthouseapp.com/projects/27916-libiphone/tickets for tickets on libiphone. The iPod Touch should work. So probably some permission problem prevents you from using it.