0

Previous subject: "zeitgeist-daemon: what keeps restarting it and how to make it stop?"

Updated subject (can revert if I am wrong): May be, this question should actually be "Why systemctl doesnt list/manage zeitgeist-daemon, and what/who actually does?", as in: how can any service not be managed??? Unless I just dont know how to use it correctly yet, if so I edit here later..

ubuntu 16.04

For a long time, since I installed it, my machine was sluggish, everything if not a bit, a lot slow. The system load was frequently high on the indicator (this may be another problem caused by it). I couldn't understand what was happening, I thought was my hard drive, defective memory, or all the other processes running...

To my complete surprise, I followed these steps:

https://nixaid.com/disable-zeitgeist-in-ubuntu-16-17/

mainly sudo apt-get purge zeitgeist-datahub
(we cant uninstall zeitgeist fully as it would uninstall Unity3D/compiz and it rocks!)

and after reboot my machine is a lot faster!
applications open faster and work faster!

but...

the only thing that didn't work was this command:
systemctl --user list-unit-files |grep -i zeitgeist
it returns nothing.

So I need to know, where this executable is configured to keep restarting?
zeitgeist-daemon

I sudo grep /etc but found nothing either.

I kept a loop with zeitgeist-daemon --quit every 3s, to keep my old machine fast as new!

But I prefer to properly disable zeitgeist-daemon auto restart.

PS.: I tried other answers here but were for older ubuntu version or hackish (like renaming that executable, dont understand me wrong, it is cool as solves things fast, but as last resort as may lead to unpredictable interactions with other applications depending on a proper setup/configuration). I wanted something more "system safe" to prevent breaking other things I could have a hard time to track and understand later.

PS.2: I am not saying zeitgeist is bad, but on my hardware it is quite problematic, I almost give up and bought a new machine. But I think what it does is great, to help on recent files used etc, now I have not these functionalities, but as my machine is much more responsive, I am much more satisfied now. If zeitgeist could be less encumbering on the whole system I would re-enable it for sure!


ok found something

locate -i -r ".*zeit.*[.]service$"

/usr/share/dbus-1/services/org.gnome.zeitgeist.fts.service

/usr/share/dbus-1/services/org.gnome.zeitgeist.service Exec=/bin/sh -c "/usr/lib/x86_64-linux-gnu/zeitgeist/zeitgeist-maybe-vacuum; /usr/bin/zeitgeist-daemon"

Now how to execute some other safe command (like systemctl) that actually knows about it to disable it making it sure nothing else will break? (as sure as possible of course)


I tried all listing commands from here (none shown anything for grep zeit -i):
https://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/


from the manual page:

EXIT CODES
       0      Zeitgeist terminated normally.
       1      An unspecified error occurred.
       10     There is already a running Zeitgeist instance.
       21     Could not access the database file.
       22     The database file is locked.

it seems safe to use @Jos tip (thx!) as chmod -rw ~/.local/share/zeitgeist/activity.sqlite should provide the expected code 21, and if it is expected it is safe :)

I still have to try manually editing the service files I found to see what happens, but by not using an application to do that, it may cause problems later... so editing it manually is not what I prefer, is just a test.

  • You could make the database un-writable (chmod -rw ~/.local/share/zeitgeist/activity.sqlite) or do you find that too hackish? – Jos Jun 18 '18 at 10:57
  • xD, I could, but will that break something else I will spend a week trying to understand what caused the problem? btw I found some clues. I like the tip btw, will use as fallback if else doesnt :). Also, if the application changes to grant self access to it again (as it is it's own file), the hack may fail later. – Aquarius Power Jul 05 '18 at 19:28

2 Answers2

3

As your search results indicate, this is a DBus service. AFAIK there aren't commands to disable DBus services - they're started when something requests that service via DBus. This comment on the DBus issue tracker indicates that one way to disable them would be to override it with a matching file in ~/.local/share/dbus-1/services. For example:

$ cat ~/.local/share/dbus-1/services/org.gnome.zeitgeist.Engine.service
[D-BUS Service]
Name=org.gnome.zeitgeist.Engine
Exec=true
SystemdService=zeitgeist.service

With this, files, zeitgeist-daemon no longer automatically starts up for me.

muru
  • 197,895
  • 55
  • 485
  • 740
  • Great explanation, thx vm! I will just test it :D – Aquarius Power Jul 03 '18 at 16:59
  • 1
    worked great! I kept the db file access mode and ps -A -o pid,cmd |grep zeit -i never catches anything. I think this is as good as a command, as this is a cfg overrider, Exec=true where true is that simple command is quite good :) – Aquarius Power Jul 04 '18 at 13:26
0

this is a complementary answer to the accepted one https://askubuntu.com/a/1051702/46437

this (still simple) script makes it easy to disable any dbus service

#!/bin/bash

set -Eeu
trap 'echo "error $? at line $LINENO"' ERR

strExecutable="$1"

function FUNCechoE(){
  echo "Err: $@" >&2
  return 0
}

function FUNCechoW(){
  echo "Wrn: $@" >&2
  return 0
}

strMatches="`egrep "$strExecutable" /usr/share/dbus-1/services/* -c |grep -v :0`" &&: #returns 1 always even if succeeds??
declare -p strMatches
if((`echo "$strMatches" |wc -l`!=1));then
  FUNCechoE "more than one match found"
  exit 1
fi

strFile="`echo "$strMatches" |sed -r 's@(.*)(:[[:digit:]]*)@\1@'`"
declare -p strFile
if [[ ! -f "$strFile" ]];then
  FUNCechoE "can't find file"
  exit 1
fi

function FUNCcoldf() {
  colordiff -y "$strFile" "$strTargetFL"&&:
  return 0
}

strTargetFL="$HOME/.local/share/dbus-1/services/`basename "$strFile"`"
declare -p strTargetFL
if [[ -f "$strTargetFL" ]];then
  FUNCcoldf
  FUNCechoW "disabler override already set"
  exit 0 #not a problem to be solved
fi

cat "$strFile" |sed 's@Exec=.*@Exec=true@' >"$strTargetFL"
FUNCcoldf

the input param is the service executable you can find thru ps etc

won't work for all services yet, so if someone find a way to let it work better just say how :)

Ps.: meta - answer nesting would be interesting