[Tutorials] Deepin 25 搜狗输入法挂掉的排查
Tofloor
poster avatar
138******73
deepin
11 hours ago
Author

记一次 Deepin 25 搜狗输入法挂掉的排查

前两天手贱升级了下系统,搜狗就嗝屁了。Ctrl+Space 没反应、点托盘图标也没用,只能打英文。查了一圈发现其实就一个烂坑,顺手记一下。

环境:Deepin 25, fcitx5, sogou-ime-ng 10.0.10, X11。


先看下进程和配置

bash****复制

ps aux | grep -E 'fcitx5|cpis' | grep -v grep
cat ~/.config/fcitx5/profile

搜狗新一代(sogou-ime-ng)拆成了几个独立进程:

cpis-engine-service      ← 引擎
cpis-panel-service       ← 面板
cpis-hotkey-service      ← 热键
ISE_NODE                 ← fcitx5 addon 拉起来的子进程

再加上 fcitx5 主进程,正常情况下一共 5 个。少了任何一个都废。

~/.config/fcitx5/profile 里搜狗的 entry 长这样:

ini****复制

Name=com.sogou.ime.ng.fcitx5.deepin

profile 里没有的话手动加上,Items 列表第一位放搜狗。


坑在哪里

不看日志根本想不到:

E addonloader.cpp:95] Failed to create addon: dbus
Unable to request dbus name. Is there another fcitx already running?

fcitx5 上一次退出的时候 dbus name org.fcitx.Fcitx5 没释放干净,新进程抢不到这个名字,dbus addon 直接加载失败。dbus 一挂,xcb hotkey 也没了,Ctrl+Space 当然是死的。

验证一下:

bash****复制

killall fcitx5 fcitx5-helper 2>/dev/null
sleep 2

# 如果返回 true,说明名字还在被占着
dbus-send --session --dest=org.freedesktop.DBus --type=method_call \
  --print-reply /org/freedesktop/DBus \
  org.freedesktop.DBus.NameHasOwner string:org.fcitx.Fcitx5

修复

1. 彻底干掉残留

bash****复制

killall -9 fcitx5 fcitx5-helper 2>/dev/null
sleep 3

# 确认返回 false
dbus-send --session --dest=org.freedesktop.DBus --type=method_call \
  --print-reply /org/freedesktop/DBus \
  org.freedesktop.DBus.NameHasOwner string:org.fcitx.Fcitx5

2. 拉起搜狗的后台

bash****复制

export GDK_BACKEND=x11 QT_QPA_PLATFORM=xcb LANG=zh_CN.UTF-8

/opt/apps/com.cpis/bin/cpis-engine-service \
  --ini /opt/apps/com.cpis/etc/ise.ini --type ini &

/opt/apps/com.cpis/bin/cpis-panel-service \
  --ini /opt/apps/com.cpis/etc/isp.ini --type ini &

3. profile 补上搜狗

bash****复制

cat > ~/.config/fcitx5/profile << 'EOF'
[Groups/0]
Name=默认
Default Layout=us
DefaultIM=com.sogou.ime.ng.fcitx5.deepin

[Groups/0/Items/0]
Name=com.sogou.ime.ng.fcitx5.deepin
Layout=

[Groups/0/Items/1]
Name=keyboard-us
Layout=

[GroupOrder]
0=默认
EOF

4. 起 fcitx5

bash****复制

fcitx5 -d

日志里看到这行就对了:

Loaded addon com.sogou.ime.ng.fcitx5.deepin-addon
CPISModuleIMFcitx5::activate

5. 开机自启

Deepin 有时候不会自动拉搜狗的服务,加两个 desktop 到 autostart:

bash****复制


收工。就一个 dbus name 没释放的问题,绕了一大圈。fcitx5 的日志其实写得很清楚,只是平时没人注意看。

Reply Favorite View the author
All Replies
avatar
jiutian123
deepin
8 hours ago
#1

遇到卡顿,输入显示慢

Reply View the author
avatar
商店运营-小七
Moderator
4 hours ago
#2

like

Reply View the author
avatar
豆浆包子
deepin
3 hours ago
#3

我最近更新以后也不能切换输入法了。

Reply View the author