1

When trying to switch 14.10 to systemd I've run into a situation: I can not remove package 'nvidia-prime' and it prevents me to install either upstart or systemd, so now my machine will not reboot. How can I force dpkg to remove that dumb package?

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

2 Answers2

4

I did it. Had to actually dig into that package scripting

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

There I saw it checked for existance of /etc/init.d/nvidia-prime so I created it.

touch /etc/init.d/nvidia-prime

Then the package cordially allowed to reinstall itself and then delete.

-1

Here is link of almost same suiting answer to your intention.

The package nvidia-prime should work perfect. It is obviously fact that your nvidia-installations are "over-done" somehow. Like described in steps here :

I would try following in case the installation is a bit overdone :

sudo apt-get install ppa-purge

sudo apt-get purge nvidia*

sudo ppa-purge ppa:xorg-edgers/ppa

sudo reboot

Back into terminal, simply try this only :

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt-get update

then this here :

sudo apt-get install nvidia-358 nvidia-prime

sudo apt-get install --reinstall xserver-xorg

sudo reboot

please answer as comment if this was of help for this situation of yours.

(reference from :

Dual monitor not working - Intel Graphics & Nvidia 960m )

dschinn1001
  • 3,829
  • I did not use intel graphics at all and had a simple single monitor. I did not do anything about nvidia except for turning on the driver in GUI. – Barafu Albino Feb 26 '16 at 06:38