iPod Shuffle and Linux

The iPod Shuffle is about as minimalistic as a music player can get. It’s small, has 1GB of space on it, no batteries and no moving parts. The power jack is the earphone jack is the USB connector. I love it. Especially since I didn’t pay anything for it.
The problem was getting it hooked up to Linux. Here is what I was looking for. I wanted a setup where I plug the iPod into the computer and it automounts it. I want a simple GUI that allows me to easily manage the files on the iPod. It should be able to convert other formats into mp3 files. It should have playlist support to make it easy to swap preset music selections in and out. And when I’m all done, the iPod should automatically unmount so that I can unplug it. Basically, I need this to be a no-hassle, quick-and-easy, GUI solution.
Here’s how I did it.
First of all, the iPod shuffle is a vfat flash drive. That saves us some work. It looks to Linux like a nice USB 2.0 block device. Our first order of business is to set up autofs. My solution is geared toward Archlinux, but it should be applicable to any modern Linux distribution. We’re not going to be using hal or dbus for this procedure.
Installing autofs
We’re going to use autofs for our auto-mounting and auto-unmounting needs. First, let’s install it:
pacman -Sy autofs
Next, we need to add all iPod users to the storage group (replace “user” with your username):
gpasswd -a user storage
Log out and back in for that to take effect. Next, we need to set up autofs. In your /etc/autofs/ directory, edit the auto.master file to look like the following:
/media /etc/autofs/auto.media --timeout 2
Create a new auto.media file with permissions 644 with the following text (assuming that your storage group has an ID of 95):
ipod -fstype=vfat,rw,gid=95,umask=002 :/dev/ipod
Finally, in your /etc/conf.d/autofs file, you should have the following line (this sets up “ghost mode” so that the device doesn’t mount until you access it):
daemonoptions='-g'
Add autofs to your list of start-up daemons in /etc/rc.conf, and autofs is all ready to go.
Setting up udev
We need to add a new udev rule. We want it to recognize USB devices that we plug in. If it is an Apple device, we will assume it’s an iPod, and make it available as dev/ipod. Then our autofs rules above will mount and unmount it for us automatically.
So, in your /etc/udev/rules.d/ directory, create a file called 60-ipod.rules that looks like this (all on one line):
BUS=="scsi", SYSFS{vendor}=="Apple", NAME="ipod", GROUP="storage", MODE="0660"
That’s all!
Go ahead and restart your services. Before restarting udev you may want to copy your /etc/mtab somewhere and go back in and add all the missing entries afterward.
/etc/start_udev
/etc/rc.d/autofs start
watch -n 1 mount
Plug in your iPod shuffle and watch the ipod automatically mount as you run ls /media/ipod, and then unmount after 2 seconds.
Pretty cool.
Managing your music with gtkpod
Our next step is to get a working GUI. We’ll use gtkpod. Install it as usual:
pacman -Sy gtkpod
To be honest, I got tired of all the “Newly mounted iPod at ‘%s’ appearss to be already loaded!” messages. Call me retentive, but the mispelling of “appears” just really started to grate on my nerves. So I made a patch to change line 395 in src/autodetection.c to use debug instead of gtkpod_warning and installed my custom package with pacman -U. That way all our behind the scenes mounting and unmounting won’t disturb gtkpod.
From here, you’ll just run gtkpod, set up the new iPod device as being on /media/ipod, and begin adding music. As a disclaimer, I actually used gnupod to set up the iPod initially (gnupod_INIT --france), so I don’t know how well the “Create iPod’s directories” option works in gtkpod.
Another issue to look out for is with charging. When you charge from a computer that doesn’t have iTunes installed, you won’t see the orange and green lights indicating the charging status. From what I can find on Apple’s forums, the iPod’s orange blinking light that indicates “mounted as a USB flash drive” overrides the charging lights. However, not to worry; the iPod is still charging.
The iPod Shuffle is a piece of art. Even the packaging was beautiful. Apple consistently amazes me with their attention to detail and care of the entire user experience. Super kudos to Apple. I love my new iPod Shuffle (in my total of 8 hours of ownership) and the slick Linux integration.
Feedback?
I hope this is helpful to someone out there! I’d love any feedback or suggestions on how to make this brief how-to more helpful.
Related Posts
Tags: apple • autofs • design • gtkpod • ipod shuffle • linux • udev
Posted in solutions on November 27th, 2007 |

November 27th, 2007 at 8:45 pm
Cool! I’m glad you got your iPod! Now you can listen to your entire U2 collection whenever you want! Sounds like the price was right too! The GUI stuff means nothing to me though I must confess! But, it may be vital to me as soon as I get my Linux computer!
December 4th, 2007 at 4:24 pm
Yeah, so far I’ve been really pleased with it. It can play for 12 hours without needing a charge, which is nice. Nice, small, convenient.