Ubuntu 18.04 至 20.04 更新错误

Ubuntu 18.04 至 20.04 更新错误

我该如何修复此错误?我尝试了以下命令:

sudo apt-fast update
sudo apt-fast upgrade

这两个命令都成功结束。

sudo update-manager -c -d

当它运行时,我的互联网断了,所以我不得不按 Ctrl+C 来停止该进程。

我尝试再次运行它并收到 TypeError:

  File "/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.py", line 239, in _on_finished
    trans_failed=trans_failed)
  File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 323, in _action_done
    self.window_main.duplicate_packages = self.get_deb2snap_dups()
  File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 127, in get_deb2snap_dups
    if (deb in cache and cache[deb].is_installed):
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 350, in __contains__
    return self.__is_real_pkg(self._cache[key])
TypeError: Expected a string or a pair of strings

在处理上述异常期间,发生了另一个 TypeError:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.py", line 246, in _on_finished
    error_string=error_string, error_desc=error_desc)
  File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 323, in _action_done
    self.window_main.duplicate_packages = self.get_deb2snap_dups()
  File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 127, in get_deb2snap_dups
    if (deb in cache and cache[deb].is_installed):
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 350, in __contains__
    return self.__is_real_pkg(self._cache[key])
TypeError: Expected a string or a pair of strings

答案1

我会首先使用apt install -fbeforedpkg --configure -a来修复损坏的包裹。

按 Ctrl+C 确实是个坏主意,尤其是在进行发行版升级时……

下载的软件包无需互联网即可安装...如果正在升级,升级过程可能会重新加载或停止/启动网络...

答案2

要修复损坏/中断的包,请在终端输入

sudo dpkg --configure -a

相关内容