Search:  
Gentoo Wiki

Apple_iPod_shuffle

Contents

Introduction

The iPod Shuffle from Apple sports flash memory at 512MB, 1GB or 2GB, and weighs in at only 22 grams (0.78 ounces). The iPod Shuffle is an extremely portable way to listen to music. This guide will cover several programs that contain iPod Shuffle support. Banshee is the most recommended, however requires the mono libraries (which are quite large). GTKPod is allegedly more problematic, but requires only GNOME native GTK+ libraries (and a few other small packages). Finally GNUPod is cli based and is the weakest of the 3 in terms of ease of use. It is for the cli zealot in the authors opinion.

Setup

I'm making the following assumptions in this guide. You may need to make some minor changes (especially to the Setup section if you do not follow these assumptions.

  1. You are using a UDEV system
  2. You have USB2.0 slots available

Kernel Configuration

Before the iPod Shuffle will work, you need to make sure you have certain options compiled into your kernel.

Note: If you have USB thumb drives already working on your system, your kernel is most likely compiled correctly.
Linux Kernel Configuration:
File systems -->
  DOS/FAT/NT Filesystems  --->
     <*> VFAT (Windows-95) fs support
  Partition Types  --->
     <*> PC BIOS (MSDOS partition tables) support
Device Drivers --->
  SCSI device support  --->
     <*> SCSI disk support
  Input device support --->
     <*> Event interface
  USB support --->
     <*> Support for Host-side USB
     [*] USB device filesystem
     <*> EHCI HCD (USB 2.0) support
     <*> USB Mass Storage support
Warning: If you're on a PowerPC computer, don't forget the "<*> PC BIOS (MSDOS partition tables) support" option, it may not be checked by default and you won't be able to mount the iPod Shuffle afterwards.

Banshee

The [1] project is written using mono and gtk+. It integrates nicely into the GNOME desktop. iPod support is included in newer versions and works seamlessly. It is highly recommended. One caveat is the need to install the mono libraries.

USE="ipod" emerge banshee

or add the USE flag to /etc/portage/package.use

echo "media-sound/banshee ipod" >> /etc/portage/package.use
emerge -av banshee 
Note: You will need to re-emerge dbus with the mono USE flag enabled before emerging mono.

Once Banshee is installed, iPod support and functionality "just work." There is no configuration required.

GTKPod

Highly recommended over GNUPod, GTKPod 0.94.0 fully supports the iPod Shuffle (although admittedly quite buggy in some experiences). Simply emerge gtkpod.

emerge --av gtkpod

GNUPod

iPod Shuffle requires GNUPod 0.98 or higher.

Create A Mount Point

Make sure you create a mount point for your iPod Shuffle:

mkdir /media/ipod

fstab Entry

You also need to create the entry for the iPod in /etc/fstab. This will be slightly different depending on your udev rules, or lack of them. Here is my fstab entry. My udev rule creates a device point at /dev/ipod. What is more important is the options that are used to mount the iPod.

File: /etc/fstab
/dev/ipod    /media/ipod    vfat    user,noauto,umask=000    0 0

Alternatively you can use the following if you do not have a /dev/ipod entry:

File: /etc/fstab
/dev/sda1    /media/ipod    vfat    user,noauto,umask=000    0 0

Also in some cases, instead of a partitioned device, the iPod is formatted as a single FAT volume, so:

File: /etc/fstab
/dev/sda     /media/ipod    vfat    user,noauto,umask=000    0 0

Note: Do not mount using the sync option. On most systems this option is ignored but on others this is not true when mounting vfat filesystems. Flash drives have a limited number of write cycles. When using the sync option the FAT gets re-written every block/cluster that is allocated to a new file. This can result in slow write times and can quickly wear out the flash drive. It is not worth destroying your drive just so that it can be unmounted quickly,

Mounting iPod Shuffle

