Sync muzak in Alpine Linux with iPod Classic

Last Update:

Status: DONE

As of writing, I am using Alpine Linux stable as my main daily driver.

We have an old iPod Classic (6th Gen) from a previous project that is just sitting unused.

This project lists the steps to get the music library from my Alpine Linux machine into the iPod.

On this page (click to [un]hide)

Assumptions

Before we start, I have the following ready:

go to top ⤒

Install Rhythmbox for GUI needs

# apk add rhythmbox

Where # signifies that the command be run as root, i.e., with doas. (On the other hand, $ signifies that a command be run as the user.)

Rhythmbox is a FOSS-copy of iTunes, which means it supports iPod devices.

go to top ⤒

Install GFVS

# apk add gvfs

Rhythmbox needs GNOME Virtual File System (GVFS) backend in order for it to detect Apple devices when they are plugged in.

go to top ⤒

Install Gstreamer plugins

# apk add gstreamer gst-plugins-good

Gstreamer is a framework for streaming media that would allow Rhythmbox, among other things, to scan your library and import music from it during first setup.

go to top ⤒

Adjust Preferences in Rhythmbox

In the Rhythmbox, be sure to adjust Preferences like:

go to top ⤒

Plug the iPod in and detect it

Plug the iPod in. If you check Rhythmbox, it won’t appear there yet.

Check the partition by running fdisk with the -l flag.

# fdisk -l

...

Disk /dev/sdc: 119.19 GiB, 127976345600 bytes, 31244225 sectors
Disk model: iPod            
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

...

In the sample output above, the iPod is under the disk /dev/sdc.

But we have to be specific. When we run lsblk we’ll notice that there are two more partitions within it.

$ lsblk

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
...
sdc       8:32   1 119.2G  0 disk
├─sdc1    8:33   1   248K  0 part
└─sdc2    8:34   1 119.2G  0 part
...

In the sample output above, we can surmise that sdc2 is the more relevant block, because its size is significantly larger than sdc1. This is what we will mount to our system.

go to top ⤒

Mounting the iPod

Mounting means attaching the file system of a device—in this case, the iPod—to the computer. As we have noticed in some Linux distros, including Alpine, physically plugging a device in via USB port doesn’t necessarily make it available to the system, unless we “mount” it.

Hierarchical File System (HFS) is the file system in the iPod. To access it, we can get Apple’s needed utilities by installing hfsprogs:

# apk add hfsprogs

Then create a mounting point (a directory through which the computer can access the iPod’s files):

# mkdir -p /mnt/ipod

Now, we can mount the iPod to the computer, running this command:

# mount -t hfsplus /dev/sdc2 /mnt/ipod

The command above means that we are mounting the iPod (/dev/sdc2) to our mounting point (/mnt/ipod), specifying that the file system is Apple’s HFS (-t hfsplus).

To check if it has been properly mounted, run lsblk and inspect the output:

$ lsblk

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
...
sdc       8:32   1 119.2G  0 disk
├─sdc1    8:33   1   248K  0 part
└─sdc2    8:34   1 119.2G  0 part /mnt/ipod
...

sdc2 (the relevant partition of the iPod) is now mounted to the point we just created, /mnt/ipod

go to top ⤒

Success!

Navigating through the Rhythmbox’s GUI, the iPod should be shown now under Devices on the left sidebar. We can now Sync music (and/or podcasts) and, later, Eject the iPod.

Graphical User Interface of Rhythmbox when an iPod is plugged in, ready for syncing

Current line up; name of iPod redacted

WARNING: When syncing, the music in the Linux machine will replace any existing music in the iPod. I haven’t found a way to transfer the existing songs in the iPod to the Linux machine, and I’m not sure if it’s even possible, but that is outside the scope of this post.

go to top ⤒

Ejecting, unmounting, and unplugging

Before unplugging, click Eject in the Rhythmbox GUI. Not doing this will throw an error when we try to unmount it, saying that device is “busy”.

When that’s done, let’s go back to the command line and unmount the iPod:

# umount /mnt/ipod

You can now safely unplug the iPod.

go to top ⤒

Appendix

… or, possible avenues to explore in the future:

go to top ⤒

Useful? Consider supporting me.

Back to Index :: Log :: Projects


"Sync muzak in Alpine Linux with iPod Classic" project is licensed under CC BY-NC 4.0