# Will FreeBSD mount my iPhone?



## Anthie (May 16, 2013)

Will be there a driver for iPhone?


----------



## drhowarddrfine (May 16, 2013)

Don't you need to ask Apple this?


----------



## fonz (May 16, 2013)

If your iPhone has an SD card you can probably insert that into any card reader and mount it. Also, chances are that when you connect your iPhone to your computer using a USB cable, the entire phone is actually recognised as a USB drive, but I wouldn't know for sure because the only [Aa]pples I ever touch are the ones you can actually eat.


----------



## sk8harddiefast (May 16, 2013)

Yes. Is possible. Install from ports sysutils/fusefs-ifuse and then run `sudo ifuse -o allow_other <the folder path were you want to be mounted>`. Worked for me and copied all my pictures from iPhone to my FreeBSD


----------



## ccc (Sep 7, 2013)

sk8harddiefast said:
			
		

> Yes. Is possible. Install from ports sysutils/fusefs-ifuse and then run `sudo ifuse -o allow_other <the folder path were you want to be mounted>`. Worked for me and copied all my pictures from iPhone to my FreeBSD



I've installed sysutils/fusefs-ifuse from ports and now if I try to mount an iPhone 5 connecting via USB on my FreeBSD 8.3, then I get this error:

```
[CMD]# usbconfig[/CMD]
ugen0.1: <UHCI root HUB VIA> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen1.1: <UHCI root HUB VIA> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen2.1: <UHCI root HUB VIA> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen3.1: <UHCI root HUB VIA> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen4.1: <EHCI root HUB VIA> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen0.2: <USB Multimedia Keyboard LITEON Technology> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen0.3: <Optical USB Mouse Logitech> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
[HIGHLIGHT]ugen4.2: <iPhone Apple Inc.> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON[/HIGHLIGHT]

[cmd]# ifuse -o allow_other /mnt/ipod[/cmd]
[HIGHLIGHT]usbmuxd_get_device_list: error opening socket![/HIGHLIGHT]
No device 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.
```


----------



## sk8harddiefast (Sep 7, 2013)

Try as root or using sudo.


----------



## ccc (Sep 7, 2013)

sk8harddiefast said:
			
		

> Try as root or using sudo.



*A*s root:
	
	



```
/root # ifuse -o allow_other /mnt/ipod
fuse: failed to open fuse device: No such file or directory

/root # ifuse -o allow_root /mnt/ipod
fuse: failed to open fuse device: No such file or directory
```


----------



## sk8harddiefast (Sep 7, 2013)

I'm not sure, but I think that when you do all this process, the iPhone must be unlocked. Try this and if it does not work even like this, tomorrow I will search to find out what happens.


----------



## ccc (Sep 7, 2013)

Yep, I still get this problem:


```
/root # usbconfig
ugen0.1: <UHCI root HUB VIA> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen1.1: <UHCI root HUB VIA> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen2.1: <UHCI root HUB VIA> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen3.1: <UHCI root HUB VIA> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE
ugen4.1: <EHCI root HUB VIA> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE
ugen0.2: <USB Multimedia Keyboard LITEON Technology> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen0.3: <Optical USB Mouse Logitech> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
[HIGHLIGHT]ugen4.2: <iPhone Apple Inc.> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON[/HIGHLIGHT]

/root # idevicepair unpair && idevicepair pair
usbmuxd_get_device_list: error opening socket!
No device found, is it plugged in?
/root #
```


----------



## ccc (Sep 8, 2013)

I've tried to mount an iPhone 5 on Linux (Debian/Wheezy) and it works well:
	
	



```
root@wheezy:~# ifuse /media/ipod
root@wheezy:~# ls /media/ipod
AirFair  Books	Downloads	PhotoData	  Purchases   Safari
Airlock  DCIM	iTunes_Control	PhotoStreamsData  Recordings
```
but I still cannot find a solution for FreeBSD.


----------



## wblock@ (Sep 8, 2013)

Have you enabled FUSE in /etc/rc.conf, or at least loaded the kernel module?


----------



## ccc (Sep 8, 2013)

wblock@ said:
			
		

> Have you enabled FUSE in /etc/rc.conf, or at least loaded the kernel module?



I have already 
	
	



```
fusefs_enable="YES"
```
in /etc/rc.confand fuse.ko is loaded:


```
/root # kldstat
Id Refs Address    Size     Name
 1   26 0xc0400000 c68d94   kernel
 2    1 0xc1069000 8190     snd_via8233.ko
 3    2 0xc1072000 57908    sound.ko
 4    1 0xc5ebb000 8000     linprocfs.ko
 5    1 0xc5ec3000 28000    linux.ko
 6    1 0xc6267000 e000     [HIGHLIGHT]fuse.ko[/HIGHLIGHT]
 7    1 0xc6388000 68000    radeon.ko
 8    1 0xc63f1000 14000    drm.ko
```
but still it doesn't work.


