gsandie online notebook

apt-get update failing with method died error

If you’ve tried to install or update a package on debian based systems (debian, ubuntu, etc) and you’ve had the following error:

Failed to exec method /usr/lib/apt/methods/
E: Method  has died unexpectedly!
E: Sub-process  returned an error code (100)
E: Method /usr/lib/apt/methods/ did not start correctly  

You might find this a pain to debug. There are a few things that seem to cause this problem:

  • corrupt sources.list entry, you have an entry in your sources.list file (or a file included from sources.list.d) which contains a deb or deb-src line which has a malformed uri method (see sources.list(5) for a list of valid methods) or is just an incorrect entry. Fix the malformed entry, run apt-get update and then all should be well.


  • corrupt entry in /var/lib/apt/lists - if your sources.list files are ok, you may have a corrupt entry in one of the lists that have been downloaded. To resolve this you can backup the files somewhere, remove the existing files, and then run apt-get update, it’ll download a new set of lists. You then should be able to install/update packages.


Debugging the problem

I debugged this problem with the apt-get manpages, strace to find out what the process was trying to load, and the apt sources to explain what the error message was saying and why it would occur.

Edit

This has been happening a lot on my servers. I’ve further dug into it and found that the eu-west-1.ec2.archive.ubuntu.com_ubuntu_dists_natty_multiverse_i18n_Translation-en and eu-west-1.ec2.archive.ubuntu.com_ubuntu_dists_natty_main_i18n_Translation-en files appear to be the ones causing the problem. After performing an update these files are no longer present. I’ve not had a chance to dig into why this is yet.