Using an iPod in Linux

What can you do with an Apple iPod and Linux that you can't do with Apple's iTunes? Plenty.

The market for portable MP3 players has exploded in the last few years, and Apple's iPod is considered by many to be the gold standard to which other players are compared. Despite the fact that Apple does not offer a flavor of its iTunes music application for Linux, the iPod still is a good MP3 player for Linux users everywhere.

As I write this, I've used a 20GB fourth generation iPod with click-wheel and the iPod Shuffle; the software described in this article, however, should work with all iPods. To use the slick GUI of GTKPod, you will have better luck with a newer Linux distro. If you're a fan of the command line, though, you should have no problems getting GNUpod to work on almost anything that runs Perl.

With GTKPod, the open-source answer to iTunes, you can rock and roll all night with your iPod and Linux. GTKPod is the slick GUI that allows you to transfer MP3, WAV and M4A non-DRM-infected AAC files from your PC to your iPod. You can add files one at a time or you can add an entire directory at one time. You can create and edit playlists, normalize the volume on single tracks or multiple tracks at a time. You also can edit the ID3 tag of files on the iPod or files on your computer. GTKPod is even smart enough to know not to upload files that already exist on your iPod. And, naturally, GTKPod lets you delete songs from your iPod should you start running out of space.

GTKPod is built on GTK2. Originally developed for use with The GIMP, GTK now is used widely in many applications and is the set of tools used to build the GNOME desktop. As sure as GTK is slick software, it also is complex software with a raft of dependencies, inter-dependencies and various requirements so byzantine that compiling the stuff yourself from source code is asking for a trip down the rabbit hole. Lucky for us all, everything you need to use GTK applications such as GTKPod should be on your computer already if you're running a recent distribution of Linux.

If you're already using your iPod, you probably have everything you need to use it in Linux: the iPod itself, a PC with Firewire or USB 2.0 support and a relatively recent Linux distribution. You'll also need a copy of GTKPod (see the on-line Resources). On the GTKPod site, you should find a lot of documentation and links to the source code, as well as GTKPod packages for SUSE, Debian, Gentoo, Mandrake and other popular Linux distros. More RPM packages can be found by searching rpm.pbone.net or rpmfind.net.

Because the iPod simply is a fancy removable hard drive, to use it with GTKPod in Linux, your kernel needs to support fancy removable hard drives. This kind of support has been in the kernel since 2.4, and it has been refined in the current 2.6 kernel. Almost all current distributions use the 2.6 kernel, and removable hard drive support usually is compiled in the kernel or is available as loadable kernel modules. Therefore, you shouldn't need to do anything to your system to make it see the iPod.

You can connect the iPod to your Linux box through a Firewire connection or a USB 2.0 connection. USB 1.1 also works, but we don't recommend it because the connection is so much slower. Another drawback of using USB 1.1 is the iPod can't charge while it's plugged into your PC.

Installing GTKPod should be no problem whether you're compiling the source code or installing a precompiled binary package. GTKPod requires the libid3tag library, and the libmp4v2 package is required if you plan on using AAC files (see Resources). The source code for GTKPod compiles easily with the standard

./configure
make
make install

commands. A precompiled binary for your platform should install even easier than that and provides tighter integration with your existing desktop.

Once the iPod is formatted with FAT32 and GTKPod is installed, plug the supplied Firewire or USB cable into your PC, and plug the other end into the iPod. If Linux sees the iPod, you should see the iPod's screen flash the message “Do Not Disconnect”; on the iPod Shuffle, the status light blinks orange. If your iPod doesn't do this, try unplugging it and plugging it back in. I'm using Firewire instead of USB on my 20GB iPod, because the majority of on-line resources provide directions for using it. Also, if you only have the one Firewire device active, it makes things a little easier when disconnecting the iPod. The iPod Shuffle connects as easily and predictably as a USB thumb drive. See the Troubleshooting section of this article if you have problems getting Linux to see your iPod.

If you're using a disk-based iPod that's already FAT32-formatted (see Sidebar), there are two partitions on the drive. One is about 40MB and holds the iPod's firmware operating system, and the second is a huge partition that holds all of your music. If you're using an iPod Shuffle, you have only one partition, and it's already FAT32-formatted from the factory.

