How to disable packagekitd?

thierry@

Developer
In Kde Settings / System, I've set the frequency of updates to "never", but packagekitd is still launched with every session and I have to kill it manually.
Is there a way to disable it?
 
If it's launched with every session, see if there is an autolaunch/launch at startup entry. If there is, just disable that.
 
No. Usually the big desktop environments make use of dynamic freedesktop dbus activation stuff. The gift that keeps on giving it to you.
Look under /usr/local/share/dbus-1/system-services
 
No. Usually the big desktop environments make use of dynamic freedesktop dbus activation stuff. The gift that keeps on giving it to you.
Look under /usr/local/share/dbus-1/system-services
Yes, you found it:
/usr/local/share/dbus-1/system-services/org.freedesktop.PackageKit.service

But how to disable it?
 
chflags schg
This will prevent any change to the file, not only permissions (so upgrading too); don't know how pkg would react, but I suppose it could stop due to not being able to overwrite the old one or a checksum mismatch.
 
put
LD_PRELOAD=/full/path/setlocale_hook.so
somewhere in your env
when packagekitd will call setlocale this will cause it to exit :))
setlocale seems to be the first lib function called by packagekitd
C:
/* setlocale_hook.c
 *
 * Build:  cc -shared -fPIC -O2 -o setlocale_hook.so setlocale_hook.c
 * Use:    LD_PRELOAD=/full/path/setlocale_hook.so
 */
#include <sys/types.h>
#include <sys/sysctl.h>

#include <dlfcn.h>
#include <libgen.h>
#include <limits.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define TARGET_NAME "packagekitd"
#define EXIT_CODE   0

/* Returns 1 if the running executable is TARGET_NAME. */
static int
is_target(void)
{
    static int cached = -1;
    char path[PATH_MAX];
    size_t len = sizeof(path);
    int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };

    if (cached != -1)
        return cached;

    /* Prefer the real executable path; argv[0]/getprogname() can be spoofed. */
    if (sysctl(mib, 4, path, &len, NULL, 0) == 0) {
        char *base = basename(path);
        cached = (base != NULL && strcmp(base, TARGET_NAME) == 0);
    } else {
        const char *pn = getprogname();
        cached = (pn != NULL && strcmp(pn, TARGET_NAME) == 0);
    }
    return cached;
}

char *
setlocale(int category, const char *locale)
{
    static char *(*real_setlocale)(int, const char *) = NULL;

    if (is_target())
        _exit(EXIT_CODE);    /* use exit() if you want atexit handlers to run */

    if (real_setlocale == NULL) {
        real_setlocale = (char *(*)(int, const char *))
            dlsym(RTLD_NEXT, "setlocale");
        if (real_setlocale == NULL)
            _exit(127);
    }
    return real_setlocale(category, locale);
}
 
  • Like
Reactions: drr
Yes, you found it:
/usr/local/share/dbus-1/system-services/org.freedesktop.PackageKit.service

But how to disable it?
Normaly you can overwrite a dbus service in your ~/.local/share/... dir but not for the system-service ones. So, according to the docs https://dbus.freedesktop.org/doc/system-activation.txt , you should be able to overwrite it in /usr/local/etc/dbus-1/ . Just create the dir , copy over that file and modify the Exec to /usr/bin/false

Rant: I personally vote for covacat solution , way more entertaining and educational. For me dbus has some wiff of $hit. Felt wrong from day1, not as much as policykit/consolekit, but still...
 
Back
Top