Plug your iPod Shuffle into a USB2.0 port and mount it (I'm assuming you are using /media/ipod as your mount point):

mount /media/ipod

Initial Setup

This step only needs to happen once on the iPod. Run the following command to create a default directory tree and to create an empty GNUtunesDB:

gnupod_INIT.pl -m /media/ipod

Transferring Music

Transferring music is very easy. To do this, just run the following command:

gnupod_addsong.pl -m /media/ipod /music/foo.mp3

gnupod_addsong.pl also accepts wildcards. See the documentation for more information.

Unplug iPod Shuffle

Before you remove the iPod Shuffle from the USB2.0 port, you need to run the following two commands. The first is what converts the GNUtunesDB to an iTunesDB so that the Shuffle can actually play the music.

mktunes.pl -m /media/ipod
umount /media/ipod

You can also use the --volume option with mktunes.pl to adjust the volume by a certain percentage. To adjust the volume by fifty percent, type:

mktunes.pl -m /media/ipod --volume=50

iPod shuffle Database Builder

Unlike other programs like iTunes, GTKPod and GNUPod, which all require complicated manipulations of playlists and the like to get your music on your iPod, iPod shuffle DB Builder is a Python script which allows using your iPod shuffle like any other common MP3 player. The only requirement for running the script is having Python installed on your system.

Mounting iPod Shuffle

Plug your iPod Shuffle into a USB2.0 port and mount it (I'm assuming you are using /mnt/ipod as your mount point):

mount /media/ipod

Initial Setup

First, fetch the script from the official website, make it executable and move it to your iPod's root directory. This way you will have it with you all the time available on any system running Python. Additionally, create a new directory on the the root directory of your iPod, name it for example music, which will be the place where you will be copying your MP3 files to:

chmod +x rebuild_db.py
mv rebuild_db.py /media/ipod
mkdir /media/ipod/music

Transferring Music

Transferring music is a matter of copying the MP3 files you want to the directory you created previously. You are allowed to copy anything you like from a single MP3 file to a whole directory containing MP3 files.

Rebuilding the Database

In order to be able to listen to the MP3 files you just copied to your iPod you have to rebuild iPod's Database. To do this:

cd /media/ipod
./rebuild_db.py -l music

Note that the -l switch is there to prevent the script from generating a log file of the actions taken.

Unplug iPod Shuffle

You can safely unmount your iPod and listen to your favourite music:

cd
umount /media/ipod

Notes

Keep in mind that in case you need to copy the MP3 files from your iPod to another computer you can easily do it since you can find all of them intact inside the directory you previously copied them. Also, there is no restriction for putting non-MP3 files in your iPod. Finally, if you are dealing with Microsoft Operating Systems you can download a copy of the Windows version and place it to the root directory of your iPod. That way you will be able to rebuild your database on a Windows machine that does not have Python installed.

shuffle_db

The iPod Shuffle has a relatively simple database - as compared to other iPods/Mp3 players out there - and does not neccessarily need a complex program to add songs. For those of you who prefer to keep things simple, there is a python script shuffle_db that can update your iPod Shuffle's database based on what is on the drive. With this, you just treat your shuffle like a usb drive. Put the script in the root directory, and when you run it, it will scan the drive for any/all mp3 files, and update the database accordingly.

Automount iPod Shuffle

You can have your iPod Shuffle (and many other things) automatically mounted when you connect it by using HAL, dbus, and ivman. First merge the relevent packages.

emerge -a dbus hal ivman

Add the init scripts to the default runlevel.

rc-update add dbus default ; rc-update add hald default ; rc-update add ivman default

Now run the init scripts to get things rolling. (Or reboot.)

/etc/init.d/dbus start ; /etc/init.d/hald start ; /etc/init.d/ivman start

Now when you connect your Shuffle, it will be automatically mounted somewhere in /media. The actual folder name will vary. I named my Shuffle "DAVID'S SHUFFLE" and it gets mounted at /media/DAVID_S_SHU. Just ls /media and it should be obvious.

The default hal policy is to set the sync option when any removable storage under 2 gigs gets mounted. This makes USB transfers painfully slow. To fix this, create /usr/share/hal/fdi/95userpolicy/usb-storage-device.fdi with the following contents:

<?xml version="1.0" encoding="ISO-8859-1"?> 


<deviceinfo version="0.2">

  <device>
    <match key="@block.storage_device:storage.bus" string="usb">
      <merge key="volume.policy.mount_option.sync" type="bool">false</merge>
    </match>
  </device>

</deviceinfo>

It should be possible to specify where the Shuffle gets mounted and/or to execute a program (such as gtkpod) when you connect it, but I don't want or need that kind of behavior. If you want to try and figure it out, you should start by reading the hal documentation.

See also

Here is a recap of some of the important links that you may want to use.

Retrieved from "http://www.gentoo-wiki.info/Apple_iPod_shuffle"

Last modified: Sun, 07 Sep 2008 00:29:00 +0000 Hits: 59,909