前段时间我通过 snap 安装了 Opera。后来我卸载了它,但从那时起我就无法安装新的软件包。我重新安装了 Opera,还安装了一个稳定的 deb 版本。这没有帮助,所以我再次删除了它。我现在想进行版本升级。我收到的错误是:
readlink: missing operand
Try 'readlink --help' for more information.
stat: missing operand
Try 'stat --help' for more information.
Exception during pm.DoInstall(): E:Problem executing scripts DPkg::Pre-Invoke 'stat -c %Z $(readlink -f $(which opera)) > /tmp/opera.timestamp', E:Sub-process returned an error code
Error in sys.excepthook:
Traceback (most recent call last):
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeViewText.py", line 138, in _handleException
apport_crash(type, value, tb)
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeApport.py", line 57, in apport_crash
apport_excepthook(type, value, tb)
TypeError: apport_excepthook() missing 1 required positional argument: 'exc_tb'
Original exception was:
Traceback (most recent call last):
File "/tmp/ubuntu-release-upgrader-bk30gewy/lunar", line 8, in <module>
sys.exit(main())
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeMain.py", line 241, in main
if app.run():
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeController.py", line 2042, in run
return self.fullUpgrade()
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeController.py", line 1871, in fullUpgrade
if not self.doPostInitialUpdate():
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeController.py", line 906, in doPostInitialUpdate
self.quirks.run("PostInitialUpdate")
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeQuirks.py", line 99, in run
func()
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeQuirks.py", line 126, in lunarPostInitialUpdate
self._maybe_prevent_flatpak_auto_removal()
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeQuirks.py", line 519, in _maybe_prevent_flatpak_auto_removal
self.controller.cache.commit(
File "/tmp/ubuntu-release-upgrader-bk30gewy/DistUpgrade/DistUpgradeCache.py", line 309, in commit
apt.Cache.commit(self, fprogress, iprogress)
File "/usr/lib/python3/dist-packages/apt/cache.py", line 668, in commit
raise SystemError("installArchives() failed")
SystemError: installArchives() failed
我在这里找到的唯一与此相关的主题:删除 opera 浏览器后,出现 E: 执行脚本 DPkg 时出现问题但这没有帮助。有人能提出什么建议吗?
答案1
感谢 Talaat 的帮助。经过多次尝试,发现 apt 配置中有一个文件夹。
我运行
sudo rm /etc/apt/apt.conf.d/99fix-opera
并且更新/升级正确进行。
答案2
删除不再需要的包
sudo apt-get autoremove
清理 Ubuntu 中的 APT 缓存
sudo du -sh /var/cache/apt
或者只删除过时的软件包,比如那些被最近的更新所取代的软件包,这样就完全不需要它们了。
sudo apt-get autoclean
删除旧版本的 Snap 应用程序:你需要做的是创建新的 shell 脚本并在脚本中使用以下几行:
#!/bin/bash # Removes old revisions of snaps # CLOSE ALL SNAPS BEFORE RUNNING THIS set -eu snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" done
授予其执行权限,使用 sudo 运行 shell 脚本
清除临时文件