运行sudo apt update
时出现以下错误:
sqlite3.OperationalError: unable to open database file
该命令无法打开的文件为/var/lib/command-not-found/commands.db.tmp
,这将导致此错误:
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
完整日志:
$ sudo apt update
Hit:1 http://il.archive.ubuntu.com/ubuntu eoan InRelease
Get:2 http://security.ubuntu.com/ubuntu eoan-security InRelease [88.4 kB]
Hit:3 http://il.archive.ubuntu.com/ubuntu eoan-updates InRelease
Hit:4 http://il.archive.ubuntu.com/ubuntu eoan-backports InRelease
Hit:5 http://packages.cloud.google.com/apt cloud-sdk InRelease
Fetched 88.4 kB in 3s (33.3 kB/s)
Error: Timeout was reached
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 26, in <module>
col.create(db)
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 98, in create
with sqlite3.connect(tmpdb) as con:
sqlite3.OperationalError: unable to open database file
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
什么原因导致此问题,该如何解决?