每次使用 apt 时,我都会收到“超时错误”。查看/var/log/syslog
,我看到:
dbus[619]: [system] Activating via systemd: service name='org.freedesktop.PackageKit' unit='packagekit.service'
systemd[1]: Starting PackageKit Daemon...
PackageKit: daemon start
PackageKit: daemon quit
packagekitd[12925]: Failed to load the backend: Failed to execute statement 'PRAGMA synchronous=OFF': database disk image is malformed
systemd[1]: Started PackageKit Daemon.
gnome-software[2433]: running search with refine-flags=require-icon with timeout=60 with max-results=20 with search=packagek on plugin=snap took 378ms
gnome-software[2433]: running search with refine-flags=require-icon with timeout=60 with max-results=20 with search=packageki on plugin=snap took 432ms
gnome-software[2433]: running search with refine-flags=require-icon with timeout=60 with max-results=20 with search=packagekit on plugin=snap took 231ms
gnome-software[2433]: failed to call gs_plugin_refine on packagekit-refine: failed to resolve package_ids: Error calling StartServiceByName for org.freedesktop.PackageKit: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.PackageKit': timed out
有人遇到过这个问题吗?有没有什么方法可以修复数据库?或者我只能重新安装 packagekit 吗?
答案1
下列做过工作:
sudo apt-get remove packagekit
sudo apt-get purge packagekit
sudo apt-get install ubuntu-software
或者,您也可以使用以下命令:
sudo apt-get remove --purge packagekit
sudo apt-get install ubuntu-software
我曾希望找到更好的解决方案。我确实找到了带有选项的命令pkcon
,repair
但依赖于packagekitd
正在运行才能与数据库交互。
我在网上找不到任何关于数据库存储位置或如何处理该问题的参考资料。与 PackageKit 相关的大多数问题都与 Fedora、RedHat 或 CentOS 有关,因此帮助不大。
答案2
数据库文件如下。删除它并重新启动 packagekit 服务
/var/lib/PackageKit/transactions.db