Ubuntu – How To Uninstall Failed ‘dpkg -i xorg_7.6+12ubuntu1_amd64.deb’ Command

12.04aptdpkg

I was attempting to fix a dual monitor issue with an install of Ubuntu 12.04 64 bit on a Sony Vaio VGN-NS135E.

I ran the following command (downloaded the deb from – https://launchpad.net/ubuntu/+source/xorg/1:7.6+12ubuntu1/+build/3309759):

sudo dpkg -i xorg_7.6+12ubuntu1_amd64.deb

Because I was frustrated and was told in a few posts that reverting xorg might help. I somehow ended up fixing the monitor issue I was having but now I get the issue of this failed install. (Monitor is now working btw, once I rebooted with the monitor plugged in before boot.)

My error now is that I have a partially configured xorg package and seemingly no way to remove it. I also cannot open the Software Center without it wanting to repair and the repair fails for the same reason as the next code block. Here is output from sudo apt-get autoremove:

sudo apt-get autoremove
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:
 xorg : Depends: xserver-xorg (>= 1:7.6+12ubuntu1)
E: Unmet dependencies. Try using -f.

I've attempted all of the commands on the post: How do I force configuration of partially installed packages?

Here is the output from sudo apt-get install -f:

sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  xorg
Suggested packages:
  xorg-docs xfonts-100dpi xfonts-75dpi
The following packages will be upgraded:
  xorg
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 2,718 B of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main xorg amd64 1:7.6+12ubuntu2 [2,718 B]
Fetched 2,718 B in 0s (9,195 B/s)
dpkg: dependency problems prevent configuration of xorg:
 xorg depends on xserver-xorg (>= 1:7.6+12ubuntu1); however:
  Package xserver-xorg is not installed.
dpkg: error processing xorg (--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:
 xorg

Update:
Here is the output from sudo dpkg –configure xorg:

dpkg: dependency problems prevent configuration of xorg:
 xorg depends on xserver-xorg (>= 1:7.6+12ubuntu1); however:
  Package xserver-xorg is not installed.
dpkg: error processing xorg (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 xorg

Update 2
Running sudo apt-get install aptitude results in this:

sudo apt-get install aptitude
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:
 aptitude : Depends: libboost-iostreams1.46.1 (>= 1.46.1-1) but it is not going to be installed
            Depends: libcwidget3 but it is not going to be installed
            Depends: libept1.4.12 but it is not going to be installed
            Recommends: libparse-debianchangelog-perl but it is not going to be installed
 xorg : Depends: xserver-xorg (>= 1:7.6+12ubuntu1)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Update 3
Ran the following command (sudo dpkg -r xorg):

sudo dpkg -r xorg
dpkg: dependency problems prevent removal of xorg:
 ubuntu-desktop depends on xorg.
dpkg: error processing xorg (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 xorg

And have been unsuccessful thus far. I hope this is enough info, Thank you for any help!

Best Answer

Try the below command on Virtual console(ctrl+alt+F1),

sudo service lightdm stop
sudo dpkg --purge --force-all --force-remove-reinstreq xorg
sudo apt-get install xorg

It's safe to do the above commands in tty.

reinst-required
          A package marked reinst-required is broken  and  requires  rein‐
          stallation. These packages cannot be removed, unless forced with
          option --force-remove-reinstreq
purge  
          The  package  is  selected  to be purged (i.e. we want to remove
          everything from system directories, even configuration files).
force-all
          Set all force options