apt update 和 Ubuntu 软件卡住了

apt update 和 Ubuntu 软件卡住了

我刚刚安装了 Ubuntu 20.4 LTS。我在没有 Wifi 连接的情况下执行了安装,因为这导致安装程序无响应。然而,没有 Wifi 连接,安装程序仍能正常运行。

全新安装后,出现了两个问题。

  1. 打开 Ubuntu 软件应用程序时提示卡住,并显示“正在下载软件目录”。

  2. 当使用软件更新程序时,它会卡住并显示“等待 packagekitd 停止”。

我尝试使用以下命令停止 packagekitd:

systemctl stop packagekit

然后,再次运行软件更新程序后,它卡在“从 security.ubuntu.com/ubuntu no.archive.ubuntu.com/ubuntu 下载”

我确信上面的“不”是因为我位于奥斯陆。

对于像我这样的初学者来说,有人能提供一些寻找解决方案的想法吗?

看来我必须依赖软件更新程序才能安装程序(例如 sublime-text),因此这实际上阻止我开始使用 Linux。任何帮助都将不胜感激。

以下是输出sudo apt update

Reading package lists... Done
E: Could not get lock /var/lib/apt/lists/lock. It is held by process 1489 (packagekitd)
N: Be aware that removing the lock file is not a solution and may break your system.
E: Unable to lock directory /var/lib/apt/lists/

输出如下sudo apt upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  libdrm2:i386 libexpat1:i386 libglapi-mesa:i386 libglvnd0:i386
  libx11-xcb1:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386
  libxcb-present0:i386 libxcb-sync1:i386 libxdamage1:i386 libxfixes3:i386
  libxshmfence1:i386 libxxf86vm1:i386
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
  apport apport-gtk bind9-dnsutils bind9-host bind9-libs ghostscript
  ghostscript-x gir1.2-javascriptcoregtk-4.0 gir1.2-webkit2-4.0 gnome-shell
  gnome-shell-common libcurl3-gnutls libgs9 libgs9-common
  libjavascriptcoregtk-4.0-18 libmysqlclient21 libnss3 libsane libsane-common
  libsmbclient libsnmp-base libsnmp35 libssh-4 libwbclient0
  libwebkit2gtk-4.0-37 libwhoopsie0 ppp python3-apport python3-problem-report
  python3-software-properties samba-libs sane-utils software-properties-common
  software-properties-gtk whoopsie
35 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 36,7 MB of archives.
After this operation, 175 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://security.ubuntu.com/ubuntu focal-security/main amd64 libssh-4 amd64 0.9.3-2ubuntu2.1 [170 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security/main amd64 libcurl3-gnutls amd64 7.68.0-1ubuntu2.2 [231 kB]

此时进程卡住了,显示1% [2 libcurl3-gnutls 0 B/231 kB 0%]


更新:

我现在知道我可以终止锁定 sudo-update 的进程,并且我尝试更换服务器(在软件与更新)。

当我运行时sudo apt update,会产生以下内容

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease    
Get:2 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98,3 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]       
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main i386 Packages [718 kB]
13% [5 Packages 0 B/718 kB 0%]

..更新程序卡住了。

答案1

我找到了答案。我的问题是,我的 UTM 防火墙中断了与 security.ubuntu.com 和 archive.ubuntu.com 的连接(无论服务器镜像如何)。使用另一个 Wifi 网络完全解决了这个问题。

谢谢您的帮助。

答案2

显示应用程序然后搜索软件与更新
在 20.04 中,单击时会出现一个窗口,其中有...
下载自:然后出现一个下拉菜单,选择不同的服务器。
请注意,由于之前的包损坏,您可能会收到另一个错误,但如果是这样,请发布错误。
(另请注意,您需要的是软件和更新,而不是软件更新程序,但您可以在之后运行它。)

相关内容