After Hours

How do I connect an Apple iPod to an Ubuntu Linux PC?

It is indeed possible to connect an Apple iPod MP3 player to a personal computer running Ubuntu Linux. Jack Wallen shows you what open source software application you need and how to set it up.

I just want to be able to put songs on my Apple iPod from my Ubuntu Linux machine. Fortunately, for all of us end-users, the open source community started taking seriously the call to make multimedia a priority for application development. Getting an iPod recognized and connected to a Linux machine is only slightly more difficult than it is with iTunes.

Our environment

What we are working with is the following:

  • PC: 64-bit machine running 32-bit Ubuntu 8.04 Hardy Heron
  • iPod: 5-gen 30 gig video iPod formatted in Windows format
  • Software: gtkpod-aac

Getting and installing gtkpod

You can get and install gtkpod two ways: via the command line or via the Synaptic tool. Now there are two versions of gtkpod available — one with AAC support and one without. I have installed the version with AAC support because about forty percent of my music was imported from my now-dead iBook. So I have a few M4A files to play with.

Take note that the only way you will be able to access your iPod for writing is if your iPod is formatted in the Windows format. The Apple formatted iPods can be recognized but writing to them is very difficult (and has, in my case, resulted in complete loss of data on the iPod.) So if you have an Apple-formatted iPod, save all your music, reformat your iPod in Windows format, and load all your music back on to it.

This blog post is available in the PDF format in a TechRepublic Download.

Since many people fear the command line, we're going to use the Synaptic tool to do the installation for us. You can fire up Synaptic from your menu. The desktop you use will determine from where Synaptic is launched (I use Enlightenment so I launch it from Applications | System Tools | Add/Remove.) Of course you can always issue the command (from a terminal window or from the Run Command dialog): sudo synaptic to fire up the Add/Remove tool.

Once Synaptic is running do a search for gtkpod. Once the results appear (Figure A) click the box next to the version of gtkpod you want to install.

Figure A

You can either click the box or right click the entry you want to install and select Mark For Installation.

Once you have marked the package, click the Apply button and the installation will continue. You will also notice that there will be some dependencies to be met for the installation. One dependency should be libgpod, which is the library that allows your system to access your iPod. Without libgpod you will have no luck mounting your device.

All installed, now what?

The first thing you need to do is plug in your iPod to the USB port on your machine. Once you have done that, fire up a terminal and issue the command dmesg. As you can see (Figure B) the device is seen and registered as sdc. The sdc name is what we are going to use to mount the device for the first time.

Figure B

As you can see we have sdc, sdc1, and sdc2.

Now we know (or should know) that sdc is the special device name and sdc1 is the boot partition, so sdc2 is more than likely where we want to be. So we will mount /dev/sdc2 to access our iPod. But first we must create a directory for this purpose. Run the following command:

sudo mkdir /media/IPOD

Now you are ready to mount the iPod. Run the command:

sudo mount /dev/sdc2 /media/IPOD

If you run the command ls /media/IPOD you should see the contents of your iPod.

Now, unmount the iPod with the command:

sudo umount /media/IPOD

What we need to do now is create an entry in /etc/fstab so that users can mount the iPod with the simple command mount /media/IPOD. To do this issue the command:

sudo nano /etc/fstab

And enter a line like so:

/dev/sdc2       /media/IPOD     auto    defaults,user,rw        0 0

Save the fstab file and give the mount command a try: Issue mount /media/IPOD and check to see if your iPod shows up. If it did, you're good to go.

Firing up gtkpod

You should find gtkpod in the Multimedia or Sound & Video submenu of your main menu. Fire that bad boy up, and let's get ready to connect it to your iPod. Once it is running you will need to set up a Repository for gtkpod. This isn't the same as a repo for apt (I'm not quite sure why the developers chose this confusing nomenclature, but that's what we have to deal with.) Go to Edit | Preferences and click the Set Mountpoint Or Edit Repository Options button. (Figure C)

Figure C

Without setting the mountpoint, gtkpod will not see your iPod.
Once the new window opens (Figure D) you can set the information for your iPod. The first thing you will do is click the Add New Repository/iPod button.

Figure D

As you can see my iPod is already configured.
When you click the dd New Repository/iPod button you will be greeted with a smaller window asking for some simple information. (Figure E)

Figure E

Name your repository the same as your iPod (if you named your iPod when you formatted it.)

Make sure you enter the information exactly. The mount point will be /media/IPOD (unlike that in the screenshot.) You will also need to select your iPod model from the drop-down list. Once you have entered the necessary information, click OK. Now from the Repository Options Window you should see the iPod you just created from the iPod drop down. Select that and the correct information should appear. Click OK to close the Preferences window.

Now, from the main gtkpod window, click the Load iPods button and your iPod will load. Since this is the first load it will take a while. I have 3,508 songs on my iPod so it takes a while to load. Once it has loaded, you are ready to play around.

Once you have added/removed/edited songs/playlists, you will need to make sure you hit the Save Changes button. Once all the changes are saved (and songs imported or deleted) you can then close out gtkpod.

WARNING!!!! Before you unplug your iPod you have to unmount it first. To do this go back to the command line and issue the command:
umount /media/IPOD

Once you are returned to your command line, you can unplug your iPod.

Final thoughts

Of course we didn't dig too deeply into the usage of gtkpod. The reason being is that it's very straightforward to use. What is not so straightforward is the connecting of the iPod. Hopefully, now, you have a better understanding of how to use your iPod with Linux. It's not as hard as you think. Just make sure you follow the instructions carefully and DO NOT unplug your iPod without unmounting it first.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

Editor's Picks