Whenever I try to install, update, or do anything with apt-get, I always get в ошибку message сходный 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 гve tried to fix the issue:
sudo apt-get remove vim
) - Removing fails and gives back an сходная ошибка to the one above.sudo apt-get purge vim
- Fails, same errors.Removing the /var/lib/dpkg/alternatives/vim
file mentioned in the message and then trying remove/purge again ошибка - Removing/purging still fails, but instead of:
update-alternatives: error: /var/lib/dpkg/alternatives/vim corrupt: invalid status
In its нравится, I get:
update-alternatives: error: /var/lib/dpkg/alternatives/vimdiff corrupt: line not terminated while trying to read status
Installing 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 в бит 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 **
Эксперт 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.
Записи альтернатив безнадежно повреждаются.
необходимо удалить их с:
sudo update-alternatives --remove-all vim
sudo rm -f /etc/alternatives/vim /var/lib/dpkg/alternatives/vim
, Если update-alternatives
жалуется на поврежденные файлы снова, проигнорируйте его и только продолжите удалять их со следующей командой.
Тогда переустанавливают их пакеты с:
sudo apt-get install --reinstall vim
Это восстановит записи альтернатив согласно пакетам, доступным в Вашей системе.
Продолжаются аналогично для vimdiff
, rvim
и другие поврежденные записи.
Подобная проблема на одном из моих серверов: /var/lib/dpkg/alternatives/vtrgb
повреждение
, Вероятно, от неудавшейся установки и незапланированной перезагрузки во время перебоя в питании. Я зафиксировал это, просто копируя файл с другого сервера, затем делающего:
sudo apt-get -f install
это зафиксировало поврежденный dpkg, и я смог идти дальше со своей жизнью!