Friday, April 18, 2008

The Great Rhythmbox Meltdown of 2008: After-Action Report

In addition to rebuilding my mp3 library, a fair portion of the last week has been dedicated to determining what exactly caused Rhythmbox to crash and how to correct my unfortunate mis-clicking with led to most of my music files ending up in the Trash bin (and overloading said bin). I will admit my aversion to Rhythmbox made me lose my cool when the problem first appeared and that greatly contributed to the scale of the problems. I thought this warranted a post because this problem was by far the most pervasive issue I’ve had with Ubuntu so far and solving it has/will required me to really consider different approaches to the problem(s).

See full post for my problems, the solutions and some future actions on my part to improve the situation.

I. Problems
Overall, I have three problems that started with the first one and got progressively worse:

1) Rhythmbox began importing non-music files from places NOT in the selected “Import” folder: For some reason, it began importing files from the Windows partition of my internal drive (totally separate drive and partition from the import folder). It just kept adding non-music files at such a rate that removing them didn’t really do any good and it slowed Rhythmbox to a crawl.

I decided to remove everything from my music library and start over. Unfortunately, I clicked “Delete” (send to trash) by mistake. This promptly sent ~2000 music files to Trash before I could initiate the “Force-Quit” for Rhythmbox (which was the only thing which stopped the transfer). Apparently, 1980 mp3 files are too much for Trash which led to my second problem.....

2) When “Trash” got overwhelmed it messed up Nautilus: Which makes some sense, since you access Trash through Nautilus. First of all, I transferred all the files out of Trash and placed them in a “Holding” folder I created for files that needed to be filed later. Once Trash was cleaned out, it recovered well. However, transferring the music files back into my library has slowed down because every so often Nautilus gives me errors when accessing my external HD.

When these messages occur, if I attempt to close and reopen windows to the same files locations, Nautilus doesn’t allow me to. Sometimes if I wait a while, I can access the files and sometimes, I need to restart my computer to regain access. The system logs don’t reveal anything out of the ordinary (error messages, etc).

3) I was getting a lot of glitches in various places: From just browsing my desktop to updating my system, it’s sluggish and prone to freezing up. None of this was occurring before and now, I can’t seem to get away from it. There’s no one thing just a general bugginess. This is quite frustrating.

II. Solutions

1) Rhythmbox was actually the easiest to fix in a way. I never liked the program and only started using it because the no-longer supported XMMS caused sound-card problems in Gutsy. I attempted a couple of times to reopen Rhythmbox in order to see if I could prevent it from importing non-music files in such great numbers...I had no success at all. I also have no idea why Rhythmbox would be retrieving files from a totally separate partition from the import folder shown under “Preferences”!

After some digging, I found I was not alone in having this problem. Unfortunately, none of these posts revealed a solution to the problem. Finally, I just removed Rhythmbox from my machine. I was worried the “Add/Remove” application would tell me I had to do it in Synaptic due to dependencies. However, it was not necessary at all; a few mouse-clicks and this frackin’ app was GONE. I’m currently giving other music players a try but haven’t decided on a replacement just yet.

2) Correcting the Nautilus issues was a great deal trickier. My main problem is that when I try to cut-and-paste the music files back into my library folders, after about 20-50 files Nautilus crashes. I cannot restart Nautilus (for any purpose) usually unless I restart my computer. Thankfully, I can still see the files when maneuvering from the terminal so I know they haven’t been erased or anything.

But I can’t move them from within the terminal because most of the music files have spaces in the files names which the terminal does not recognize. For example:

mv 01 Black Tambourine.mp3 /media/sdb3/MyMusic/Beck/
Doesn’t work because the computer thinks I’m trying to move 3 separate files: “01”, “Black” and “Tambourine.mp3”. Eventually, if I plan to use terminal more often I will need to convert the file names to have underscores (_) instead of spaces. This will be incredibly tedious for 2500+ files so obviously, I’m not doing it right now.

Fortunately, I’m not completely without options regarding the terminal. Opening Nautilus in root appears to work quite well. To do this, use the below command & provide password when prompted:
gksudo nautilus
Now, Nautilus still crashes after so many files but (1) the terminal displays error messages so I can get some idea of the problem and (2) root-Nautilus can simply be re-launched without reboot of the computer. Unfortunately, I got a bad case of tunnel vision and started relaunching root-Nautilus in order to rebuild my music library; this probably wasn't a good idea and I would recommend to anyone else to correct the problem so you don't have to use root-Nautilus (which is a bit dangerous)....

At this point, my problem is...”case 17 (too many open files)”. This error has occurred for other users: See here & here. It appears to only effect single cut-&-paste actions for music files. When moving a large group of files all at once, it doesn't cause a problem.

In the second link, there's a comment that describes the problem in technical terms I only vaguely understand but recommends installing the following package:
The comment also provides a rather complicated command-line means of monitoring Nautilus to see if you're developing this problem.

Another comment mentioned opening a Nautilus window then going to the Edit-->Preferences-->Preview menu. For "Sound Preview" select "Never".

After I did both actions I resumed cutting-and-pasting to see what happened....IT WORKED! I moved 140+ files with no errors at all.

(Before I found these fixes, I performed some memory & disk checks; the results were inconsistent so I'm probably going to have to investigate that issue further.)

3) Miscellaneous Glitches. Interestingly greatly decreased once I removed Rhythmbox. It completely disappeared after I fixed Nautilus; apparently, it was using up memory trying to "preview" all those sound files. I have no idea why but I’ll be on the lookout for it reappearing.

III. Future Actions

This begins and ends with the most obvious failing: Human error. What could have been a Rhythmbox-only problem was greatly compounded by my poor reaction and subsequent mis-clicking on “Delete” instead of “Remove from Library” in Rhythmbox. While I’m really angry at myself about the panicking, it appears I’m not alone in making this mistake.

In the future, I need to be more careful about knowing which actions are irreversible and controlling my cursor better to I don’t accidentally initiate said irreversible actions. Also, I need to kill malfunctioning processes quicker. If I had killed Rhythmbox sooner, it would have transferred less music files and potentially not crashed my Trash folder.

I think this time I'll do some serious shopping around before selecting a music player for my desktop. In addition, I need to give a higher priority toward renaming my music files so they can be easily manipulated from the terminal. Also, I noticed that I somehow have 300 more music files on my portable mp3 player than I have in my music library. I have no idea how that’s possible as every song is saved on my computer before transferring to the player but it looks like I need to do a detailed review of all the files to see what’s going on there.

And finally, I need to figure out why my disk checks got sometimes passed and sometimes didn't. It might be a sign of a drive failure or memory wipe to come so I can't let it wait too long...

1 comment:

Anonymous said...

the terminal actually can handle spaces in file names, with slight modification. For example:

"mv 01 Black Tambourine.mp3 /media/sdb3/MyMusic/Beck/"

should be

"mv 01\ Black\ Tambourine.mp3 /media/sdb3/MyMusic/Beck/"

In general, if the terminal screws up because of a specific character, you can put a backslash before every instance of the problematic character and things will work properly.