Whenever I try to install, update, or do anything with apt-get, I always get a error message similar to this, griping about vim:
0 upgraded, 0 newly installed, 0 to remove and 2 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]? y Setting up vim (2:7.3.154+hg~74503f6ee649-2ubuntu3.1) ... update-alternatives: error: /var/lib/dpkg/alternatives/vim corrupt: invalid status dpkg: error processing vim (--configure): subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: vim Not exactly sure what's going on here. My assumption is that something is corrupt with vim? Here is what I've tried to fix the issue:
- Uninstall vim (
sudo apt-get remove vim) - Removing fails and gives back an error similar to the one above. sudo apt-get purge vim- Fails, same errors.Removing the
/var/lib/dpkg/alternatives/vimfile mentioned in the error message and then trying remove/purge again - Removing/purging still fails, but instead of:update-alternatives: error: /var/lib/dpkg/alternatives/vim corrupt: invalid statusIn its place, I get:
update-alternatives: error: /var/lib/dpkg/alternatives/vimdiff corrupt: line not terminated while trying to read statusInstalling vim again - Fails, same errors.
sudo apt-get clean && sudo apt-get autoremove- Fails, same errors.sudo apt-get install --fix-broken- Fails, same errors.
This is getting a bit annoying. vim just won't die. What's going wrong? What am I doing wrong? How do I fix this?
Help would be greatly appreciated.
** EDIT **
As requested:
Output of LC_MESSAGES=C update-alternatives --query vim:
Link: vim Status: auto Best: /usr/bin/vim.basic Value: /usr/bin/vim.basic Alternative: /usr/bin/vim.basic Priority: 30 content of /var/lib/dpkg/alternatives/vimdiff:
b0VIM 7.3Ýroot Can't fetch the content of /var/lib/dpkg/alternatives/vim because I deleted it, haha sorry.
/var/lib/dpkg/alternatives/vimand the output ofLC_MESSAGES=C update-alternatives --query vim? Same forvimdiff, please./var/lib/dpkg/alternatives/vimdiff corrupt: unexpected end of file while trying to read master file/var/lib/dpkg/alternatives/rvim corrupt: line not terminated while trying to read statusvim.gnome, for one. For another, the paste doesn't show it, but the file has an extra, blank line at the end (one more line after60).