Every computer is going to be slightly different, so I recommend tailing your /var/log/messages file, or the analogous file for your Linux distribution, to watch what's happening behind the scenes when you first connect your iPod. The log file should indicate that your system has recognized the iPod and assigned it the next available SCSI drive letter, /dev/sda if you're running nothing but IDE drives. Some systems use the fstab-sync utility to edit automatically the /etc/fstab file to include a mount point for the iPod. Others require that a specific entry in your /etc/fstab file already exists. If you're tailing the /var/log/messages file and you don't see something like this fly by:

fstab-sync[4284]: added mount point /mnt/ipod for /dev/sda2

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

i have an old ipod,

Anonymous's picture

i have an old ipod, formatted for mac & when i try to use the program it can't transfer any files to the ipod, and it gives me a "read-only" system error message any tips? i've tried restoring it on a mac & using other methods like transfering them on rythynmbox via the menus and such, the wierd thing is i can bring files over from the ipod but not vice-a-versa.

Compliment

John Turner's picture

This is the best information I have found for a newbie like me on the web. Keep up the good work!

What about Ogg Vorbis files?

Anonymous's picture

Will this work for Ogg files? Could you guys write a follow-up OGG article?

I would rather use Ogg on my iPod than proprietary mp3.

Thanks.

If you want to play Ogg

Anonymous's picture

If you want to play Ogg Vorbis on an iPod you may find Rockbox of interest:

http://www.rockbox.org/

disconnecting the Ipod

Tom's picture

In the LJ article, Bert alluded to problems getting rid of the
do not disconnect message on the Ipod. I'm using
SuSE Professional 9.3, Ipod mini software version 1.4 and connecting
via USB. I found that if I exit gtkpod and then type eject
sda2
that the disconnect message dissappears, and the Ipod
displays its standard menu.

My solution, on Ubuntu, was

Anonymous's picture

My solution, on Ubuntu, was to open the terminal and type:

sudo eject sda2

The first time I did it, the Do Not Disconnect screen remained, but I disconnected anyway because I was sick and tired of the nonsense. Subsequent times it really did eject the iPod.

eject sda2 works.

thelenshar's picture

This works for me as well:
'eject sda2'

That did not work first time i tried it, so i tried other aproaches, like unloading the usb modules, which didn't work, cos then my mouse wouldn't work (its usb, and even though i could have used ps2, ps2 port was broken, but thats another solution if you don't have anything else on USB)

Make sure you have permission

CyberInferno's picture

I found the same problem. I didn't have permission to eject sda (I eject sda and it removes sda1 and sda2 as well). I'm using PCLinuxOS which runs on KDE. When I used su and ejected the device, it worked fine. So I went into my user account privileges and added my account to the group "disk". After I logged out and logged back in, I was able to eject it without any problems or the need of a super user account. I use Amarok and have the device set to use "eject /dev/sda" as my unmount command and it works fine when I eject it. Good luck!

'eject /dev/sda' (or

Anonymous's picture

'eject /dev/sda' (or possibly 'eject sda') should work. Just 'eject /media/ipod' or 'eject /dev/sda2' did not work for me (FC4).

Charging Ipod Shuffle

thomaslai's picture

Did u manage to charge Ipod Shuffle from Ubuntu using USB 2.0 ports? Mine can't seem to work.

Uhm, i could charge the ipod

thelenshar's picture

Uhm, i could charge the ipod video. i don't have a shuffle, so i can't test it.. i am pretty sure other people have gotten it to work, so yea, uhm, wanna explain more details?

My Ipod shuffle charges on a

Anonymous's picture

My Ipod shuffle charges on a USB 2.0 port. I've tried both the 1 Gig (I bought that) and 512MB (free from bankone). Make sure you format it FAT32 via a windoze machine

You don't need windows to

synorgy's picture

You don't need windows to format an iPod. Install gParted, plug in your iPod and fire up gParted. It will open and (once you change the device) allow you to format your iPod (or your harddrive if you aren't careful)

Unfortunately gparted is far

rguinn's picture

Unfortunately gparted is far more adept at crashing than formatting anything.

hi

Anurag's picture

You can use fdisk instead, a command line utility

Thanks for the post! But my

in confusion's picture

Thanks for the post! But my ipod is out of order.lol

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState