Cannot remove package vim, using purge or remove

Asked by surfless

When I do an upgrade, I get the following issue

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  libxcb-render0 libxcb-shape0 libxcb-shm0 libxcb-xv0 libxcb1
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 79.8kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://au.archive.ubuntu.com jaunty-updates/main libxcb1 1.1.93-0ubuntu3.1 [48.4kB]
Get:2 http://au.archive.ubuntu.com jaunty-updates/main libxcb-render0 1.1.93-0ubuntu3.1 [11.2kB]
Get:3 http://au.archive.ubuntu.com jaunty-updates/main libxcb-shape0 1.1.93-0ubuntu3.1 [5842B]
Get:4 http://au.archive.ubuntu.com jaunty-updates/main libxcb-shm0 1.1.93-0ubuntu3.1 [5252B]
Get:5 http://au.archive.ubuntu.com jaunty-updates/main libxcb-xv0 1.1.93-0ubuntu3.1 [9140B]
Fetched 79.8kB in 0s (386kB/s)
(Reading database ... 127768 files and directories currently installed.)
Preparing to replace libxcb1 1.1.93-0ubuntu3 (using .../libxcb1_1.1.93-0ubuntu3.1_amd64.deb) ...
Unpacking replacement libxcb1 ...
Preparing to replace libxcb-render0 1.1.93-0ubuntu3 (using .../libxcb-render0_1.1.93-0ubuntu3.1_amd64.deb) ...
Unpacking replacement libxcb-render0 ...
Preparing to replace libxcb-shape0 1.1.93-0ubuntu3 (using .../libxcb-shape0_1.1.93-0ubuntu3.1_amd64.deb) ...
Unpacking replacement libxcb-shape0 ...
Preparing to replace libxcb-shm0 1.1.93-0ubuntu3 (using .../libxcb-shm0_1.1.93-0ubuntu3.1_amd64.deb) ...
Unpacking replacement libxcb-shm0 ...
Preparing to replace libxcb-xv0 1.1.93-0ubuntu3 (using .../libxcb-xv0_1.1.93-0ubuntu3.1_amd64.deb) ...
Unpacking replacement libxcb-xv0 ...
Setting up vim (2:7.2.079-1ubuntu5) ...
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error processing vim (--configure):
 subprocess post-installation script returned error exit status 2
Setting up vim-gnome (2:7.2.079-1ubuntu5) ...
update-alternatives: error or eof reading /var/lib/dpkg/alternatives/vim for update_mode ()
dpkg: error processing vim-gnome (--configure):
 subprocess post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of vim-full:
 vim-full depends on vim-gnome (>= 1:7.1-135+1); however:
  Package vim-gnome is not configured yet.
dpkg: error processing vim-full (--configure):
 dependency problems - leaving unconfigured
Setting up libxcb1 (1.1.93-0ubuntu3.1) ...
No apport report written because the error message indicates its a followup error from a previous failure.

Setting up libxcb-render0 (1.1.93-0ubuntu3.1) ...

Setting up libxcb-shape0 (1.1.93-0ubuntu3.1) ...

Setting up libxcb-shm0 (1.1.93-0ubuntu3.1) ...

Setting up libxcb-xv0 (1.1.93-0ubuntu3.1) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
 vim
 vim-gnome
 vim-full
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt-get -f purge vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  vim*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 1937kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 127767 files and directories currently installed.)
Removing vim ...
dpkg (subprocess): unable to execute pre-removal script: Exec format error
dpkg: error processing vim (--purge):
 subprocess pre-removal script returned error exit status 2
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error while cleaning up:
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 vim
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried this:

$ sudo dpkg --purge vim
(Reading database ... 127767 files and directories currently installed.)
Removing vim ...
dpkg (subprocess): unable to execute pre-removal script: Exec format error
dpkg: error processing vim (--purge):
 subprocess pre-removal script returned error exit status 2
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error while cleaning up:
 subprocess post-installation script returned error exit status 2
Err

And this:

