个人工具

“UbuntuHelp:PortableDevices/iPhone”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第289行: 第289行:
 
See below.
 
See below.
 
== Syncing iPhones and iPods Touch w/ Firmware 2.x ==
 
== Syncing iPhones and iPods Touch w/ Firmware 2.x ==
Apple has encrypted the library database on the latest firmware, and as such the above approach will not work. Apparently using the above approach will transfer the music, but Apple's music player on the iPod will not recognize any of the transferred files. The solution, then, is to use another music player on the iPod. Use the steps below to wireless transfer music to your iPod and play it using a third party app called PwnPlayer.
+
Apple has encrypted the library database on the latest firmware, and as such the above approach will not work. Apparently using the above approach will transfer the music, but Apple's music player on the iPod will not recognize any of the transferred files. The solution, then, is to use another music player on the iPod. Use the steps below to wireless transfer music to your iPod and play it using a third party app called [[UbuntuHelp:PwnPlayer|PwnPlayer]].
 
=== Syncing with Firmware 2.x possible! ===
 
=== Syncing with Firmware 2.x possible! ===
 
''' Actually, you can edit /System/Library/Lockdown/Checkpoint.xml, find the DBVersion key, and change its value from 4 to 2 (MAKE A BACKUP FIRST!!!).  See http://marcansoft.com/blog/2009/01/using-amarok-and-other-itunesdb-compatible-software-with-the-iphone-2x/.  This allows you to sync with libgpod, as well as any apps that use libgpod (Tested with Amarok and gtkpod:  it works fine, except that podcasts cannot be synced (sunk?). Music syncs just fine. Rhythmbox doesn't seem to recognize it though). '''
 
''' Actually, you can edit /System/Library/Lockdown/Checkpoint.xml, find the DBVersion key, and change its value from 4 to 2 (MAKE A BACKUP FIRST!!!).  See http://marcansoft.com/blog/2009/01/using-amarok-and-other-itunesdb-compatible-software-with-the-iphone-2x/.  This allows you to sync with libgpod, as well as any apps that use libgpod (Tested with Amarok and gtkpod:  it works fine, except that podcasts cannot be synced (sunk?). Music syncs just fine. Rhythmbox doesn't seem to recognize it though). '''
 
Use the guide above for further configuration.
 
Use the guide above for further configuration.
 
=== Setting up the iPod or iPhone ===
 
