nvidia 安装后无法删除损坏的软件包

nvidia 安装后无法删除损坏的软件包

我尝试通过以下方式删除所有错误的 nvidia 驱动程序:apt-get remove nvidia*

但是,当我现在尝试安装任何软件包时,它会告诉我:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 glx-alternative-nvidia : Depends: glx-diversions (= 0.8.0)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

然后使用--fix-broken:

apt-get --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  libcublas8.0 libcudart8.0 libcufft8.0 libcufftw8.0 libcurand8.0 libcusolver8.0 libcusparse8.0 libnppc8.0
  libnppi8.0 libnppial8.0 libnppicc8.0 libnppicom8.0 libnppidei8.0 libnppif8.0 libnppig8.0 libnppim8.0
  libnppist8.0 libnppisu8.0 libnppitc8.0 libnpps8.0 libnvblas8.0 libnvgraph8.0 libnvidia-compiler
  libnvidia-fatbinaryloader libnvidia-fatbinaryloader:i386 libnvidia-ptxjitcompiler
  libnvidia-ptxjitcompiler:i386 libnvrtc8.0 libnvtoolsext1 libnvvm3 libopengl0:i386 libthrust-dev libvdpau-dev
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/10.5 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of glx-alternative-nvidia:
 glx-alternative-nvidia depends on glx-diversions (= 0.8.0); however:
  Package glx-diversions is not installed.

dpkg: error processing package glx-alternative-nvidia (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-alternative:
 nvidia-alternative depends on glx-alternative-nvidia (>= 0.7); however:
  Package glx-alternative-nvidia is not configured yet.

dpkg: error processing package nvidia-alternative (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 glx-alternative-nvidia
 nvidia-alternative
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我尝试删除软件包时:

apt-get remove glx-alternative-nvidia
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 nvidia-alternative : Depends: glx-alternative-nvidia (>= 0.7)
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

来源.list

cat /etc/apt/sources.list
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
#deb http://repo.xplico.org/ kali-rolling main

DPKG --configure -a && apt 更新

root@Anonymous:~# dpkg --configure -a
dpkg: dependency problems prevent configuration of glx-alternative-nvidia:
 glx-alternative-nvidia depends on glx-diversions (= 0.8.0); however:
  Package glx-diversions is not installed.

dpkg: error processing package glx-alternative-nvidia (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nvidia-alternative:
 nvidia-alternative depends on glx-alternative-nvidia (>= 0.7); however:
  Package glx-alternative-nvidia is not configured yet.

dpkg: error processing package nvidia-alternative (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 glx-alternative-nvidia
 nvidia-alternative
root@Anonymous:~# apt update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://packages.microsoft.com/repos/vscode stable InRelease          
Hit:3 http://dl.google.com/linux/chrome/deb stable Release                                            
Hit:4 https://deb.nodesource.com/node_8.x jessie InRelease                                            
Hit:6 http://ftp2.nluug.nl/os/Linux/distr/kali kali-rolling InRelease           
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
root@Anonymous:~# 

猫 /etc/apt/sources.list.d/*:

cat /etc/apt/sources.list.d/*
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
deb https://deb.nodesource.com/node_8.x jessie main
deb-src https://deb.nodesource.com/node_8.x jessie main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main

dpkg --remove --force-remove-reinstreq nvidia-alternative

dpkg --remove --force-remove-reinstreq nvidia-alternative
dpkg: dependency problems prevent removal of nvidia-alternative:
 nvidia-driver-bin depends on nvidia-alternative (= 375.82-7).
 libgles-nvidia1:i386 depends on nvidia-alternative (= 375.82-7).
 libgles-nvidia1:amd64 depends on nvidia-alternative (= 375.82-7).
 libnvidia-ml1:i386 depends on nvidia-alternative (= 375.82-7).
 libnvidia-ml1:amd64 depends on nvidia-alternative (= 375.82-7).
 libgles1-glvnd-nvidia:i386 depends on nvidia-alternative (= 375.82-7).
 libgles1-glvnd-nvidia:amd64 depends on nvidia-alternative (= 375.82-7).
 libnvidia-cfg1:i386 depends on nvidia-alternative (= 375.82-7).
 libnvidia-cfg1:amd64 depends on nvidia-alternative (= 375.82-7).
 libgles-nvidia2:amd64 depends on nvidia-alternative (= 375.82-7).
 libgles-nvidia2:i386 depends on nvidia-alternative (= 375.82-7).
 libegl-nvidia0:i386 depends on nvidia-alternative (= 375.82-7).
 nvidia-vdpau-driver:amd64 depends on nvidia-alternative (= 375.82-7).
 nvidia-settings depends on nvidia-alternative.
 libglx-nvidia0:i386 depends on nvidia-alternative (= 375.82-7).
 libglx-nvidia0:amd64 depends on nvidia-alternative (= 375.82-7).

dpkg: error processing package nvidia-alternative (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 nvidia-alternative

ls /var/lib/dpkg/status

root@Anonymous:~# ls /var/lib/dpkg/status*
/var/lib/dpkg/status  /var/lib/dpkg/status-old

dpkg --配置-a

root@Anonymous:~# cp /var/lib/dpkg/status-old /var/lib/dpkg/status
root@Anonymous:~# dpkg --configure -a
root@Anonymous:~# apt update
Get:1 http://ftp2.nluug.nl/os/Linux/distr/kali kali-rolling InRelease [30.5 kB]
Get:2 http://ftp2.nluug.nl/os/Linux/distr/kali kali-rolling/main Sources [11.5 MB]
Get:3 http://ftp2.nluug.nl/os/Linux/distr/kali kali-rolling/main i386 Packages [15.3 MB]                        
Get:4 http://ftp2.nluug.nl/os/Linux/distr/kali kali-rolling/main amd64 Packages [15.4 MB]                       
Fetched 42.3 MB in 13s (3,250 kB/s)                                                                             
Reading package lists... Done
Building dependency tree       
Reading state information... Done
14 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@Anonymous:~# apt upgrade -y && apt dist-upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

来自帖子'dpkg:错误:无法删除数据库当前使用的体系结构“i386”':

apt-get remove --purge `dpkg --get-selections | grep i386 | awk '{print $1}'`
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 glx-alternative-nvidia : Depends: glx-diversions (= 0.8.0)
 lib32gcc1 : Depends: libc6-i386 (>= 2.2.4) but it is not going to be installed
 lib32ncurses5 : Depends: libc6-i386 (>= 2.4) but it is not going to be installed
 lib32stdc++6 : Depends: libc6-i386 (>= 2.18) but it is not going to be installed
 lib32tinfo5 : Depends: libc6-i386 (>= 2.16) but it is not going to be installed
 lib32z1 : Depends: libc6-i386 (>= 2.4) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

删除.list./etc/apt/sources.list.d/​它稍后会破坏您的系统。

然后运行:

mv /var/lib/dpkg/info/glx-alternative-nvidia.* /tmp/
mv /var/lib/dpkg/info/nvidia-alternative.* /tmp/
dpkg --remove --force-remove-reinstreq nvidia-alternative
dpkg --remove --force-remove-reinstreq glx-alternative-nvidia
dpkg --configure -a
apt update
apt upgrade
apt dist-upgrade

答案2

只是

sudo dpkg -r glx-alternative-nvidia
sudo dpkg -r nvidia-alternative

相关内容