dictd 的离线字典找不到服务(Cannot connect to any servers)

使用以下命令查询 dictd

dict -vI

显示:

Configuration file:
   server localhost
Cannot connect to any servers

使用 systemctl 查询服务 dictd.service 状态显示:

× dictd.service - Dictd Dictionary Server Daemon
     Loaded: loaded (/usr/lib/systemd/system/dictd.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Tue 2026-07-14 17:51:01 CST; 4s ago
   Duration: 571us
 Invocation: ad3e345ee898495f8dc2078c43c28121
    Process: 125810 ExecStart=/usr/bin/dictd $DICTD_ARGS -- $DICTD_EARGS (code=exited, status=0/SUCCESS)
   Main PID: 125811 (code=exited, status=1/FAILURE)
   Mem peak: 2M
        CPU: 6ms

7月 14 17:51:01 xxxx systemd[1]: Starting Dictd Dictionary Server Daemon...
7月 14 17:51:01 xxxx systemd[1]: Started Dictd Dictionary Server Daemon.
7月 14 17:51:01 xxxx systemd[1]: dictd.service: Main process exited, code=exited, status=1/FAILURE
7月 14 17:51:01 xxxx systemd[1]: dictd.service: Failed with result 'exit-code'.

相关配置文件如下:

  • /etc/default/dictd:
# Config file for /etc/rc.d/dictd

DICTD_CONF=/etc/dict/dictd.conf
DICTD_DICTDIR=/usr/share/dictd
DICTD_TMPCONF=/etc/dict/dictd.conf.$$
DICTD_EARGS="-s"
# DICTD_ARGS="--locale en_US.UTF-8"
DICTD_ARGS="--locale zh_CN.UTF-8"
  • /etc/dict/dict.conf:
# This is the configuration file for dict.
# Usually all you will ever need here is the server keywords.
# Refer to the dict manpage for other options.
# It will only check the second server if the first fails
server localhost
# server dict.org
  • /etc/dict/dict.conf:
# dictd configuration file.
# whipped up by michael conrad tilstra <michael@gentoo.org>

# Informational message

global {
    site site.info
}

# who's allowed.  You might want to change this.
access {
  allow *
}

# Dictionaries are listed below.
# The initrc script scans /usr/lib/dict and adds all of the dictionaries
# it finds here.
database eng-zho {
        data /usr/share/dictd/eng-zho.dict.dz
        index /usr/share/dictd/eng-zho.index
}
#
# The initrc script will delete everything after the the last line and
# replace it with what it finds.  So add all of your things above.
#
# If this is a problem for people, contact me and
# we can work out a different method.
#
#LASTLINE

字典数据文件是从 freedict.org 下载 Dictd: Computers 章节的内容

执行

sudo ls -lh /usr/share/dictd

查询到字典数据文件权限如下:

Permissions Size User Date Modified Name
.rw-r--r--  2.0M root 14 7月  17:35 eng-zho.dict.dz
.rw-r--r--  461k root 14 7月  17:35 eng-zho.index

dictd没在什么地方记一下报错信息吗?

不知道在哪里能看到报错信息

我也不知道。sudo journalctl -u dictd.service看看?没有的话就只能查一下dictd的文档看有没有说明了。

这是里面的记录:

7月 14 19:42:32 xxxx systemd\[1\]: Starting Dictd Dictionary Server Daemon...
7月 14 19:42:32 xxxx systemd\[1\]: Started Dictd Dictionary Server Daemon.
7月 14 19:42:32 xxxx systemd\[1\]: dictd.service: Main process exited, code=exited, status=1/FAILURE
7月 14 19:42:32 xxxx systemd\[1\]: dictd.service: Failed with result 'exit-code'.

嗯,这里确实没有记录到有用的内容——跟systemctl status ...报告的一样,程序出错退出了,但是不知道出了什么错(