=== Setting up the iPod or iPhone ===
<ol><li>Make sure your iPod is jailbroken. QuickPwn works well for 2.x firmware, and a quick Google search will point you to directions (Unfortunately, you'll need to borrow a Windows or a Mac machine for the jailbreaking, but after that, it's Ubuntu all the way). In the process of jailbreaking, make sure to select the option that installs Cydia (Cydia is a front-end for the [http://www.saurik.com/id/1 iPhone's apt port]).
+
<ol><li>Make sure your iPod is jailbroken. [[UbuntuHelp:QuickPwn|QuickPwn]] works well for 2.x firmware, and a quick Google search will point you to directions (Unfortunately, you'll need to borrow a Windows or a Mac machine for the jailbreaking, but after that, it's Ubuntu all the way). In the process of jailbreaking, make sure to select the option that installs Cydia (Cydia is a front-end for the [http://www.saurik.com/id/1 iPhone's apt port]).
</li><li>On your newly jailbroken iPod, update Cydia and [http://www.instructables.com/id/S9CQ5TEFNZA8J0O/ install OpenSSH through it]. PwnPlayer is also recommended by some users but you should note that it's not necessary as you'll still be able to play your music on the standard iPod application of your iPhone if you synchronize with this method.</li></ol>
+
</li><li>On your newly jailbroken iPod, update Cydia and [http://www.instructables.com/id/S9CQ5TEFNZA8J0O/ install OpenSSH through it]. [[UbuntuHelp:PwnPlayer|PwnPlayer]] is also recommended by some users but you should note that it's not necessary as you'll still be able to play your music on the standard iPod application of your iPhone if you synchronize with this method.</li></ol>
  
 
=== Transferring Music ===
 
=== Transferring Music ===
 
<ol><li>In Ubuntu, select Places>Connect to Server. In the dropdown box labeled "Service type," select "SSH". In the "Server" field, input your iPod's ip address (this can be found on your iPod by going to Settings>Wi-Fi>arrow-next-to-SSID-of-network-you're-connected-to). Finally, under username, enter "mobile". Leave other fields blank. Click connect.
 
<ol><li>In Ubuntu, select Places>Connect to Server. In the dropdown box labeled "Service type," select "SSH". In the "Server" field, input your iPod's ip address (this can be found on your iPod by going to Settings>Wi-Fi>arrow-next-to-SSID-of-network-you're-connected-to). Finally, under username, enter "mobile". Leave other fields blank. Click connect.
 
</li><li>When it asks for a password, enter "alpine" (this can--and should--be changed, see below).
 
</li><li>When it asks for a password, enter "alpine" (this can--and should--be changed, see below).
</li><li>You should now have your iPod mounted on your desktop, and can transfer music onto it. The default location for PwnPlayer's filesystem music player is /var/mobile/Media/Music. Simply copy and paste music into this directory.</li></ol>
+
</li><li>You should now have your iPod mounted on your desktop, and can transfer music onto it. The default location for [[UbuntuHelp:PwnPlayer|PwnPlayer]]'s filesystem music player is /var/mobile/Media/Music. Simply copy and paste music into this directory.</li></ol>
  
 
=== Playing Music with standard iPod application ===
 
=== Playing Music with standard iPod application ===
第307行: 第307行:
  
 
=== Optional: Playing Music with PwnPlayer ===
 
=== Optional: Playing Music with PwnPlayer ===
<ol><li>On your iPod, open PwnPlayer (select the icon labeled "Player").
+
<ol><li>On your iPod, open [[UbuntuHelp:PwnPlayer|PwnPlayer]] (select the icon labeled "Player").
 
</li><li>Select "File system" from the choices on the bottom of the screen ("Library" does not contain your music).
 
</li><li>Select "File system" from the choices on the bottom of the screen ("Library" does not contain your music).
 
</li><li>You should see all your music
 
</li><li>You should see all your music
第317行: 第317行:
 
*There is also a root user on your iPod, and it is advisable to change that password as well. Follow the directions above, but use "ssh root@<ipod's_ip_address>" in the terminal.
 
*There is also a root user on your iPod, and it is advisable to change that password as well. Follow the directions above, but use "ssh root@<ipod's_ip_address>" in the terminal.
 
*You can also transfer music from the terminal using scp, but I'm sure you already know how to do that ; )
 
*You can also transfer music from the terminal using scp, but I'm sure you already know how to do that ; )
*You can change the location of the music in PwnPlayer by going to "Featured" and selecting "Settings" in the top left hand corner.
+
*You can change the location of the music in [[UbuntuHelp:PwnPlayer|PwnPlayer]] by going to "Featured" and selecting "Settings" in the top left hand corner.
*I've only tried PwnPlayer with mp3's. I do not know if it works with other music files.
+
*I've only tried [[UbuntuHelp:PwnPlayer|PwnPlayer]] with mp3's. I do not know if it works with other music files.
*Lastly, given that PwnPlayer is basically a file browser, it's much easier to find the song you want if your music's file structure is organized. I recommend you organize your Music folder on your computer using Amarok before transferring any music.
+
*Lastly, given that [[UbuntuHelp:PwnPlayer|PwnPlayer]] is basically a file browser, it's much easier to find the song you want if your music's file structure is organized. I recommend you organize your Music folder on your computer using Amarok before transferring any music.
Finally, note that PwnPlayer is still beta, so it might have a few bugs.
+
Finally, note that [[UbuntuHelp:PwnPlayer|PwnPlayer]] is still beta, so it might have a few bugs.
 
=== Converting/Watching Videos ===
 
=== Converting/Watching Videos ===
 
If you want to convert videos for use on the default iPhone video player, Handbrake is a good choice (there's now a native Linux GUI version available) -- it is now accepting any video input to create a Apple-compatible video file.  
 
If you want to convert videos for use on the default iPhone video player, Handbrake is a good choice (there's now a native Linux GUI version available) -- it is now accepting any video input to create a Apple-compatible video file.  
第328行: 第328行:
 
</li><li>Install mplayer4iphone through Cydia
 
</li><li>Install mplayer4iphone through Cydia
 
</li><li>Install WinFF on Ubuntu (Medibuntu repository) through Synaptic
 
</li><li>Install WinFF on Ubuntu (Medibuntu repository) through Synaptic
</li><li>Now convert your videos using WinFF. Use these settings: 480x320, 15fps, XVid in AVI. It's crucial to keep the fps to 15, since 24fps, etc. was jerky for me. Here's my preset for WinFF if you want to create one: -r 15 -vcodec libxvid -vtag XVID -s 480x320 -aspect 4:3 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2
+
</li><li>Now convert your videos using WinFF. Use these settings: 480x320, 15fps, XVid in AVI. It's crucial to keep the fps to 15, since 24fps, etc. was jerky for me. Here's my preset for WinFF if you want to create one: -r 15 -vcodec libxvid -vtag XVID -s 480x320 -aspect 4:3 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv -trellis 1 -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2
 
</li><li>Once you have your video converted, connect to your iPhone using the SSH method detailed above. This will open a window showing your iPhone file structure.
 
</li><li>Once you have your video converted, connect to your iPhone using the SSH method detailed above. This will open a window showing your iPhone file structure.
 
</li><li>Mplayer needs your videos to be in this folder: root/var/media. Just drag your video files to that folder.</li></ol>
 
</li><li>Mplayer needs your videos to be in this folder: root/var/media. Just drag your video files to that folder.</li></ol>

2009年5月18日 (一) 17:25的版本

  1. title Using an iPhone or iPod Touch with Ubuntu

Warning: While this guide works fine for most users, making unsupported changes to your iPhone or iPod Touch is done at your own risk and could result in data loss and possibly void your warranty. Follow this guide with care. There are multiple techniques listed here. Review the table of contents and select the one suitable for your situation.

Using iTunes via Sun Virtualbox running Windows

Overview

This technique allows you to sync using the official iTunes application. All functionality is available, although this author hasn't tried firmware updates. <!> This method uses a number of proprietary components, and therefore isn't free. Do not do this unless you have a legitimate Windows license and agree with the licensing to all the software: Windows XP, Virtualbox etc. This information is sourced from a number of locations - thanks to these contributions:

Steps

  1. Add the Virtualbox repository and key as detailed on this page. Select the repository matching your distribution and add to `/etc/apt/sources.list` file. For example, the Intrepid Ibex line is:
    deb http://download.virtualbox.org/virtualbox/debian intrepid non-free 
    
    Now add the key for this repository.
     
    wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add - 
    Now update your apt cache:
    sudo apt-get update
  2. Remove the package `virtualbox-ose`:
    sudo apt-get autoremove virtualbox-ose 
    Now install the latest Virtualbox, at the time of writing this is version 2.2.
    sudo apt-get install virtualbox-2.2 
  3. Add your username to the `vboxusers` group. Don't forget to substitute your username:
    sudo gpasswd -a YourUserName vboxusers 
  4. We new entry in the file '/etc/fstab' to correct USB permissions. To do this, first you need to know what the group id (GID) is for the group `vboxusers`. Run this command:
    sed '/vboxusers/!d;s/vboxusers:x:\(.*\):.*/\1/' /etc/group
    The output should be a number. Now edit `/etc/fstab` and add the following line, but make sure you set the `devgid=` number to the output of the previous command.
    none /proc/bus/usb usbfs devgid=123,devmode=664 0 0 
  5. You can now start up Virtualbox, located under SystemSun Virtualbox . Create a new machine; the wizard will guide you, the details are outside of the scope for this howto. Within the settings for the machine, ensure both "Enable USB Controller" and "Enable USB 2.0 (EHCI) Controller" are ticked. You can also add a filter to make the iPhone/iTouch automatically pass thru here, otherwise you will have to manually select and enable it when plugged in.
  6. Install Windows and iTunes in the VM. Windows XP and iTunes 8 is known to work. The Virtualbox guest addons are also recommended for performance and integration, but are not explicitly required. Again, the details of this are outside of scope, but are straightforward.
7. Boot the VM, plug in iPhone (and select it to be passed thru via the VM menu if you didn't add a filter before) and confirm iTunes detects it. All systems go for iLaunch!

Troubleshoot

  1. iTunes error 0xe8000035: Windows sees the iPhone correctly, and attempts to download pictures, but iTunes doesn't connect correctly. One cause of this is `MAX_USBFS_BUFFER_SIZE` being too small in `/drivers/usb/core/devio.c`. The author had this problem in Hardy Heron. Here is how to recompile "only" this module for Hardy (thanks to remainder comment 2008-09-21 04:22:26):
    cd /usr/src
    sudo apt-get build-dep linux-source-2.6.24
    sudo apt-get install linux-source-2.6.24 build-essential
    tar -jxvf /usr/src/linux-source-2.6.24.tar.bz2
    cd linux-source-2.6.24/drivers/usb/core
    sudo perl -pi.bak -e 's/16384/131072/' devio.c
    make -C /lib/modules/`uname -r`/build/ M=`pwd` modules
    strip --strip-debug usbcore.ko
    sudo install -m644 -b usbcore.ko /lib/modules/`uname -r`/kernel/drivers/usb/core
    sudo depmod -ae
    sudo update-initramfs -u
    sudo reboot
    
    You could instead modify `/drivers/usb/core/devio.c` and recompile|the whole kernel if you wanted to. Note that this error can also occur for lots of other reasons, including bad cables, 3rd party docks etc. Ask Google about this error for lots of other possibilities.
  2. The VM seems to lock up at boot if an iPhone is plugged in at boot time. Try booting without the iPhone plugged in!

Syncing Music on Firmware Versions 1.x

Amarok and gtkpod can wirelessly sync music with iPod Touch and iPhone running the 1.x firmware, including adding, editing and playing songs and playlists. This guide requires Ubuntu 7.10, 8.04 or 8.10. Please note: Users with iPhone/iPod Touch using firmware 2.0 and above will have to change their checkpoint.xml for this to work. More details on how to do this below.

Set up the iPhone or iPod

On your iPhone or iPod Touch: Your iPhone or iPod Touch must be "jailbroken" so you can run Installer. Follow these instructions on jailbreaking to properly jailbreak. Note that you might need a Mac or Windows to do this.

  1. Click SettingsGeneral and set Auto-lock to Never. This will ensure the iPhone keeps the WiFi connection open.
  2. Click SettingsWiFi and select your WiFi network. Click the Static button and change the IP Address to an address that's outside the dynamically assigned range of your network. This will ensure your iPhone is always contactable at the same address for syncing.
  3. Open Installer.
  4. Click All PackagesBSD SubsystemInstall
  5. Click on All PackagesOpenSSHInstall.

(I believe that if OpenSSH is installed from Cydia, then it is not necessary to install BSD Subsystem. However, I don't think this is ste's openSSH and I can't get keys to work with it)

Set up Ubuntu

A third party source provides the ipod-convenience package needed to properly mount and unmount an iPhone or iPod Touch, and for gtkpod users, a newer gtkpod is required for the iPhone and iPod Touch.

  • Extra steps for versions pre-8.04:
  1. Click SystemAdministrationSynaptic Package Manager. Once Synaptic starts, click SettingsRepositoriesThird Party Software. Click Add and use deb http://ppa.launchpad.net/ipod-touch/ubuntu gutsy main as the APT line. (this source should have a key file to avoid the prompt to install without authentication).
  2. Click Reload

  1. Before installing newer packages, make sure to first uninstall libgpod.
  2. Install the ipod-convenience package, as well as either amarok or gtkpod (or both if you like). When asked, enter the IP address of your iPod Touch or iPhone that you selected earlier. When asked for a folder to mount your iPod Touch or iPhone, either leave the default of /media/ipod or another folder if you prefer - just remember to use that folder name for rest of this guide. The package will make the folder for you.
  3. Plug in your iPod Touch or iPhone via USB. This is REQUIRED when you run the next steps for the first time, as the USB connection is used to generate a hash required by the iTunes Database (if this fails to generate properly, see the troubleshooting section below). An added benefit is this also makes sure that your device won't turn the wifi into low power mode, breaking the transfer connection.
  4. When done, click ApplicationsAccessoriesTerminal. To mount your device, run:
    $ iphone-mount
    or
    $ ipod-touch-mount
    
    When prompted, enter your iPhone or iPod Touch's root password - by default, dottie in firmware 1.0 and alpine in 1.1, 1.2, 1.3 and 1.4.
  5. Unmount your device, by running:
    $ iphone-umount
    or
    $ ipod-touch-umount
    
Amarok
  1. Click ApplicationsSound and VideoAmarok

When you first open up Amarok:

  1. Click SettingsConfigure Amarok.
  2. Choose Media Devices.
  3. Hit Add Device.
  4. Select Apple iPod Media Device for the plugin type.
  5. Point it at your mount point, the default being /media/ipod unless you chose another one when setting up ipod-convenience.
  6. Back in the main app, click the blue cog icon called Configure Device just above the iPhone or iPod Touch. For Pre-Connect Command, add iphone-mount (or ipod-touch-mount), for the Post-Disconnect Command, add iphone-umount (or ipod-touch-umount)
  7. In Devices, click Connect. After entering your password, your iPhone or iPod touch should now appear in Amarok.
  8. Once connected, click on the double arrows on the right hand side of the Connect, Disconnect, and Transfer buttons. A list of options opens up, one of which is iPod. Choose iPodSet iPod ModelMobile PhonesiPhone (or your specific iPod Touch model).
  9. iPod Touch 1st Generation works best as Mobile Phones -> iPhone, including cover transfer.
gtkpod
  1. Check the version of gtkpod HelpAbout. If you are using version 0.99.10, your database will be corrupted upon writing to it. The solution is to get ahold of version 0.99.12+, either by compiling it from gtkpod.org, or by fetching the package from the Hardy universe repositories. Note that if you are running Hardy, you will most likely be using that 0.99.12 package. On a more comforting note, the database corruption from 0.99.10 can be fixed by rewriting it with 0.9.12.
  2. Click ApplicationsSound and Videogtkpod
  3. When you first open gtkpod you may receive some errors. Simply click OK to proceed. Your iPhone or iPod Touch should now appear in gtkpod. If it doesn't, you can manually add it's mount point in the options dialog.
  4. Right-click on the iPhone or iPod, and choose Edit iPod properties (or choose Edit > Edit repositories/iPod options) and change the iPod model to reflect your iPhone or iPod Touch.

Simply add music to the iPhone or iPod Touch like you would any other iPod and Save Changes when done.

Passwordless Access

In order for programs like Amarok to connect to your iPhone via SSH without asking for a password, you can set up key based logins. You can skip this step if you're happy mounting it manually from a terminal, typing your password each time.

  1. Make a private and a public key. We'll specify a different identity than the default, so it won't conflict with any existing keys you have. Run the following command in a terminal:
$ ssh-keygen -t rsa -f ~/.ssh/iphone_identity -N ""

This will create a directory called .ssh in your home directory, and place three files in there: iphone_identity, iphone_identity.pub, and known_hosts. iphone_identy is your private keyfile, and iphone_identity.pub is your public one. You want your device to have the public key so you can authenticate towards it with your private one.

  1. Install your public key to the device. If it asks if you want to accept the untrusted device as a trusted host, do so.
$ ssh-copy-id -i ~/.ssh/iphone_identity.pub root@<device ip>
  1. Log into your iPhone again.
$ ssh root@<device ip>

If it at this point asks for your password, that means the server installed on the device has not yet been configured to accept keys as a method of authorization. Ergo, you are not using "Ste's OpenSSH package", which will be mentioned later in this wiki. For the time being, the default password for 1.1.0 phones is 'dottie', and 'alpine' for 1.1.1 and 1.1.2 phones.

  1. Change the password. This is important for security. You will eventually be logging in via your key anyway, but make it something you'll remember.
$ passwd
  • NOTE: On firmware 1.1.3, BSD Subsystem maintainers highly recommend against using the "passwd" command until a stability bug is fixed. Until then, you can use this command, and replace the output password hashes for the users 'root' and 'mobile' in /etc/master.passwd on your device.
$ perl -e 'print crypt("yourpasswordhere", "/s");'

The following steps do NOT apply to Ste's OpenSSH package, which is probably the most common one now. In order to get passwordless login working with Ste's package, rename your ~/.ssh/authorized_keys file on your device to ~/.ssh/authorized_keys2 and proceed straight to adjusting the permissions as described below ("if all else fails"). Full instructions can be found here: [1] If you are not using said package on your device, follow these instructions to enable the public key authorization method.

  1. Edit /etc/sshd_config:
$ pico /etc/sshd_config
  1. Scroll down to the segment beginning with '#RSAAuthentication', and set it up as follows:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

Remove any commenting hashmarks (#) prepended to the beginning of these three lines.

  1. Hit Ctrl+X to exit, and save your changes.
  2. At this point you should be finished. Reboot your device.
$ reboot
  1. Give it some time to start up, then try logging back in. This time, it should automatically authenticate using your private key.
$ ssh -i ~/.ssh/iphone_identity root@<device ip>
  1. To make the process even simpler, add these lines to your ~/.ssh/config file on your computer.
Host iphone
  HostName <device ip>
  User root
  IdentityFile ~/.ssh/iphone_identity

Now you should be able to login with this simple command:

$ ssh iphone
If all else fails

If you're still asked for a password:

  • Check your local ~/.ssh/iphone_identity.pub file and compare it with the ~/.ssh/authenticated_keys file on your device. Does any entry match? If not, try the ssh-copy-id command again. Alternatively, just copy the contents of your iphone_identity.pub file and paste it on a line of its own in authenticated_keys. Entries must be one line only.
  • Did you properly input and save the changes to /etc/sshd_conf?
  • Did you reboot the device after changing /etc/sshd_conf?
  • If you used a tool other than ssh-copy-id, check the permissions for your SSH files. If you type the following command, it should look like this:
# ls -al ~/.ssh
total 4
drwxr-xr-x 2 root wheel 102 Nov 21 04:25 .
drwxr-xr-x 6 root wheel 306 Nov 20 00:02 ..
-rw-r--r-- 1 root wheel 395 Nov 20 03:01 authorized_keys
  • Try resetting the permissions on the iPod or iPhone's SSH files manually:
chmod 755 /var/root
chmod 700 /var/root/.ssh
chmod 644 /var/root/.ssh/authorized_keys
  • For more debugging, you can get verbose output from ssh:
$ ssh -vvv iphone
  • You can also turn on syslog on the device to have it log any error messages that the SSH server might output.
$ ssh iphone
Password:
$ echo "*.* /var/log/syslog" > /etc/syslog.conf
$ killall syslogd
$ /usr/sbin/syslogd -bsd_out 1
$ tail -f /var/log/syslog

Retrieving and setting the Firewire GUID (FirewireGuid)

When you issue iphone-mount or ipod-touch-mount for the first time, the program silently attempts to generate this value using a USB connection. If you have never connected your device via USB before and try to mount it via WiFi for the first time, this step is missed and you end up with a database that your device refuses to read. This is (in nearly all cases) because the Firewire GUID (FirewireGuid) that the iPhone/iPod Touch specifically use to hash their database is either missing or invalid. To fix this manually:

  • Plug your iPhone/iPod device into your Ubuntu machine via USB
  • In Ubuntu, run ApplicationsAccessoriesTerminal
  • Issue iphone-mount or ipod-touch-mount (depending on your device) in the terminal
  • Path to /media/ipod/iPod_Control/Device ("cd /media/ipod/iPod_Control/Device", assuming you used /media/ipod for the mount location)
  • Run "sudo lsusb -v -d 05ac: | grep iSerial | awk '{print $3}' | cut -b1-16 | xargs printf "FirewireGuid: 0x%s\n" > SysInfo" (Found here).
  • In your media application of choice, transfer a new song and/or sync your iPod. Depending on what media application you use, you might have to re-transfer all songs.
  • Reboot your device

You may also get the GUID directly from the device by executing:

 /usr/sbin/ioreg  -n IOIpodUSBDevice  -w 0 | grep DeviceConfiguration | cut -d '"' -f 44 | cut -c 1-16

If all goes well, your music should now be recognized on the device!

Alternative solution with MNPlight

  • Add the http://iphone.lefessant.net/iphone link to your Ipod Touch or Iphone installer.
  • Install MNPlight.
  • For Ipod Touch you need to set the "FirewareGuid" of device (see previous section).
  • Set the Fireware GUID in MNPlightPreferences.

Warning: Without this step MNPlight will corrupt your music database!

  • Copy your music in to /var/root/Media/MNPlight/Music folder of your Iphone/Ipod Touch and import it by MNPlightPlaylistsImport songs from directory

Troubleshooting

Programs fail to sync, stating the device is not present

A "gotcha" currently exists if you accidentally "sudo" the iphone-mount or ipod-touch-mount step. Doing so will create a template file set at your mount location (eg. /media/ipod) and subsequent mount operations will fail uncleanly. If this occurs, verify the device is indeed not mounted, clean out /media/ipod, verify the permissions are correct, and mount again as your normal user.

Music appears in the Ubuntu media player, but is not playable or does not appear on the iPhone/iPod device

The most frustrating "gotcha" is failing to have a correct FirewireGuid written onto your device. This is normally generated when the device is attached for the first time, assuming you had the device plugged in via USB at the time. If this hash is incorrect or not present, iTunes will refuse to load the database. If the music still doesn't appear on your iPhone/iPod, you might have to restart the music playing programme. Select music and hold down the main button for a few seconds. You'll be dumped back to the main screen. Please see the section above on setting the Firewire GUID.

Firmware 1.1.3

If you soft-upgraded to firmware version 1.1.3 with the Official iPhone Dev package (this does not seem to affect iPhones updated or restored firmware 1.1.3 iPhone jailbroken with ziPhone), there may be issues with getting in via SSH (Connection refused, timeout, etc). Uninstall the OpenSSH package, reinstall the BSD Subsystem package, then reinstall OpenSSH. Try logging back in as root, with the password as whatever you set it to in a previous firmware version, or the default, which is still 'alpine'. Once you have logged in, changes need to be made before you can mount everything properly with the ipod-convenience script. User-run programs now run as user "mobile" instead of root, and media has been moved from /private/var/root/Media to /private/var/mobile/Media. The ipod-convenience script expects them to be in the former, so a link needs to be made to point to the new Media folder. Issue

 
$ ln -s /private/var/mobile/Media /private/var/root/Media 

while logged into the iPhone or ipod touch via SSH. An alternative solution is to modify the ipod-convenience script (no need to create the link on the iphone/ipod touch):

$ cd /usr/share/ipod-convenience/
$ sudo cp mount-umount mount-umount.bak
$ sudo gedit mount-umount

...and at line 62 modify:

#Mount our Music Directory
sshfs root@$IPADDRESS:/var/root/Media $MOUNTPOINT/ -o workaround=rename

...into:

#Mount our Music Directory
sshfs root@$IPADDRESS:/var/mobile/Media $MOUNTPOINT/ -o workaround=rename

No Cover Art with Amarok

If you find that after syncing your iPhone with Amarok the coverart is missing it is very likely that you are using the wrong version of libgpod. Amarok depends on libgpod and the Ubuntu repositories version installs libgpod v2 instead of the needed libgpod v3. Workaround:

  • Uninstall libgpod v2. This will also uninstall Amarok
  • Open Synaptic and uncheck all the repositories but http://ppa.launchpad.net/ipod-touch/ubuntu
  • Refresh
  • Install libgpod v3 and Amarok
  • Re-check all the previously unchecked repositories
  • Start Amarok and connect to your iPhone
  • Make sure that the correct kind of iPod is selected in Amarok (under iPod → iPod Models → Mobile Phones)
  • Click on Refresh Graphics and on Disconnect (this might take a while)

You should have your Coverart correctly loaded on the iPhone afterwards.

Device full, "how were I to know?"

If you have followed previous steps and set it up to mount your device to a directory on your local computer, there is no way for any program interacting with that directory to tell how much free space is left on the device. In essence, the directory exists on your harddrive, and any attempts to divine free space would simply return the free space of that harddrive. For the time being, you can query the device itself in an SSH session. See previous sections of this wiki for information on how to connect to it in such a way. Log into the device via SSH, then enter this.

$ df -m

The output of that command will look something akin to the following:

Filesystem   1M-blocks Used Avail Capacity  Mounted on
/dev/disk0s1       300  277    19    94%    /
devfs                0    0     0   100%    /dev
/dev/disk0s2      7443 7395    48    99%    /private/var

The bottom-most line signifies the storage partition.

  1. Filesystem is a denominator for the device node of that partition.
  2. 1M-blocks shows its capacity in megabytes. In this case, 7443 mb.
  3. Used shows how many megabytes are used. In this case, 7395 mb.
  4. Capacity shows how much space is currently used, in percent. In this case, 99%.
  5. Mounted on shows where the partition is internally mounted on the device, much like you mount the device's SSH interface to a local directory for file transfers.

Likely, you will find only the third and fourth columns of interest.

Firmware 2.x will not sync

See below.

Syncing iPhones and iPods Touch w/ Firmware 2.x

Apple has encrypted the library database on the latest firmware, and as such the above approach will not work. Apparently using the above approach will transfer the music, but Apple's music player on the iPod will not recognize any of the transferred files. The solution, then, is to use another music player on the iPod. Use the steps below to wireless transfer music to your iPod and play it using a third party app called PwnPlayer.

Syncing with Firmware 2.x possible!

Actually, you can edit /System/Library/Lockdown/Checkpoint.xml, find the DBVersion key, and change its value from 4 to 2 (MAKE A BACKUP FIRST!!!). See http://marcansoft.com/blog/2009/01/using-amarok-and-other-itunesdb-compatible-software-with-the-iphone-2x/. This allows you to sync with libgpod, as well as any apps that use libgpod (Tested with Amarok and gtkpod: it works fine, except that podcasts cannot be synced (sunk?). Music syncs just fine. Rhythmbox doesn't seem to recognize it though). Use the guide above for further configuration.

Setting up the iPod or iPhone

  1. Make sure your iPod is jailbroken. QuickPwn works well for 2.x firmware, and a quick Google search will point you to directions (Unfortunately, you'll need to borrow a Windows or a Mac machine for the jailbreaking, but after that, it's Ubuntu all the way). In the process of jailbreaking, make sure to select the option that installs Cydia (Cydia is a front-end for the iPhone's apt port).
  2. On your newly jailbroken iPod, update Cydia and install OpenSSH through it. PwnPlayer is also recommended by some users but you should note that it's not necessary as you'll still be able to play your music on the standard iPod application of your iPhone if you synchronize with this method.

Transferring Music

  1. In Ubuntu, select Places>Connect to Server. In the dropdown box labeled "Service type," select "SSH". In the "Server" field, input your iPod's ip address (this can be found on your iPod by going to Settings>Wi-Fi>arrow-next-to-SSID-of-network-you're-connected-to). Finally, under username, enter "mobile". Leave other fields blank. Click connect.
  2. When it asks for a password, enter "alpine" (this can--and should--be changed, see below).
  3. You should now have your iPod mounted on your desktop, and can transfer music onto it. The default location for PwnPlayer's filesystem music player is /var/mobile/Media/Music. Simply copy and paste music into this directory.

Playing Music with standard iPod application

  1. To see new Tracks you transferred to the iPod, you need to fully quit and restart the Music Application. One Click on the Home Button only "minimizes" it, pressing the Home button 5 secs should work. I use SBSettings and the "Processes" Switch. Works fine. Restarting the iPod by pressing the "On/Off" Switch for 5 secs works, too.
  2. Enjoy!

Optional: Playing Music with PwnPlayer

  1. On your iPod, open PwnPlayer (select the icon labeled "Player").
  2. Select "File system" from the choices on the bottom of the screen ("Library" does not contain your music).
  3. You should see all your music
  4. Enjoy!

Tips, Tricks, Troubleshooting, etc

  • The standard iPod music player is able to display album art embedded in ID3 tags OR organized as iTunes does it (in separate folders somewhere in your iTunes library location). If you have previusly synchronized your music with iTunes, the album art IS NOT embedded in the ID3 tags of your files. Adding music through amarok or gtkpod will switch the album art display mode of your iPod to displaying only embedded album art, so you'll probably lose most of the album art added through iTunes. The only workaround I found is to copy your iPod music to your computer with amarok, then use EasyTag to embed the album art to the ID3 tags and then sync back to the ipod (it can be very time consuming).
  • You can change your password in your iPod by logging in from the terminal. Type "ssh mobile@<ipod's_ip_address>", login, and type passwd to change the password.
  • There is also a root user on your iPod, and it is advisable to change that password as well. Follow the directions above, but use "ssh root@<ipod's_ip_address>" in the terminal.
  • You can also transfer music from the terminal using scp, but I'm sure you already know how to do that ; )
  • You can change the location of the music in PwnPlayer by going to "Featured" and selecting "Settings" in the top left hand corner.
  • I've only tried PwnPlayer with mp3's. I do not know if it works with other music files.
  • Lastly, given that PwnPlayer is basically a file browser, it's much easier to find the song you want if your music's file structure is organized. I recommend you organize your Music folder on your computer using Amarok before transferring any music.

Finally, note that PwnPlayer is still beta, so it might have a few bugs.

Converting/Watching Videos

If you want to convert videos for use on the default iPhone video player, Handbrake is a good choice (there's now a native Linux GUI version available) -- it is now accepting any video input to create a Apple-compatible video file. However, if your iPhone is jailbroken and you don't want to play the video back using the native iPhone video player (which for example doesn't support XVid/DiVX file formats), you do need to use a video converter like WinFF and an alternative video player such as MPlayer. This conversion involves using mplayer4iphone (available through Cydia on jailbroken iPhones) and WinFF using an iPhone 3g with 2.2 firmware.

  1. Jailbreak your iPhone
  2. Install mplayer4iphone through Cydia
  3. Install WinFF on Ubuntu (Medibuntu repository) through Synaptic
  4. Now convert your videos using WinFF. Use these settings: 480x320, 15fps, XVid in AVI. It's crucial to keep the fps to 15, since 24fps, etc. was jerky for me. Here's my preset for WinFF if you want to create one: -r 15 -vcodec libxvid -vtag XVID -s 480x320 -aspect 4:3 -maxrate 1800k -b 1500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv -trellis 1 -cmp 2 -subcmp 2 -g 300 -acodec libmp3lame -ar 48000 -ab 128k -ac 2
  5. Once you have your video converted, connect to your iPhone using the SSH method detailed above. This will open a window showing your iPhone file structure.
  6. Mplayer needs your videos to be in this folder: root/var/media. Just drag your video files to that folder.

Now you can just play your files in fullscreen on Mplayer on your iPhone, with audio synch working fine. Enjoy!

Syncing via Cable

Intro

Seems like nobody is interested in syncing via cable. Nevertheless it is possible, for example if you don't want to setup an AdHoc Wlan ( Anybody succeeded creating one with WPA? ) or if you don't have Wifi at all.

iTunnel

Go to http://www.cs.toronto.edu/~jingsu/itunnel/ and download the iTunnel program for linux. It includes a binary or compile your own. Start the Binary in a Terminal/Xterm and create the Tunnel on a self chosen port with ./itunnel 7777. Then you have to mount the ipod's file system with sshfs -p 7777 root@localhost:/var/mobile/Media /media/ipod. Set up the FirewireGUID as described in the Firmware 1.x Guide. Then Start your Program for transferring MP3s ( amarok etc. ) and point it to /media/ipod. You should be able to transfer Music to the device.

iFuse

iTunnel is based on some older Code of iFuse. Get iFuse at http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page. I was able to get a connection, but it was unstable and I was not able to sync Music.

Speed

iTunnel gives me about 400kb/sec iFuse gives me about 250kb/sec WLan gives me about 10 - 800kb/sec, WLan crowded places give less :)

Copying photos to the iPhone or iPod Touch

Photos can be copied into the Media/DCIM directory in the mobile account. They need to follow the directory and image numbering conventions used by the iPhone/iPod. Multiple image formats are allowed, but they should have a thumbnail (.THM) file which is a 55x55 pixel JPG file. There is a command-line script that can copy images to the iPod Touch or iPhone using ipod-convenience or scp available at http://marginalhacks.com/#img2iphone Note that it is free to use and source available, but not technically open source.