Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

Linux pitfall of soft links ln - Rhythm Box - Music Player on Ubuntu

I came across a strange issue on one of my Ubuntu computers. I had added some more MP3 files to my music folder and so I refreshed them by performing an import of that directory in Rhythm Box. The import command will only add new files that are not already added.

To my surprise I ended up with two of each file in my library on Rhythm Box. After a lot of head scratching and thinking that it was a bug in the system I finally found the problem.

The reason for this is that the system I was running this on was a dual boot Windows / Linux computer. Although I hardly use Windows due to the lack of support for other operating system file systems the music files are all on my Windows NTFS partition.

On Windows the files are stored as
c:\data\music

The windows disk is mounted on Ubuntu as /windows
To make life easier (and to make the directory common across all my different linux machines) I had created a symlink from /windows/data/music to /data/music . The problem is that I had originally imported from /data/music, but when I tried to update this I chose /windows/data/music.

Therefore /windows/data/music/mp3file1.mp3 and /data/music/mp3file1.mp3 were both added to RhythmBox as different files although there are in fact the same file.

The fix was to remove the entries referring to /windows/data/music in Rhythm Box (or in my case I just deleted all entries) and in future ensure that I always import from /data/music.

The moral of the story being that although links can make life a lot easier by making directory names easier to enter (and consistent across all my different computers) then you have to ensure you are consistent in using the symlink and not use the original directory as well.

Don't know what I'm talking about?

If you don't know what I'm going on about then I've created a new Tutorial on PenguinTutor which explains the different types of links (hard links and soft / symbolic links).