Ubuntu – Baloo creates 64GB index, takes half the memory and 25% CPU

indexingkde

On 19.04 under gnome, baloo creates a 64GB index, takes half my 16GB memory and 25% CPU.

After uninstalling baloo following
baloo_file_extractor in Ubuntu 18.04 LTS taking up a lot of memory
the problem goes away.

I still would like to understand:

  • How did I get baloo, by installing dolphin maybe?
  • What does baloo do for me when running gnome?

Best Answer

  • 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!