NVIDIA软件包依赖升级问题求助:执行修复命令时出现文件覆盖冲突错误
NVIDIA软件包依赖升级问题求助:执行修复命令时出现文件覆盖冲突错误
问题描述
我在升级NVIDIA软件包时遇到了依赖问题,执行sudo apt-get upgrade后收到以下错误提示:
$ sudo apt-get upgrade Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: nvidia-dkms-535 : Depends: nvidia-kernel-common-535 (= 535.129.03-0ubuntu1) but 535.129.03-0ubuntu0.22.04.1 is installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
尝试执行sudo apt --fix-broken install修复时,又出现了文件覆盖冲突的错误:
$ sudo apt --fix-broken install Reading package lists... Done Building dependency tree... Done Reading state information... Done Correcting dependencies... Done The following package was automatically installed and is no longer required: nvidia-firmware-535-535.129.03 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: nvidia-kernel-common-535 The following packages will be upgraded: nvidia-kernel-common-535 1 upgraded, 0 newly installed, 0 to remove and 32 not upgraded. 1 not fully installed or removed. Need to get 0 B/38,3 MB of archives. After this operation, 61,2 MB of additional disk space will be used. Do you want to continue? [Y/n] y (Reading database ... 291692 files and directories currently installed.) Preparing to unpack .../nvidia-kernel-common-535_535.129.03-0ubuntu1_amd64.deb . .. Unpacking nvidia-kernel-common-535 (535.129.03-0ubuntu1) over (535.129.03-0ubunt u0.22.04.1) ... dpkg: error processing archive /var/cache/apt/archives/nvidia-kernel-common-535_ 535.129.03-0ubuntu1_amd64.deb (--unpack): trying to overwrite '/lib/firmware/nvidia/535.129.03/gsp_ga10x.bin', which is a lso in package nvidia-firmware-535-535.129.03 535.129.03-0ubuntu0.22.04.1 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/nvidia-kernel-common-535_535.129.03-0ubuntu1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
请问该如何解决这个问题?
解决方案
这个问题的根源是NVIDIA软件包更新后,固件文件的归属发生了变化——原本属于nvidia-firmware-535-535.129.03包的文件现在被合并到nvidia-kernel-common-535包里了,但旧的固件包还留在系统中,导致安装时出现文件冲突。按照以下步骤就能解决:
手动移除冲突的固件包
首先尝试正常卸载这个已经被标记为“不再需要”的固件包:sudo apt remove nvidia-firmware-535-535.129.03如果上述命令因为依赖问题失败,就用
dpkg强制移除:sudo dpkg --purge --force-all nvidia-firmware-535-535.129.03重新执行依赖修复命令
移除冲突包后,再次运行修复命令来完成依赖的修正:sudo apt --fix-broken install完成后重新尝试系统升级
最后执行升级命令,确认问题是否解决:sudo apt upgrade
如果之后还有残留的无用包,可以用以下命令清理:
sudo apt autoremove && sudo apt clean
备注:内容来源于stack exchange,提问作者Vitalii Frolov
相关产品推荐
相关产品推荐

