Baloo creates 64GB index, takes half my memory and 25% CPU

I simulated the installation of Dolphin on Ubuntu 19.04 using apt install -s dolphin. I then searched the output for packages containing "baloo":

dkb: ~/Desktop $ grep -i baloo baloo.txt

The output:

Inst libkf5balooengine5 (5.56.0-0ubuntu1 Ubuntu:19.04/disco [amd64])
Inst libkf5baloo5 (5.56.0-0ubuntu1 Ubuntu:19.04/disco [amd64])
Inst baloo-kf5 (5.56.0-0ubuntu1 Ubuntu:19.04/disco [amd64])
Inst libkf5baloowidgets-data (4:18.12.3-0ubuntu1 Ubuntu:19.04/disco [all])
Inst libkf5baloowidgets5 (4:18.12.3-0ubuntu1 Ubuntu:19.04/disco [amd64])
Inst libkf5baloowidgets-bin (4:18.12.3-0ubuntu1 Ubuntu:19.04/disco [amd64])

Installing Dolphin on Ubuntu 19.04 would pull in 100+ packages including the ones listed above. (The last package wouldn't be pulled in if I used --no-install-recommends.) It's fairly safe to conclude that installing Dolphin on your system with or without recommends pulled in baloo.

To verify that baloo is indeed installed when Dolphin is installed, I ran sudo apt install dolphin in a virtual machine of Ubuntu 19.04.

0 upgraded, 181 newly installed, 0 to remove and 0 not upgraded.
Need to get 41.2 MB of archives.
After this operation, 206 MB of additional disk space will be used.

I went ahead and after the installation was complete but without running Dolphin, I ran pgrep -a baloo and got back the prompt. In other words, baloo wasn't running.

I rebooted and ran pgrep -a baloo again but without running Dolphin:

dkb: ~ $ pgrep -a baloo
1672 baloo_file
dkb: ~ $ 

Top didn't show any unusual activity probably because there wasn't much for baloo to index. And that is reflected in the size of the index file:

dkb: ~/.local/share/baloo $ ls -al
total 516
drwxrwxr-x  2 dkb dkb   4096 Jun 28 18:05 .
drwx------ 23 dkb dkb   4096 Jun 28 18:11 ..
-rw-rw-r--  1 dkb dkb 516096 Jun 28 18:05 index
-rw-rw-r--  1 dkb dkb   8192 Jun 28 18:06 index-lock
dkb: ~/.local/share/baloo $ 

I then launched Dolphin (while keeping a terminal window with top running). Again, because there was very little to index, top didn't show any unusual activity and pgrep -a baloo gave the same output as I got after the reboot.


I still would like to understand

How did I got baloo'd, by installing dolphin maybe?
What does baloo do for me when running gnome?
  • Baloo was installed as a result of installing Dolphin on my Ubuntu 19.04 (GNOME).
  • Baloo indexes files and can index file content as well. So, from within Dolphin, you can search for files by their names and you can search for strings within certain files*. In the image below, I've searched for the string sonnet from "Everywhere".

Using baloo to find a string in file content

The screenshot has top running on the side.

So, you can use the Dolphin-baloo combination even in a GNOME session. However, by default

  • baloo doesn't index the contents of dot files and dot folders and the excluded filetypes listed in ~/.config/baloofilerc.
  • baloo also does not index external media.
  • If you have a significant number of files that can be indexed, baloo will consume resources quite heavily on its first run (and whenever you add a large number of files that can be indexed at one time).
  • baloo may gag on certain files or get stuck if its database is corrupted.
  • Some users limit baloo to only indexing files but not their content. I have baloo do both (but I've added several additional exclusions so as not to overload baloo).

* I don't know your reason for installing Dolphin on Ubuntu and so can't comment further. If you are interested in keeping Dolphin but don't want baloo active, run

balooctl status

On my Kubuntu, it shows me

04:27 PM ~/Desktop $ balooctl status
Baloo File Indexer is running
Indexer state: Idle
Indexed 2323 / 2323 files
Current size of index is 193.11 MiB
06:53 PM ~/Desktop $ 

Then, run

balooctl disable  

Doing so disables the file indexer. And the disabled state survives a reboot on Ubuntu 19.04 (GNOME):

dkb: ~ $ balooctl status
Baloo is currently disabled. To enable, please run balooctl enable
dkb: ~ $ 

Related reading: Is it safe to disable baloo_file_extractor?


Edit: Here's my ~/.config/baloofilerc in Kubuntu 18.04 ***:

[Basic Settings]
Indexing-Enabled=true

[General]
dbVersion=2
exclude filters=.moc,.pch,*.po,CMakeFiles,*.o,confstat,*.m4,.xsession-errors*,lost+found,.hg,*.part,__pycache__,*.swap,CMakeTmp,*.elc,CVS,libtool,Makefile.am,*.aux,*.lo,cmake_install.cmake,config.status,lzo,moc_*.cpp,ui_*.h,CMakeCache.txt,*.vm*,CMakeTmpQmake,*.rcore,*.pyc,.obj,*.gmo,core-dumps,confdefs.h,autom4te,qrc_*.cpp,conftest,*.rej,.histfile.*,*.class,po,*.tmp,*.la,*.loT,*.orig,.git,*.omf,*~,_darcs,.uic,CTestTestfile.cmake,.svn,.bzr,litmain.sh,*.moc,*.nvram,*.csproj,*.pc,*.jpg,*.png,*.iso.,*.AppImage,*.deb,*.mp4,*.mkv
exclude filters version=2
exclude folders[$e]=$HOME/.cache/,$HOME/.config/,$HOME/.dropbox/,$HOME/.dropbox-dist/,$HOME/.local/,$HOME/.mozilla/,$HOME/.recoll/,$HOME/.themes/,$HOME/.thumbnails/,$HOME/Desktop/,$HOME/Downloads/,$HOME/Dropbox/Screenshots/,$HOME/MyFox/,$HOME/Public/GeanyBackups/
first run=false
folders[$e]=$HOME/
only basic indexing=false

***: I think baloo ignores dot files and dot folders in the version present in Kubuntu 18.04 and so excluding dot files may have been unnecessary!


Your questions:

  1. How did I get baloo, by installing dolphin maybe?

    aptitude why shows the causes for packages to be installed (install it with sudo apt-get install aptitude if you don't have it). For instance, I had the same inquiry as you, and I ran

    $ dpkg -l | grep baloo
    ii  baloo-kf5                                     5.68.0-0ubuntu1                            amd64        framework for searching and managing metadata
    ii  libkf5baloo5                                  5.68.0-0ubuntu1                            amd64        framework for searching and managing metadata core lib.
    ii  libkf5balooengine5                            5.68.0-0ubuntu1                            amd64        framework for searching and managing metadata plugins
    ii  libkf5baloowidgets-bin                        4:19.12.3-0ubuntu1                         amd64        Wigets for use with Baloo - binaries
    ii  libkf5baloowidgets-data                       4:19.12.3-0ubuntu1                         all          Wigets for use with Baloo - data files
    ii  libkf5baloowidgets5:amd64                     4:19.12.3-0ubuntu1                         amd64        Wigets for use with Baloo
    

    to tell the name of the packages, and then

    $ aptitude why baloo-kf5
    i   dolphin-plugins Depends dolphin  
    i A dolphin         Depends baloo-kf5
    $ aptitude why libkf5baloo5
    i   dolphin-plugins Depends dolphin                            
    i A dolphin         Depends libkf5baloo5 (>= 5.3.0+git20150512)
    $ aptitude why libkf5balooengine5
    i   dolphin-plugins Depends dolphin                            
    i A dolphin         Depends libkf5baloo5 (>= 5.3.0+git20150512)
    i A libkf5baloo5    Depends libkf5balooengine5                 
    

    to tell the chain of dependencies leading to the installation of some of the baloo-related packages (just for the sake of illustration, the first aptitude command already shows that dolphin required baloo). The information shown in the output of the last command should be read: "dolphin-plugins was installed manually. dolphin-plugins required dolphin, which was installed automatically then. dolphin required libkf5baloo5, which was installed automatically then. libkf5baloo5 required libkf5balooengine5, which was installed automatically then. libkf5balooengine5 did not require any other package to be installed automatically."

  2. What does baloo do for me when running gnome? I split this in two parts.

    1. What does baloo do...? Generally speaking, baloo indexes files for later fast searching.
      What are the differences with other indexers, as mlocate? mlocate indexes file names only. baloo can index file contents, so that searching returns "better" results (depending on the way you configure baloo). Of course, baloo can be configured to index only file names (see locate vs. baloo and answer there), for instance in the interest of storage space, in which case it is similar to mlocate.
    2. ... for me when running gnome?
      This can be rephrased as How can I use the data indexed by baloo? As expected, dolphin makes use of baloo to search for files, either names or contents, in its searches (which you can pull with either the magnifying glass at the top right or the "Search for" list in the side bar). This is regardless of you using Gnome or other session manager.

    In addition, Gnome (and here I am answering specifically to your mention of it) has its Activities search bar, which is a more complex search tool. Without going into much detail, this Gnome search is fed by Search providers. A few such providers are setup with the initial installation, but you can add others, so that the search results include those as well. In principle, I guessed baloo could be a search provider as well. So far, I could not find information on how to do that.