Ipod touch with Linux
Published by Luigi December 3rd, 2009 in Linux, Software, MacYesterday night I tried to connect the iPod to Linux. I tried some programs but none was working decently; but the good news is that you don't really need any special program "made for iPod" to do this.
For the guys who do not know about iTunes and iPod/iPhone foolishnesses, the problem is that when connecting trough USB they are not exposing the filesystem as usb disk. The second problem is how iTunes memorizes files: they get renamed in 4 char lenght filenames under a 3 char lenght folder... so you have files like:
iTunes_Control/Music/F26/UBFF.mp3 iTunes_Control/Music/F26/UEBM.mp3 iTunes_Control/Music/F26/UIPQ.mp3 iTunes_Control/Music/F26/UWCJ.mp3 iTunes_Control/Music/F26/WGOH.m4a
As result of this, if you have songs belonging to different authors and coming from different albums, but you was keeping in the same folder to listen together... you can't specify to iTunes to play a folder as a playlist, because folder and filenames gets chaotically "reorganized" when imported in iTunes. iTunes, then uses id3 tags to expose views to the user, grouping by author or album title, etc.
To connect to iPod filesystem with Linux, you need to jailbreak the iPhone or the iPod touch, and have OpenSSH running on it. It is not very difficult, but, afaik it's the only way to access remotely to the iPod filesystem, through network (wifi).
Once done that, you need to mount the filesystem using ssh protocol; this can be done with sshfs, which is the ssh protocol support for FUSE (Filesystem in USEr space) which allows you to mount several type of local or remote filesystem without needing root privileges.
$ sudo apt-get install sshfs
Then I created a folder under my ~/Music folder where to mount my iPod media
$ mkdir ~/Music/iPod
At last I made a bash script to mount and unmount the iPod media to the folder I just created. This is the content:
#! /bin/bash
case "$1" in
mount)
echo -n foobar | sshfs root@Luigi-R-Viggianos-iPod.local:/private/var/mobile/Media/ ~/Music/iPod -o password_stdin
;;
umount)
fusermount -u -z ~/Music/iPod
;;
*)
echo "Usage: `basename $0` {mount|umount}"
exit 1
;;
esac
In the above script "foobar" is the password to use to ssh-connect as root on my ipod. Unfortunately I did not succeed in using public key authentication, even modifying the sshd configuration on the ipod, I do not know why... So I had to specify the password in the script.
The Luigi-R-Viggianos-iPod.local is the hostname used by my iPod. Alternatively you can use the ip address, but when you change network you will need to update the script; the hostname usually gets recognized in different WIFIs and mapped to corresponding ip address.
To get the ip address of the iPod connected to WIFI, there are some programs downloadable on the apple store, one is called, with much of fantasy, "IP Address". To know the hostname of the ipod, just connect to it through ssh, and you will see that displayed on the bash prompt line, in my case: "Luigi-R-Viggianos-iPod:~ root#", unfortunately apples likes to have weird unix system on their devices so you don't have basic commands like 'hostname' or files like /etc/hostname to check... did I already said that I hate OSX...?
At this point what I do is just running the script:
$ ipod mount or $ ipod umount
to mount or unmount the iPod to ~/Music/iPod folder. The iPod needs to be attached to a power source, the laptop trough usb or to a docking station, otherwise it will disable the WIFI connection when it goes on stand by; but the file access is fully wireless.
To play files, you need to launch Amarok or Rhytmbox and import the folder ~/Music/iPod. I use Rhytmbox and it indexes the folder. When the folder is mounted I can see the music on my iPod, and when it is not, the music just disappears.
If you want to export an album of MP3 files from the iPod, you just need to select files from Rhytmbox and drag and drop into Nautilus (filesystem browser). But you will have the weird names for the MP3 files set by iTunes. To batch rename the files you can install and use id3ren, which lets you to customize (-template option) how the filename should be renamed (using album title, song title, author, etc):
$ sudo apt-get install id3ren $ id3ren -template='%a - %t - %s.mp3' *
If you like to backup the music on your iPod just use rsync or cp. But I don't know how to import new songs in the weird filesystem-format used by iTunes... For this, possibly the easiest solution is to use iTunes on Windows or OSX using VMWare, until Apple does not decide to release iTunes on Linux.
Have fun.
One Response to “Ipod touch with Linux”
Leave a Reply
Search
Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Nov | Jan » | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
Archives
- January 2010 (2)
- December 2009 (1)
- November 2009 (3)
- September 2009 (2)
- August 2009 (4)
- July 2009 (1)
- June 2009 (2)
- May 2009 (4)
- April 2009 (2)
- March 2009 (7)
- February 2009 (5)
- January 2009 (2)
- December 2008 (1)
- November 2008 (8)
- October 2008 (12)
- September 2008 (3)
- August 2008 (2)
- July 2008 (6)
- June 2008 (16)
- May 2008 (2)
- April 2008 (3)
- March 2008 (6)
- October 2007 (1)
- September 2007 (1)
- August 2007 (5)
- July 2007 (6)
- June 2007 (6)
- May 2007 (1)
- March 2007 (1)
- February 2007 (2)
- January 2007 (1)
- December 2006 (2)
- November 2006 (4)
- October 2006 (7)
- September 2006 (1)
- August 2006 (2)
- July 2006 (6)
- June 2006 (3)
- February 2006 (1)
- January 2006 (1)
- December 2005 (5)
- November 2005 (2)
- October 2005 (2)
- September 2005 (7)
- August 2005 (2)
- July 2005 (8)
- June 2005 (12)
Categories
- Books (7)
- Eclipse (10)
- Errors (2)
- Firefox (7)
- Hardware (14)
- Horror Code (8)
- Internet (17)
- Java (85)
- JavaScript (8)
- Life, universe and everything (29)
- Linux (44)
- Mac (18)
- Software (25)
- Speeches and Conferences (8)
- Web (19)
- Windows (16)
Latest
- Syntactic sugar and Java arrays.
- 3G USB Stick on Ubuntu
- Ipod touch with Linux
- Karmic and Luks: USB drive encryption made (almost) easy
- Suspend/Resume in Karmic /2
- Suspend/Resume problem in Ubuntu Karmic 9.10 running on MacBook Pro 5.1
- MacBook International Keyboard and Linux
- Mighty Mouse: reverse horizontal scrolling workaround on Ubuntu Linux 9.04
- Skype 2.1.0.47 beta released, and amd64 packages available!
- Linux RAM Disks
My open source projects
Blog License
Blogs I like
Friends' Blogs
- Antonio Terreno & Valter Bernardini
- Bruno Bossola
- Daniele Galluccio
- Domenico Ventura
- Ed Schepis
- Fabrizio Gianneschi
- Filippo Diotalevi
- JavaJournal.it Blog
- Luca Grulla
- Luigi Zanderighi
- Marcello Teodori
- Mida Boghetich
- Muralidharan Chandrasekaran
- Piero Ricca
- Renzo Borgatti
- Simone Bordet
- Uberto Barbini
- Valvolog
- Webtide blogs (Greg Wilkins & Jan Bartel)
Links








wau…i did read through your essay and nearly wrote an answer in german…ok…translation
i worked on this problem before, but not with the itunes library, much more with the adressbook, on my ipod touch and osx leopard…i believe, the itunes library also is stored in an sqlite database which is some kind cryptic … i will have a look in the following days…coz i want it sooo badly…syncing over wifi would be great…i’m thinking of adressbook, calendar and music