Fix Annoying ‘The package needs to be reinstalled, but I can’t find an archive for it’ Error In Linux Mint / Ubuntu

Here’s how to fix annoying ‘The package <package name> needs to be reinstalled, but I can’t find an archive for it’ error in Linux Mint / Ubuntu:

1. Sometimes in Linux Mint / Ubuntu, if a package installation has been unsuccessful, you may see the following error that will prevent you from installing other packages –

‘The package <package name> needs to be reinstalled, but I can’t find an archive for it’

2. In our case, previously failed installation of a package called ‘urd’ caused the above error and we were unable to install any other package. While installing ‘mtr’ package via apt-get we got the following error –

apt-get error

3. Here’s how the above error can fixed. First, make a backup of the dpkg status file by issuing the following command at the terminal –

sudo cp /var/lib/dpkg/status status.bkp

backing up dpkg status file

4. Now, issue the following command at the terminal to open the dpkg status file for editing –

sudo gedit /var/lib/dpkg/status

editing the sudo cp /var/lib/dpkg/status file

Search for the package name that appears in the error. Note that, in our case the culprit package was ‘urd’ which was in ‘purge reinstreq half-installed’ state. After you have located the culprit package, delete the section of information related to that package and save the file. In our case, we deleted the section related to ‘urd’ inside the rectangle and saved the file. Close ‘gedit’ when done.

5. You can see from the following output that the error was fixed and we were able to successfully install ‘mtr’ package.

apt-get error fixed

 

5 Comments

  1. Yannick says:

    THANKS A LOT.

    I have searched all the day with my natural language (french) but I found nothing to fix this problem. Then I search a little in english and … I find your post and solve my problem.

  2. sdgengineer says:

    Thanks! I am still very much a newbie, and I thought I was hopelessly stuck I guess the status file is sort of like the Registry in MS windows (I use the term sort of loosely)

    This is good to know!

    SDG

  3. josh says:

    best ubuntu page ever thank you

  4. swaroop says:

    Thank you.. this was the only solution that worked for me..

  5. Matt says:

    thanks! thought that was going to be a nightmare to fix