$sudo apt-get -f purge vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  vim*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 1937kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 127767 files and directories currently installed.)
Removing vim ...
dpkg (subprocess): unable to execute pre-removal script: Exec format error
dpkg: error processing vim (--purge):
 subprocess pre-removal script returned error exit status 2
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error while cleaning up:
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 vim
E: Sub-process /usr/bin/dpkg returned an error code (1)ors were encountered while processing:
 vim

What should I try next?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu vim Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Felix Crux (felixc) said :
#1

Thank you for taking the time to report this issue and helping to make Ubuntu better. Examining the information you have given us, this does not appear to be a bug report so we are closing it and converting it to a question in the support tracker.

We appreciate the difficulties you are facing, but it would make more sense to raise problems you are having in the support tracker at https://answers.launchpad.net/ubuntu if you are uncertain if they are bugs. For help on reporting bugs, see https://help.ubuntu.com/community/ReportingBugs .

Revision history for this message
Isak Frants (isakfrants) said :
#2

sudo apt-get install -f

?

Revision history for this message
surfless (coolum-surfless) said :
#3

Isak,

Thanks for the answer, unfortunately I tried that get the same output.

Craig

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up vim (2:7.2.079-1ubuntu5) ...
dpkg (subprocess): unable to execute post-installation script: Exec format error
dpkg: error processing vim (--configure):
 subprocess post-installation script returned error exit status 2
Setting up vim-gnome (2:7.2.079-1ubuntu5) ...
update-alternatives: error or eof reading
/var/lib/dpkg/alternatives/vim for sname ()
dpkg: error processing vim-gnome (--configure):
 subprocess post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of vim-full:
 vim-full depends on vim-gnome (>= 1:7.1-135+1); however:
  Package vim-gnome is not configured yet.
