Linux Mint 18 Fix Fix GPG Error BADSIG during update of repository

This morning I saw the red X on my Update Manager Icon and I decided to see what is the problem. The error happened during refresh of the packages:

GPG error: http://mirrors.evowise.com/linuxmint/packages sylvia Release: The following signatures were invalid: BADSIG A6616109451BBBF2..

First time back in time when I saw this error I enter in panic mode. I thought that my system is completely broken or damaged. Later I found that is problem related to mirrors, cache or a broken package.

I tried several different solutions without success:

  • refresh
  • clean the cache
  • sudo apt-get update

All of the ended with the same error and the old list would be used because there is a problem getting a new one.

Fix GPG error invalid signatures

From the error above I saw that I'm using mirror evowise which caused me some problems in the past again during package updates. So I decided to switch back to default mirrors by:

You can clean the cache if you want by clicking Update the cache button on the up right corner. Now the refresh and the updates should work fine.

If you don't want to see the message which ask for switching to local mirror:

Selection_008

Then you can select another mirror - in my opinion you can avoid evowise CDN because I faced problems several times. This fix should apply also on previous Linux Mint versions like 17.

Terminal fix

You can try to fix this error by using the Linux console with the following command:

sudo rm -r /var/lib/apt/lists/* && sudo apt-get update

if the error still exist then you can change to default mirrors from previous section.

Another commands that can be handy are:

sudo apt-get clean
cd /var/lib/apt
sudp mv lists lists.old
sudp mkdir -p lists/partial
sudo apt-get clean

This will clean the list similarly to the previous command and will fix the errors of broken packages or cache.

Fix by removing broken package

Sometimes the error will appear after update to the new packages. So the error would be something like:

Preparing to unpack .../tlp-rdw_1.1-1~trusty_all.deb ...
dpkg-maintscript-helper: error: last version is missing
...
Errors were encountered while processing:
 /var/cache/apt/archives/tlp-rdw_1.1-1~trusty_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It's clear that there is a problem with package tlp-rdw_1.1-1. So you can try to reinstall the package again by first removing the package:

sudo apt-get remove tlp
sudo add-apt-repository --remove ppa:linrunner/tlp

In case of error produced by this command like:

"Package is in a very bad inconsistent state" 

You can force the remove:

sudo dpkg --remove --force-remove-reinstreq tlp tlp-rdw

After that you should be able to do clean install only from Software manager.

Related Article