禁用占用资源、复制数据的 Gnome 跟踪器守护进程比应有的困难得多。我正在使用 Gnome 运行最近安装的(稳定)Debian 11.2。
我发现的一项建议是编辑所有/etc/xdg/autostart/tracker-*.desktop
文件,以便
X-GNOME-Autostart-enabled=false
(它是true
)
尽管据称这对某人有效,但从前,可惜的是,这种改变并没有产生明显的效果。
由于我正在运行跟踪器的版本 2,我也尝试过:
systemctl --user mask tracker-store.service tracker-miner-fs.service tracker-miner-rss.service tracker-extract.service tracker-miner-apps.service tracker-writeback.service
显然,这种方法有效,尽管系统日志仍然不断报告跟踪器服务“成功”。也许这些条目是如何为跟踪器服务配置 systemd 的产物。 “屏蔽”方法的问题在于,重新启用跟踪器守护进程的反向操作(mask
-> unmask
)对我来说不起作用。 (是的,我按照指示重新启动。然而,跟踪器守护进程没有恢复运行。)
答案1
我有同样的问题;我禁用它:
sudo systemctl --global mask tracker-miner-fs-3.service
sudo systemctl --global mask tracker-xdg-portal-3.service
当然,这应该可以防止服务再次启动全部用户;然而,如果你想阻止当前的,你应该杀死他们。
我正在使用 debian sid。
答案2
事实证明,整个/etc/xdg/autostart/tracker-*.desktop
过程在多个方面存在误导:
跟踪器守护程序和这些文件之间不存在一一对应的关系。有 2 个这样的文件,但有 3 个守护进程。
我仅通过研究系统日志才发现这三个守护进程的存在/身份。
跟踪器都在用户空间中。如果用户未运行,则跟踪器守护程序不会运行。当,于这建议,我用过:
systemctl --user mask tracker-store.service tracker-miner-fs.service tracker-miner-rss.service tracker-extract.service tracker-miner-apps.service tracker-writeback.service
...(正如我之前报道的那样确实有效),我在当前用户的主目录中创建符号链接。
~/.config/systemd/user
例如,在 Debian 11/Gnome 中,这些位于tracker-extract.service -> /dev/null
。但有一个问题:您必须以您希望禁用其跟踪器守护程序的用户身份登录才能运行
systemctl --user ...
。这对于打算运行但不登录的用户来说很不方便。其中一个用户是Debian-gdm
,显然默认情况下,跟踪器守护程序在 gdm 问候程序运行时运行。更糟糕的是,sudo -u thisuser systemctl --user ...
即使我以 root 身份登录也无法工作。因此,为了完全禁止跟踪器守护进程运行,您必须找到一种以 Debian-gdm 身份登录的方法。
因此,我目前解决真正禁用跟踪器守护进程问题的解决方案只是编写脚本,在每个受影响的用户的目录中创建和删除这些链接。重要的是要了解符号链接的名称会有所不同,具体取决于您运行的是跟踪器 v2 还是 v3。同样重要的是要了解,并非systemctl --user ...
所有发行版都使用上面提到的所有服务。在 Debian 11/Gnome 上,至少到目前为止,只使用了 6 个中的 3 个。不过,屏蔽(创建对应的符号链接)未使用的链接似乎并没有什么坏处。
如果跟踪器守护进程一直在运行,它们就会创建数据,这些数据的存在可能会也可能不会产生安全问题。 (这些数据当然是我所关心的。)要删除这些数据,据称推荐的程序是:
tracker reset --hard
(对于 v2)
或
tracker3 reset -s -r
(据说是对于 v3)
但同样,您需要以要销毁跟踪器数据的用户身份登录。我再次发现,对于每个用户来说,简单地删除它更安全、更容易,
~/.cache/tracker
和
~/.local/share/tracker
或跟踪器数据恰好存储的任何地方。
您可能还希望考虑如何处理先前泄漏到系统日志中的详细跟踪器报告。
答案3
最近我的机器也遇到了同样的问题,全新安装后,它占用CPU资源,使电脑变慢。我的解决方案是更改其值以使其运行,但使其无法执行任何工作。下面是需要设置值的脚本:
#!/usr/bin/env bash
# make tracker3 daemon non workable & idompotent
# this script will reset its settings, and configure tracker3 daemon, to not let it do anyting.
# if other code has dependency on this tracker, then it will not break, but we also do achieve our goal.
# interpretation for org.freedesktop.Tracker3.Miner.Files enable-monitor from this file
# https://gitlab.gnome.org/GNOME/tracker-miners/-/blob/master/src/miners/fs/tracker-config.c
# Time in seconds before crawling filesystem (0->1000)
# looking at source code https://gitlab.gnome.org/GNOME/tracker-miners/-/blob/master/src/miners/fs/tracker-main.c#L406
# it seems like -ve value will starts it right away, so giving max value will make it to wait max before failing
gsettings set org.freedesktop.Tracker3.Miner.Files initial-sleep 1000
# Set to false to completely disable any monitoring
gsettings set org.freedesktop.Tracker3.Miner.Files enable-monitors false
# Sets the indexing speed (0->20, where 20=slowest speed)
gsettings set org.freedesktop.Tracker3.Miner.Files throttle 20
# Set to true to index while running on battery
gsettings set org.freedesktop.Tracker3.Miner.Files index-on-battery false
# Set to true to index while running on battery for the first time only
gsettings set org.freedesktop.Tracker3.Miner.Files index-on-battery-first-time false
# Set to true to enable traversing mounted directories for removable devices (this includes optical discs)
gsettings set org.freedesktop.Tracker3.Miner.Files index-removable-devices false
# Set to true to enable traversing CDs, DVDs, and generally optical media
# (if removable devices are not indexed, optical discs won't be either)
gsettings set org.freedesktop.Tracker3.Miner.Files index-optical-discs false
# Pause indexer when disk space is <= this value
# (0->100, value is in % of $HOME file system, -1=disable pausing)
# hmm, seems like this line https://gitlab.gnome.org/GNOME/tracker-miners/-/blob/master/src/miners/fs/tracker-main.c#L124
# is misleading, as used by some blog, -ve value disable pausing of tracker, rather then tracker itself,
# and 100 will make it idompotent as any other value is always < 100%
gsettings set org.freedesktop.Tracker3.Miner.Files low-disk-space-limit 100
# List of directories to crawl recursively for indexing (separator=;)
# Special values include: (see /etc/xdg/user-dirs.defaults & $HOME/.config/user-dirs.default)
# &DESKTOP\n"
# &DOCUMENTS\n"
# &DOWNLOAD\n"
# &MUSIC\n"
# &PICTURES\n"
# &PUBLIC_SH
# &TEMPLATES\n"
# &VIDEOS\n"
# If $HOME is the default below, it is because $HOME/.config/user-dirs.default was missing.
# hmm, i think emptying its value will make it work on all dirs, i probably seen that check somewhere
# anyways, redirecting to nonexistent directory will mislead and stop its loop furthur
gsettings set org.freedesktop.Tracker3.Miner.Files index-recursive-directories "['nonexistentdir1']"
# List of directories to index but not sub-directories for changes (separator=;)\n"
# Special values used for IndexRecursiveDirectories can also be used here"
# same with this, as was with index-recursive-directories, but these dirs are removed from index-recursive-directories
# so giving it diff value will be more idompotent to this
gsettings set org.freedesktop.Tracker3.Miner.Files index-single-directories "['nonexixtentdir2']"
# List of directories to NOT crawl for indexing (separator=;)"
# this uses regex, patterns so * will match to everything
gsettings set org.freedesktop.Tracker3.Miner.Files ignored-directories "['*']"
# List of directories to NOT crawl for indexing based on child files (separator=;)"
# this uses regex, patterns so *, *.*, .* will matches to everything
gsettings set org.freedesktop.Tracker3.Miner.Files ignored-directories-with-content "['*', '*.*', '.*']"
# List of files to NOT index (separator=;)"
# this uses regex, patterns so *, *.*, .* will matches to everything
gsettings set org.freedesktop.Tracker3.Miner.Files ignored-files "['*','*.*','.*']"
# Interval in days to check the filesystem is up to date in the database,
# maximum is 365, default is -1.
# -2 = crawling is disabled entirely
# -1 = crawling *may* occur on startup (if not cleanly shutdown)
# 0 = crawling is forced
gsettings set org.freedesktop.Tracker3.Miner.Files crawling-interval -2
# Threshold in days after which files from removables devices
# will be removed from database if not mounted.
# 0 means never,
# maximum is 365.
# so, 1 will clear everything, if its stored, daily
gsettings set org.freedesktop.Tracker3.Miner.Files removable-days-threshold 1
# hmm, it didn't explain this key behaviour, so i think making it false will be better,
# then its default true, As this will disable application indexing
gsettings set org.freedesktop.Tracker3.Miner.Files index-applications false
# explaination based on this file:
# https://gitlab.gnome.org/GNOME/tracker-miners/-/blob/master/src/libtracker-miners-common/tracker-fts-config.c
# Flag to enable word stemming utility (default=FALSE)
gsettings set org.freedesktop.Tracker3.FTS enable-stemmer false
# Flag to enable word unaccenting (default=TRUE)
gsettings set org.freedesktop.Tracker3.FTS enable-unaccent false
# Flag to ignore numbers in FTS (default=TRUE)
gsettings set org.freedesktop.Tracker3.FTS ignore-numbers true
# Flag to ignore stop words in FTS (default=TRUE)
gsettings set org.freedesktop.Tracker3.FTS ignore-stop-words true
# explaination based on this file:
# https://gitlab.gnome.org/GNOME/tracker-miners/-/blob/master/src/tracker-extract/tracker-config.c
# Maximum number of UTF-8 bytes to extract per file [0->10485760]
# min ==> 0 ==> 0b
# max ==> 1024 * 1024 * 10 ==> 10 Mb
# default ==> 1024 * 1024 ==> 1Mb
gsettings set org.freedesktop.Tracker3.Extract max-bytes 0
# Filename patterns for plain text documents that should be indexed
# empty, as these are whitelisting pattern, or maybe never existent filename pattern
# will also work, like filename that contains new line in it, will make it to never match
# to anything.
gsettings set org.freedesktop.Tracker3.Extract text-allowlist '[]'
# Wait for FS miner to be done before extracting
# %TRUE to wait for tracker-miner-fs is done before extracting. %FAlSE otherwise
# hmm, true will make it less aggressive, as it will wait for miner to finish which
# itself has 1000s initial delay.
gsettings set org.freedesktop.Tracker3.Extract wait-for-miner-fs true
# disable its settings in gnome settings also
# populate disable list, disable all apps, and location
gsettings set org.gnome.desktop.search-providers disabled "['org.gnome.Terminal.desktop', 'org.gnome.Settings.desktop', 'org.gnome.Photos.desktop', 'org.gnome.clocks.desktop', 'org.gnome.Calendar.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Nautilus.desktop']"
# clear enable list
gsettings set org.gnome.desktop.search-providers enabled "[]"
# search path setting is already cleared in "index-recursive-directories"
# disable gnome search indexing itself
gsettings set org.gnome.desktop.search-providers disable-external true
# and finally,
# Application Options:
# -s, --filesystem Remove filesystem indexer database
# -r, --rss Remove RSS indexer database
tracker3 reset -s -r
# and kill it brutally
tracker3 daemon --kill
或者,查看我的要点:使 gnome 跟踪器禁用或完全停止。
答案4
我将跟踪器服务重定向到 bin/true。它的侵入性较小。由于它们是用户级服务,因此创建覆盖目录并覆盖您家中的服务,例如:
#! /bin/bash
for t in tracker-extract tracker-miner-fs tracker-store tracker-writeback; do
SVD=${HOME}/.config/systemd/user/${t}.service.d
if [ ! -d ${SVD} ]; then
mkdir -p ${SVD}
fi
cat > ${SVD}/override.conf << EOF
[Service]
Type=
Type=oneshot
ExecStart=
ExecStart=/bin/true
Restart=
Restart=no
EOF
done
我使用的是 Debian 11