Ubuntu 20.04 中的安装问题

Ubuntu 20.04 中的安装问题

当使用 Sudo 命令安装任何包时,我每次都会遇到下面提到的错误。

例如,如果我vim使用以下命令进行安装$ sudo apt install vim,则会得到以下内容输出

Reading package lists... Done
Building dependency tree       
Reading state information... Done
vim is already the newest version (2:8.1.2269-1ubuntu5.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up amdgpu-dkms (1:5.6.0.15-1098277) ...
Removing old amdgpu-5.6.0.15-1098277 DKMS files...

------------------------------
Deleting module version: 5.6.0.15-1098277
completely from the DKMS tree.
------------------------------
Done.
Loading new amdgpu-5.6.0.15-1098277 DKMS files...
Building for 5.11.0-37-generic
Building for architecture x86_64
Building initial module for 5.11.0-37-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.c
rash'
Error! Bad return status for module build on kernel: 5.11.0-37-generic (x86_64)
Consult /var/lib/dkms/amdgpu/5.6.0.15-1098277/build/make.log for more informatio
n.
dpkg: error processing package amdgpu-dkms (--configure):
 installed amdgpu-dkms package post-installation script subprocess returned erro
r exit status 10
dpkg: dependency problems prevent configuration of amdgpu:
 amdgpu depends on amdgpu-dkms (= 1:5.6.0.15-1098277); however:
  Package amdgpu-dkms is not configured yet.

dpkg: error processing package amdgpu (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
 amdgpu-dkms
 amdgpu
E: Sub-process /usr/bin/dpkg returned an error code (1)


我曾尝试使用自动清洁功能 $ sudo apt-get autoclean,但没有效果。

我也尝试过强制删除图形处理器包使用$ sudo apt-get --force-yes remove amdgpu-5.6.0.15-1098277

我得到了以下输出

Reading package lists... Done
Building dependency tree       
Reading state information... Done
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Unable to locate package amdgpu-5.6.0.15-1098277
E: Couldn't find any package by glob 'amdgpu-5.6.0.15-1098277'
E: Couldn't find any package by regex 'amdgpu-5.6.0.15-1098277'

这里是输出$ sudo apt-get update安装之前运行的:-

Ign:1 file:/var/opt/amdgpu-pro-local ./ InRelease
Get:2 file:/var/opt/amdgpu-pro-local ./ Release [816 B]
Get:2 file:/var/opt/amdgpu-pro-local ./ Release [816 B]
Get:3 file:/var/opt/amdgpu-pro-local ./ Release.gpg           
Ign:3 file:/var/opt/amdgpu-pro-local ./ Release.gpg      
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease   
Get:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Hit:7 http://dl.google.com/linux/chrome/deb stable InRelease
Get:8 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,256 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [544 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [283 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [864 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [641 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [361 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:16 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [10.4 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [29.0 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [62.5 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Fetched 4,383 kB in 3s (1,293 kB/s)                      
Reading package lists... Done
Building dependency tree       
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.

尽管升级使用$ sudo apt upgrade我再次面临同样的问题并且它返回以下输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libnss-systemd libpam-systemd libsystemd0 systemd systemd-sysv
  systemd-timesyncd
6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 4,400 kB of archives.
After this operation, 5,120 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libnss-systemd amd64 245.4-4ubuntu3.13 [95.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 systemd-timesyncd amd64 245.4-4ubuntu3.13 [28.1 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 systemd-sysv amd64 245.4-4ubuntu3.13 [10.3 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpam-systemd amd64 245.4-4ubuntu3.13 [186 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 systemd amd64 245.4-4ubuntu3.13 [3,809 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libsystemd0 amd64 245.4-4ubuntu3.13 [270 kB]
Fetched 4,400 kB in 2s (1,831 kB/s)   
(Reading database ... 194179 files and directories currently installed.)
Preparing to unpack .../0-libnss-systemd_245.4-4ubuntu3.13_amd64.deb ...
Unpacking libnss-systemd:amd64 (245.4-4ubuntu3.13) over (245.4-4ubuntu3.11) ...
Preparing to unpack .../1-systemd-timesyncd_245.4-4ubuntu3.13_amd64.deb ...
Unpacking systemd-timesyncd (245.4-4ubuntu3.13) over (245.4-4ubuntu3.11) ...
Preparing to unpack .../2-systemd-sysv_245.4-4ubuntu3.13_amd64.deb ...
Unpacking systemd-sysv (245.4-4ubuntu3.13) over (245.4-4ubuntu3.11) ...
Preparing to unpack .../3-libpam-systemd_245.4-4ubuntu3.13_amd64.deb ...
Unpacking libpam-systemd:amd64 (245.4-4ubuntu3.13) over (245.4-4ubuntu3.11) ...
Preparing to unpack .../4-systemd_245.4-4ubuntu3.13_amd64.deb ...
Unpacking systemd (245.4-4ubuntu3.13) over (245.4-4ubuntu3.11) ...
Preparing to unpack .../5-libsystemd0_245.4-4ubuntu3.13_amd64.deb ...
Unpacking libsystemd0:amd64 (245.4-4ubuntu3.13) over (245.4-4ubuntu3.11) ...
Setting up libsystemd0:amd64 (245.4-4ubuntu3.13) ...
Setting up amdgpu-dkms (1:5.6.0.15-1098277) ...
Removing old amdgpu-5.6.0.15-1098277 DKMS files...

------------------------------
Deleting module version: 5.6.0.15-1098277
completely from the DKMS tree.
------------------------------
Done.
Loading new amdgpu-5.6.0.15-1098277 DKMS files...
Building for 5.11.0-37-generic
Building for architecture x86_64
Building initial module for 5.11.0-37-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.c
rash'
Error! Bad return status for module build on kernel: 5.11.0-37-generic (x86_64)
Consult /var/lib/dkms/amdgpu/5.6.0.15-1098277/build/make.log for more informatio
n.
dpkg: error processing package amdgpu-dkms (--configure):
 installed amdgpu-dkms package post-installation script subprocess returned erro
r exit status 10
dpkg: dependency problems prevent configuration of amdgpu:
 amdgpu depends on amdgpu-dkms (= 1:5.6.0.15-1098277); however:
  Package amdgpu-dkms is not configured yet.

dpkg: error processing package amdgpu (--configure):
 dependency problems - leaving unconfigured
Setting up systemd (245.4-4ubuntu3.13) ...
No apport report written because the error message indicates its a followup erro
r from a previous failure.
                          Installing new version of config file /etc/dhcp/dhclie
nt-enter-hooks.d/resolved ...
Setting up systemd-timesyncd (245.4-4ubuntu3.13) ...
Setting up systemd-sysv (245.4-4ubuntu3.13) ...
Setting up libnss-systemd:amd64 (245.4-4ubuntu3.13) ...
Setting up libpam-systemd:amd64 (245.4-4ubuntu3.13) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.1) ...
Errors were encountered while processing:
 amdgpu-dkms
 amdgpu
E: Sub-process /usr/bin/dpkg returned an error code (1)

如何解决这个问题?

答案1

amdgpu并且amdgpu-dkms这里存在问题的软件包,因为它们要么未完全安装,要么已损坏。

请按照以下步骤解决此问题:

  1. 清除有问题的软件包:

    sudo dpkg -P amdgpu && sudo dpkg -P amdgpu-dkms 
    

    这更有可能起作用!但有时它会返回相同的错误。

  2. 在这种情况下,您必须通过运行以下命令手动删除它:

    sudo mv /var/lib/dpkg/info/amdgpu* /tmp
    

    这会将您列出的软件包的所有组件移动到/tmp目录中。您可以稍后根据需要删除它们。

  3. 然后运行这些命令来更新软件缓存:

    sudo apt update 
    sudo apt upgrade -y
    

请在评论中随意向我提问。
祝你好运!

相关内容