----------



## KNOStic (Sep 9, 2013)

I can help here, I've even written a script for it as well as a devd configuration file for all sorts of iDevices to load automagically. But before I do, just ensure that you have /usr/local/sbin/usbmuxd loading in your rc.local file - that needs to load first, then you need to also have 
	
	



```
fusefs_enable="YES"
```
 in your rc.conf.

The ifuse library wants to run as user rather than root as well as I discovered the hard way when you make those calls, but it is absolutely necessary to have the device unlocked first before you connect it to the USB port. With these measures, it should work for you as it does reliably for me.

If anyone is interested in the fruits.conf file that I wrote up to notify a script to run to automount as well as configure the ue0 Ethernet device within is here:


```
#
# $FreeBSD: release/9.1.0/etc/devd/fruits.conf 000044 2013-03-19 07:06:00Z kmcaleavey $
#
# Discover, mount, unmount newer iFruit products. Adds to usb.conf. Requires iphone script from KNOS Project
#

notify 20 {
	match "system" "USB";
	match "subsystem" "DEVICE";
	match "type" "ATTACH";
	match "vendor" "0x05ac";
	match "product" "(0x1290|0x1292|0x1294|0x1297|0x129c|0x12a0|0x12a8|0x1291|0x1293|0x1299|0x129e|0x129a|0x129f|0x12a2|0x12a3|0x12a4|0x12a5|0x12a6|0x12a7|0x12a9|0x12ad)";
	action	"su -m KNOS -c 'bash /var/home/KNOS/iphone'";
};

notify 20 {
	match "system" "USB";
	match "subsystem" "DEVICE";
	match "type" "DETACH";
	match "vendor" "0x05ac";
	match "product" "(0x1290|0x1292|0x1294|0x1297|0x129c|0x12a0|0x12a8|0x1291|0x1293|0x1299|0x129e|0x129a|0x129f|0x12a2|0x12a3|0x12a4|0x12a5|0x12a6|0x12a7|0x12a9|0x12ad)";
	action	""su -m KNOS -c 'bash /var/home/KNOS/iphone umount'";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x129c";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x12a0";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x12a8";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x12a2";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x12a3";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x12a5";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};

nomatch 32 {
	match "bus" "uhub[0-9]+";
	match "mode" "host";
	match "vendor" "0x05ac";
	match "product" "0x12a6";
	match "intclass" "0xff";
	match "intsubclass" "0xfd";
	match "intprotocol" "0x01";
	action "kldload -n if_ipheth";
};
```

Simply place this fruits.conf into your /etc/devd directory and it will control mounting and unmounting automagically for you by calling a script which you will need to write (shown below) for it to call.

PLEASE NOTE: The script called "/var/home/KNOS/iphone" above needs to be replaced with YOUR script to do the calls.

My iphone script (called by the above) is as follows:


```
#!/bin/sh
#
# Copyright (c) Kevin McAleavey 2007, 2009 - 2013
#

DISCONNECT="$1"

if [ "$DISCONNECT" = "umount" ] ; then
umount -f /media/AppleDevice
sleep 5
su -m root -c "rm -fd /media/AppleDevice"
logger "AppleDevice removed ..."
exit 0

else

logger "AppleDevice called here ..."
su -m root -c "mkdir -p /media/AppleDevice"
idevicepair unpair && idevicepair pair && idevicepair validate
	if [ "$?" = "1" ] ; then
zenity --error --title "AppleDevice loader" --text="Device mount FAILED!!!\n\nCheck to be sure that the device is unlocked and turned on.\nPlease unplug it, wait 5 seconds, and try plugging it in again."
	fi
su -m root -c 'chown KNOS /media/AppleDevice'
logger "AppleDevice call done ..."
sleep 2
ifuse /media/AppleDevice
	if [ "$?" = "1" ] ; then
zenity --error --title "AppleDevice loader" --text="Device mount FAILED!!!\n\nCheck to be sure that the device is unlocked and turned on.\nPlease unplug it, wait 5 seconds, and try plugging it in again."
	fi
fi
exit 0
```

All of this is used in the GNOME desktop on our machines and works magnificently in automounting it since the normal gvfs system won't mount it on its own.

Hope this helps!


----------



## mnd999 (Jan 26, 2016)

Anyone still using this? I'm trying to copy some photos from my iPhone 6S, and it just doesn't work. 

When you connect the FreeBSD is able to copy a few photos, but rapidly gives up and /mnt/ipod just returns "Input/output error (5)" with any attempt to access it thereafter. Sometimes it will remount, mostly it refuses giving an unable to connect to lockdownd error.

Really frustrating, it seems like we have something that almost kinda works.


----------



## tankist02 (Jan 27, 2016)

My workaround: install FileBrowser app on iPhone/iPad. Configure FTP server on FreeBSD. Point FB to the server and can copy files between iPhone and computer.


----------