dpkg: error processing vim-full (--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:
 vim
 vim-gnome
 vim-full
E: Sub-process /usr/bin/dpkg returned an error code (1)

On Fri, Jul 10, 2009 at 3:24 PM, Isak
Frants<email address hidden> wrote:
> Your question #76549 on vim in ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
>    Status: Open => Answered
>
> Isak Frants proposed the following answer:
> sudo apt-get install -f
>
> ?
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549/+confirm?answer_id=1
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Isak Frants (isakfrants) said :
#4

Someone did successfully this:
cd /var/cache/apt/archives
sudo dpkg --force-all -i vim*.deb

Revision history for this message
surfless (coolum-surfless) said :
#5

There are no .deb packages in that directory.

So I downloaded vim-full, vim and vim-gnome

vim-full installed but got the following

$ sudo dpkg --force-all -i vim*.deb
(Reading database ... 127765 files and directories currently installed.)
Preparing to replace vim 2:7.2.079-1ubuntu5 (using
vim_7.2.079-1ubuntu5_amd64.deb) ...
Unpacking replacement vim ...
Preparing to replace vim-gnome 2:7.2.079-1ubuntu5 (using
vim-gnome_7.2.079-1ubuntu5_amd64.deb) ...
Unpacking replacement vim-gnome ...
Setting up vim (2:7.2.079-1ubuntu5) ...
update-alternatives: error or eof reading
/var/lib/dpkg/alternatives/vim for sname ()
dpkg: error processing vim (--install):
 subprocess post-installation script returned error exit status 2
Setting up vim-gnome (2:7.2.079-1ubuntu5) ...
update-alternatives: error or eof reading
/var/lib/dpkg/alternatives/vim for sname ()
dpkg: error processing vim-gnome (--install):
 subprocess post-installation script returned error exit status 2
Errors were encountered while processing:
 vim
 vim-gnome

On Fri, Jul 10, 2009 at 4:21 PM, Isak
Frants<email address hidden> wrote:
> Your question #76549 on vim in ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
>    Status: Open => Answered
>
> Isak Frants proposed the following answer:
> Someone did successfully this:
> cd /var/cache/apt/archives
> sudo dpkg --force-all -i vim*.deb
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549/+confirm?answer_id=3
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
surfless (coolum-surfless) said :
#6

Yes, but its all good learning, just posted again

On Fri, Jul 10, 2009 at 5:24 PM,
surfless<email address hidden> wrote:
> Your question #76549 on vim in ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
>    Status: Answered => Open
>
> You are still having a problem:
> There are no .deb packages in that directory.
>
> So I downloaded vim-full, vim and vim-gnome
>
> vim-full installed but got the following
>
> $ sudo dpkg --force-all -i vim*.deb
> (Reading database ... 127765 files and directories currently installed.)
> Preparing to replace vim 2:7.2.079-1ubuntu5 (using
> vim_7.2.079-1ubuntu5_amd64.deb) ...
> Unpacking replacement vim ...
> Preparing to replace vim-gnome 2:7.2.079-1ubuntu5 (using
> vim-gnome_7.2.079-1ubuntu5_amd64.deb) ...
> Unpacking replacement vim-gnome ...
> Setting up vim (2:7.2.079-1ubuntu5) ...
> update-alternatives: error or eof reading
> /var/lib/dpkg/alternatives/vim for sname ()
> dpkg: error processing vim (--install):
>  subprocess post-installation script returned error exit status 2
> Setting up vim-gnome (2:7.2.079-1ubuntu5) ...
> update-alternatives: error or eof reading
> /var/lib/dpkg/alternatives/vim for sname ()
> dpkg: error processing vim-gnome (--install):
>  subprocess post-installation script returned error exit status 2
> Errors were encountered while processing:
>  vim
>  vim-gnome
>
>
> On Fri, Jul 10, 2009 at 4:21 PM, Isak
> Frants<email address hidden> wrote:
>> Your question #76549 on vim in ubuntu changed:
>> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>>
>>    Status: Open => Answered
>>
>> Isak Frants proposed the following answer:
>> Someone did successfully this:
>> cd /var/cache/apt/archives
>> sudo dpkg --force-all -i vim*.deb
>>
>> --
>> If this answers your question, please go to the following page to let us
>> know that it is solved:
>> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549/+confirm?answer_id=3
>>
>> If you still need help, you can reply to this email or go to the
>> following page to enter your feedback:
>> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>>
>> You received this question notification because you are a direct
>> subscriber of the question.
>>
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Isak Frants (isakfrants) said :
#7

Hm there should have been a couple of .debs in /var/cache/apt/archives :O

Make first backups, and then try to delete these files. Delete everything with "vim" and "vim-gnome".
sudo rm /var/lib/dpkg/info/vim*.postrm
sudo rm /var/lib/dpkg/info/vim*.postinst

After that you could try to do a
sudo apt-get clean
(this deletes all your .debs in /var/cache/apt/archives)
sudo apt-get install vim

What do you get?

Revision history for this message
surfless (coolum-surfless) said :
#8

Oh thank you, that works perfectly.

$ sudo apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
vim is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up vim (2:7.2.079-1ubuntu5) ...
Setting up vim-gnome (2:7.2.079-1ubuntu5) ...

excellent!

For my reference what does .postrm and .postinst contain?

On Fri, Jul 10, 2009 at 6:16 PM, Isak
Frants<email address hidden> wrote:
> Your question #76549 on vim in ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
>    Status: Open => Needs information
>
> Isak Frants requested for more information:
> Hm there should have been a couple of .debs in /var/cache/apt/archives
> :O
>
> Make first backups, and then try to delete these files. Delete everything with "vim" and "vim-gnome".
> sudo rm /var/lib/dpkg/info/vim*.postrm
> sudo rm /var/lib/dpkg/info/vim*.postinst
>
> After that you could try to do a
> sudo apt-get clean
> (this deletes all your .debs in /var/cache/apt/archives)
> sudo apt-get install vim
>
> What do you get?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/ubuntu/+source/vim/+question/76549
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Isak Frants (isakfrants) said :
#9

"dpkg (subprocess): unable to execute post-installation script: Exec format error"

The script used was corrupted, you deleted the corrupted and it was replaced with new ones. Put the question as status solved and everyone is happy!

Can you help with this problem?

Provide an answer of your own, or ask surfless for more information if necessary.

To post a message you must log in.