Mounting an iPhone to Linux Mint as an external drive to copy images and videos

 

Phone: iPhone SE
Operating System: Linux Mint 18.1(should work in Ubuntu as well)

It is done by compiling most of the sources yourself.
Only one library - usbmuxd - must be installed as root
All others are installed in the home account.

Install necessary software for building the source packages.

To check-out and compile the needed packages from source, you have to install git first.

Open a terminal and do the following:

:~$ sudo apt-get install -y git
:~$ sudo apt-get install -y build-essential
:~$ sudo apt-get install -y libtool m4 automake
:~$ sudo apt-get install -y libfuse-dev

All new commands to mount and unmount the file-system of your iPhone, will be installed in the sub-directory "${HOME}/usr/bin/".

Create the sub-directory to store the source files of the packages to be compiled:

:~$ mkdir -p "$HOME/usr/src"

Set all required environment variables to ensure to build the packages from source as desired:

 
:~$ export PKG_CONFIG_PATH="${HOME}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
:~$ export CPATH="${HOME}/usr/include:${CPATH}"
:~$ export MANPATH="${HOME}/usr/share/man:${MANPATH}"
:~$ export PATH="${HOME}/usr/bin:${PATH}"
:~$ export LD_LIBRARY_PATH="${HOME}/usr/lib:${LD_LIBRARY_PATH}"

Now put the last two export statements into your .bashrc, to be loaded every time you open a new terminal, otherwise you must type:

:~$ export PATH="${HOME}/usr/bin:${PATH}"
:~$ export LD_LIBRARY_PATH="${HOME}/usr/lib:${LD_LIBRARY_PATH}"

whenever you open a new terminal.

Clone all needed repositories from Github.

:~$ cd ~/usr/src
:~$ for x in libplist libusbmuxd usbmuxd libimobiledevice ifuse; do git clone https://github.com/libimobiledevice/${x}.git;done


Build and install the packages in the following order.

Build libplist
:~$ cd ~/usr/src/libplist
:~$ ./autogen.sh --prefix="$HOME/usr"
:~$ make && make install

Build libusbmuxd
:~$ cd ~/usr/src/libusbmuxd
:~$ ./autogen.sh --prefix="$HOME/usr"
:~$ make && make install

Build libimobiledevice
:~$ cd ~/usr/src/libimobiledevice
:~$ ./autogen.sh --prefix="$HOME/usr"
:~$ make && make install

Build usbmuxd
(The package usbmuxd must be installed with administrative rights, because it needs write access to "/lib/udev/rules.d" and "/lib/systemd/system")
:~$ cd ~/usr/src/usbmuxd
:~$ ./autogen.sh --prefix="$HOME/usr"
:~$ make && sudo make install

Build ifuse
:~$ cd ~/usr/src/ifuse
:~$ ./autogen.sh --prefix="$HOME/usr"
:~$ make && make install


TESTING

It's assumed that you put the two exports into your ~/.bashrc as mentioned above.
Open a new terminal.

Connect your iPhone

Create a mount point, where you want the content of your iPhone to appear.

:~$ mkdir -p ~/usr/mnt


Connect your iPhone to the computer and try to pair the iPhone with your computer.

:~$ idevicepair pair


If error occurs during validation, please enter the passcode on the device and retry. A trust dialog will be appeared on your device. You have to accept it as well

:~$ idevicepair pair


After successfully pairing the device, mount the file-system of your iPhone and check the content

:~$ ifuse ~/usr/mnt/
:~$ ls ~/usr/mnt/


To safely disconnect your iPhone, you have to unmount the file-system in ~/usr/mnt first with fusermount.

:~$ fusermount -u ~/usr/mnt


Now, you can plug-off your iPhone again.


ERRORS AND SOLUTIONS

(1) configure: error:
OpenSSL support explicitly requested but OpenSSL could not be found

:~$ sudo apt-get install libssl-dev

(2) configure: error:
Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
(You probably have to install the development version of the Python package for your distribution.  The exact name of this package varies among them.)

:~$ sudo apt-get install python-dev


Post a Comment

0 Comments