23

Since a few months, on one of the desktop Ubuntu 14.04 systems I use, CPU has regularly been going up to 80-100% for no apparent reason. htop would usually attribute responsability to file system processes, such as nemo or ntfs. To get CPU back down I would kill these process, which in some cases would lead to loss of access to the file system and a consequent restart.

Days ago I noticed that whenever this situation happened another process was always present also using high CPU: mediascanner-service-2.0. Some research lead me to this thread at the Forum that simply advised its removal. So I did.

The end result has been unexpectedly positive: not only are the high CPU load episodes gone, the system is altogether much faster. The speed up of the Lens is dramatic: finding an application like Calc now takes 2 seconds at most when previously it took some 20 seconds. Finding a file takes now some 5 seconds, whereas before it took in the order of 30 seconds. Heavy programmes like Eclipse are starting up faster and workspaces are more fluid. There seems to be also an overall reduction in the frequency of disk access.

What is exactly this mediascanner2.0 package? Is it part of Unity 7 or a dependency that gets installed a posteriori? Is it possible to prevent its installation?

Update: following Seth's suggestion it is possible to track this package down to indicator-session:

$ sudo aptitude why mediascanner2.0
i   indicator-session         Recommends indicator-applet (>= 0.2) | indicator-renderer
i A unity8                    Provides   indicator-renderer                            
i A unity8                    Recommends unity-scope-mediascanner2                     
pi  unity-scope-mediascanner2 Depends    mediascanner2.0                               

Apparently, mediascanner2.0 (and the Unity 8 shell) are part of the base 14.04 system. Left to answer is the exact function of this rogue package.

  • 1
    Whatever it is it doesn't exist in Utopic.. – Seth Feb 19 '15 at 18:58
  • 1
    It does. And for Vivid too. – Luís de Sousa Feb 19 '15 at 19:11
  • dupe(?) askubuntu.com/questions/541928/… – Rinzwind Feb 19 '15 at 19:21
  • 1
    Looks like it was installed either through the ubuntu-sdk or a Ubuntu Touch/Unity 8 related package. Do you have either installed? What it is is a bit more of a mystery.. Obviously it is looking for media files somewhere ;) – Seth Feb 19 '15 at 19:33
  • 2
    @LuísdeSousa In that case the quickest way to figure out why would be to install aptitude (sudo apt-get install aptitude) and then run: sudo aptitude why mediascanner2.0. Please edit the output into your question. – Seth Feb 19 '15 at 20:11
18

mediascanner2.0 is a package used in Unity 8 to discover media and then play it. For example, the Core Music App on Unity 8 uses mediascanner to scan the music directory(or any directory for that matter) and then play back music. Since Ubuntu is moving towards Unity 8, it is included by default in the Ubuntu iso.

mediascanner is scanning your whole hard drive to discover media, so the first time around, it will slow your computer. Eventually, it should cache its results, and then it will stop being so resource intensive.

You have two options to help fix your issues:

  1. (Prefered solution)You can explicitly tell mediascanner to not attempt to scan a directory by creating a new fie and titling it .nomedia. Then, when mediascanner reaches this directory, it will not even bother to index it. In theory, you can do this for as many directories on you computer, and mediascanner should stop indexing them.
  2. You can uninstall it, which in the short term(Until Unity 8 becomes default) will stop this from occurring, but you run the risk to running into dependency issues. Note: If you are doing Ubuntu SDK development, mediascanner is a dependency.

Hope this helped :)

Source

  • If it were that simple, it would not be loading the system as it did. Moreover, my Music folder is empty. – Luís de Sousa May 26 '15 at 6:11
  • 2
    mediascanner is scanning your whole hard drive for files. As described here: bugs.launchpad.net/ubuntu/+source/mediascanner2/+bug/1294303 , you can create a new text file and name it .nomedia to tell mediascanner not to search that directory. Unfortunately, you will have to do this for many of the directories on your HD. – Max Tither May 26 '15 at 23:34
  • 2
    Thanks Max, that is a useful comment. Why don't you correct your answer with this information? – Luís de Sousa May 27 '15 at 6:02
  • Since this question has been getting some attention, I should clarify why I have not marked this answer as a solution. The mediascanner2.0 package gets re-installed some time after being removed (possibly by the automatic updates). It also remains unclear what its function is. Everything works much better and faster when it is not installed, including the media applications. – Luís de Sousa Sep 9 '15 at 18:17
  • 1
    The solution outlined here askubuntu.com/questions/541928/… stopped excessive disk grinding for me. – batFINGER Apr 4 '16 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.