无法删除 nvidia-prime 软件包

无法删除 nvidia-prime 软件包

当我尝试将 14.10 切换到 systemd 时,我遇到了一种情况:我无法删除软件包“nvidia-prime”,并且它阻止我安装 upstart 或 systemd,所以现在我的机器无法重新启动。我该如何强制 dpkg 删除该愚蠢的软件包?

dpkg --force-all -P nvidia-prime
(Reading database ... 204460 files and directories currently installed.)
Removing nvidia-prime (0.6.7) ...
Failed to issue method call: Unit nvidia-prime.service not loaded.
invoke-rc.d: initscript nvidia-prime, action "stop" failed.
dpkg: error processing package nvidia-prime (--purge):
 subprocess installed pre-removal script returned error exit status 5
Failed to issue method call: Unit nvidia-prime.service failed to load: No such file or directory.
invoke-rc.d: initscript nvidia-prime, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 6
Errors were encountered while processing:
 nvidia-prime
root@Shamaniak:~# dpkg -P nvidia-prime
(Reading database ... 204460 files and directories currently installed.)
Removing nvidia-prime (0.6.7) ...
Failed to issue method call: Unit nvidia-prime.service not loaded.
invoke-rc.d: initscript nvidia-prime, action "stop" failed.
dpkg: error processing package nvidia-prime (--purge):
 subprocess installed pre-removal script returned error exit status 5
Failed to issue method call: Unit nvidia-prime.service failed to load: No such file or directory.
invoke-rc.d: initscript nvidia-prime, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 6
Errors were encountered while processing:
 nvidia-prime

apt-get install -fm upstart
Reading package lists... Done
Building dependency tree       
Reading state information... Done
upstart is already the newest version.
upstart set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up nvidia-prime (0.6.7) ...
Failed to issue method call: Unit nvidia-prime.service failed to load: No such file or directory.
invoke-rc.d: initscript nvidia-prime, action "start" failed.
dpkg: error processing package nvidia-prime (--configure):
 subprocess installed post-installation script returned error exit status 6
Errors were encountered while processing:
 nvidia-prime
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt-get install systemd-sysv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  nvidia-prime upstart
The following NEW packages will be installed:
  systemd-sysv
0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/8 548 B of archives.
After this operation, 700 kB disk space will be freed.
Do you want to continue? [Y/n] 
(Reading database ... 204460 files and directories currently installed.)
Removing nvidia-prime (0.6.7) ...
Failed to issue method call: Unit nvidia-prime.service not loaded.
invoke-rc.d: initscript nvidia-prime, action "stop" failed.
dpkg: error processing package nvidia-prime (--remove):
 subprocess installed pre-removal script returned error exit status 5
Failed to issue method call: Unit nvidia-prime.service failed to load: No such file or directory.
invoke-rc.d: initscript nvidia-prime, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 6
dpkg: upstart: dependency problems, but removing anyway as you requested:
 friendly-recovery depends on upstart | systemd-sysv; however:
  Package upstart is to be removed.
  Package systemd-sysv is not installed.
 nvidia-prime depends on upstart.

Removing upstart (1.13.2-0ubuntu2) ...
Processing triggers for man-db (2.7.0.2-2) ...
Errors were encountered while processing:
 nvidia-prime
E: Sub-process /usr/bin/dpkg returned an error code (1)

root@Shamaniak:~# apt-get purge nvidia-prime
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 friendly-recovery : Depends: upstart or
                              systemd-sysv but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
root@Shamaniak:~# apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  upstart
Suggested packages:
  graphviz upstart-monitor
The following NEW packages will be installed:
  upstart
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/118 kB of archives.
After this operation, 671 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Selecting previously unselected package upstart.
(Reading database ... 204423 files and directories currently installed.)
Preparing to unpack .../upstart_1.13.2-0ubuntu2_amd64.deb ...
Unpacking upstart (1.13.2-0ubuntu2) ...
Processing triggers for man-db (2.7.0.2-2) ...
Processing triggers for dbus (1.8.8-1ubuntu2.1) ...
Setting up upstart (1.13.2-0ubuntu2) ...
Setting up nvidia-prime (0.6.7) ...
Failed to issue method call: Unit nvidia-prime.service failed to load: No such file or directory.
invoke-rc.d: initscript nvidia-prime, action "start" failed.
dpkg: error processing package nvidia-prime (--configure):
 subprocess installed post-installation script returned error exit status 6
Errors were encountered while processing:
 nvidia-prime
E: Sub-process /usr/bin/dpkg returned an error code (1)

root@Shamaniak:~# sudo apt-get install --reinstall nvidia-prime
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for nvidia-prime:amd64

答案1

我做到了。不得不深入研究那个包脚本

cat /var/lib/dpkg/info/nvidia-prime.postinst

我看到它检查了 /etc/init.d/nvidia-prime 是否存在,所以我创建了它。

touch /etc/init.d/nvidia-prime

然后该软件包诚挚地允许其自行重新安装然后删除。

答案2

这里有一个几乎与您的意图相同的答案的链接。

nvidia-prime 软件包应该可以完美运行。显然,您的 nvidia 安装在某种程度上“做得过头了”。如此处步骤所述:

如果安装有点过度,我会尝试以下操作:

安装 ppa-purge

sudo apt-get purge nvidia*

sudo ppa-purge ppa:xorg-edgers/ppa

sudo 重启

返回终端,只需尝试以下操作:

sudo 添加 apt 存储库 ppa:图形驱动程序/ppa

sudo apt-get 更新

然后是这里:

sudo apt-get 安装 nvidia-358 nvidia-prime

sudo apt-get install --reinstall xserver-xorg

sudo 重启

如果这对您的情况有帮助,请以评论形式回答。

(参考自:

双显示器不工作 - 英特尔显卡和 Nvidia 960m

相关内容