332 - Set-up-of-iPod-Mini-in-Linux

Herewith some instructions on setting up your iPod Mini with Linux with USB and the FAT file-system, using gtkpod to access the iPod. I’m assuming a few things for this little howto:

  • You have access to a Windows box to reformat your iPod to FAT.
  • You have a working USB 2 install along with VFAT support in your kernel.
  • You know how to use the command line and edit files on it
  • You have root access to your system
  • You know how to install software

That’s about it, so on with the instructions:

  1. I assume you have access to a Windows install here. Before plugging the iPod into your Linux system, reboot to Windows. Install iTunes and the iPod software, making sure to allow the iPod to be reformatted to the FAT file-system when asked.
    I did this because the FAT file-system is better supported in Linux than the HFS+ file-system an iPod comes formatted with. Add a few songs using iTunes, these can be used later when we install gtkpod to make sure your iPod is being read correctly.
    There are various ways of reformatting in Linux, but this method is easiest if you have a Windows install. Check out ipod on linux for some resources about this.
    (Kind of ironically, I had to install drivers on WinXP to get USB working, whether as in Linux it worked straight away. I thought that wasn’t supposed to happen. As a side note, the same thing happened at work, aside from it was the network card drivers we didn’t have. Talk about chicken and egg — download drivers for network card from the Internet. Great…)
  2. Unplug your iPod and reboot to Linux =)
  3. Once your system has booted and you have logged in, plug your iPod into your USB port. Run dmesg on the command line (you may need to be root for this). You should see something like below. Note down what sdX is being used (e.g. here it is sda). Substitute your sdX in the steps after this one.
ehci_hcd 0000:00:10.3: port 3 reset error -110
<p>hub 1-0:1.0: hub_port_status failed (err = -32)</p>
<p>usb 1-3: new high speed USB device using address 9</p>
<p>scsi7 : SCSI emulation for USB Mass Storage devices</p>
<p>  Vendor: Apple     Model: iPod              Rev: 1.61</p>
<p>  Type:   Direct-Access                      ANSI SCSI revision: 02</p>
<p>SCSI device sda: 7999488 512-byte hdwr sectors (4096 MB)</p>
<p>sda: assuming Write Enabled</p>
<p>sda: assuming drive cache: write through</p>
<p> sda: sda1 sda2</p>
<p>Attached scsi removable disk sda at scsi7, channel 0, id 0, lun 0</p>
<p>Attached scsi generic sg0 at scsi7, channel 0, id 0, lun 0,  type 0</p>
<p>USB Mass Storage device found at 9

</p>
If this doesn’t work, the gtkpod readme file has some good instructions on how to set this up.

  1. Test mounting your iPod as root. Note it is mounted as type VFAT (-t vfat) so that filenames are not truncated. gtkpod does not work if you mount your iPod as msdos file-system, as I read you should do in one howto (I found this out the hard way when all the filenames on my iPod became truncated!). To do this, use the following commands:
# mkdir /mnt/ipod
<p># mount -t vfat /dev/sda2 /mnt/ipod</p>
<p># ls /mnt/ipod

</p>
The final command should come up with a list of folders. If this doesn’t happen, you probably haven’t got your iPod formatted as FAT. Try switching back to Windows and writing a few files to it using iTunes. Then try the above steps again. If it still doesn’t work, I’m not sure what has gone wrong for you… Google time, sorry!
Finally, unmount your iPod:

# umount /mnt/ipod


  1. Next we are going to set up the /etc/fstab file so that gtkpod can automatically mount your iPod. Open /etc/fstab as root and add the following two lines:
# ipod
<p>/dev/sda2   	/mnt/ipod     	vfat     rw,user,umask=002,gid=100,noauto 0 0

</p>
These lines allow normal, non-root, users to mount and read/write to the iPod. Refer to the mount man pages for more info about what the line means and other options you can use. Test this addition to fstab by quiting from root and doing the following as a normal user:

$ mount /mnt/ipod
$ ls /mnt/ipod
$ umount /mnt/ipod


The ls command should give you the same file listing as before, and mount and umount shouldn’t give any errors.

  1. Now it’s time to install gktpod. Download and install it from http://gtkpod.sf.net. Now, execute the following:
$ mount /mnt/ipod
$ gtkpod


The gtkpod window should appear and list any songs you have put on your iPod! You might get an error about gtkpod not being able to read itunesdb.ext; don’t worry about it as gtkpod will write this file out when you sync. gtkpod froze the first time I loaded it for no apparent reason, but hasn’t since so I assume it was a non-recurring problem.
Use the Add buttons to add songs to the iPod and then use the Sync button to write the songs and itunesdb back to your iPod. Close gtkpod and then:

$ umount /mnt/ipod


Your iPod will probably still say “Do not disconnect” on it, but it seems to work fine if you do disconnect. If anyone knows how to fix this error, please tell me!

  1. That’s it pretty much! You can set gtkpod to mount and unmount the iPod automatically when you start it up, as well as read the iTunesdb. I’ve turned these options on, but haven’t tweaked any other options as yet.

There are various ways of reformatting in Linux, but this method is easiest if you have a Windows install. Check out ipod on linux for some resources about this.

If this doesn’t work, the gtkpod readme file has some good instructions on how to set this up.

Finally, unmount your iPod:

The ls command should give you the same file listing as before, and mount and umount shouldn’t give any errors.

Use the Add buttons to add songs to the iPod and then use the Sync button to write the songs and itunesdb back to your iPod. Close gtkpod and then:

I hope this little set of instructions is helpful to someone! Now go outside into the sun and enjoy your iPod, safe in the knowledge that you’re still free from bad ol’ Windows.

Note that it seems fairly hard to damage your iPod via this procedure because the firmware is stored on another partition which you don’t mount. As far as I can tell, you could quite happily delete all the things from your iPod and then use gtkpod to recreate them and all would be fine. I doubt it’s such a good idea to use mkfs to format the drive to FAT, however, so I’d recommend Windows is used for this stage.

.:.