68

The error I am having when trying to update my package list.

W: GPG error: http://download.opensuse.org ./ Release: The following signatures were invalid: KEYEXPIRED 1436387333

W: Failed to fetch http://ppa.launchpad.net/samrog131/ppa/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.
0

11 Answers 11

60

I don't get the answers above, my system clock was fine. The following worked for me:

sudo apt-key list | grep "expired: "
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys [KEY]

The key being the the part behind the slash: 0000X/<this part is the key>

Or use this one liner:

sudo apt-key list  | grep "expired: " | sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp' | xargs -n1 sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 
5
57

As simple as this should work:

sudo apt-key adv --refresh-keys

Why use sed and xargs if gpg can sort things for itself?

If getting an error about inaccessible key servers, try setting one directly:

sudo apt-key adv --keyserver keyserver.ubuntu.com --refresh-keys
8
  • 1
    i got the following error:gpg: no keyserver known (use option --keyserver) gpg: keyserver refresh failed: bad URI Jul 23, 2019 at 10:38
  • The only thing that worked for me Feb 28, 2020 at 12:47
  • 13
    The original answer returned an error, this modified version of the command worked: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --refresh-keys
    – Arman H
    Mar 23, 2020 at 13:41
  • 2
    RE Arman H's comment: Or using SSL sudo apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --refresh-keys Jan 11, 2021 at 9:18
  • 1
    It's better not to speficy protocol to avoid errors. It will determine correct protocol on it's own: sudo apt-key adv --keyserver keyserver.ubuntu.com --refresh-keys
    – konung
    May 3, 2021 at 22:48
21
GPG error: http://download.opensuse.org ./ Release: The following signatures were invalid: KEYEXPIRED 1436387333

This says that your GPG key for that repository has expired, which means one of two things, either your system has the wrong date or the key really expired. For the later, you need to contact the repository maintainer and import the new key (removing the old one, probably), once the repository updates their keys to sign the files.

You can safely ignore these messages if you aren't using packages of these repositories. The message can be removed if you remove the repository from your source.list file/directory.

3
  • 1
    ... suggest adding in confirming that the system clock is at least reasonably correct. If the system thinks its 2020, I bet that'd lead to key expired errors.
    – derobert
    Jul 21, 2015 at 17:04
  • @derobert but we are in 2020!
    – Bersan
    Nov 2, 2020 at 13:22
  • 1
    @Bersan and what a year it's been 🙄, but in a few more my comment will work again if there are errors for far-future keys too. 😁
    – derobert
    Nov 2, 2020 at 13:35
19

That ppa has been removed and no longer exists. You must find a different source for the packages installed through the samrog131 ppa.

In the meantime, run the following commands to resolve the situation.

First, to delete the expired key:

sudo apt-key del 1436387333

Then, to delete the ppa:

sudo rm /etc/apt/sources.list.d/samrog131*
sudo apt-get clean
sudo apt-get update

If you need to add a key see here.

sudo apt-get upgrade

You may want to run:

sudo apt-get dist-upgrade

depending on your situation. If you are not sure, see here.

2
  • What's '1436387333' here?
    – Raj
    Aug 15, 2021 at 1:25
  • 1
    @LeninRajRajasekaran It is referenced on the first line of the code block in the question.
    – mchid
    Aug 15, 2021 at 21:49
5

None of these worked for me:

$ sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 5072E1F5

or

$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5072E1F5

or

$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys A4A9406876FCBD3C456770C88C718D3B5072E1F5

The sources for those are: https://bugs.mysql.com/bug.php?id=85029 and https://bugs.mysql.com/bug.php?id=94378

I performed one suspect operation in desperation (saying 'y' instead of 'N' below) which I think wasn't required at all:

$ sudo apt-get install mysql-apt-config

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  mysql-apt-config
1 upgraded, 0 newly installed, 0 to remove and 294 not upgraded.
Need to get 35.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
  mysql-apt-config
Install these packages without verification? [y/N] y
Get:1 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-apt-config mysql-apt-config all 0.8.13-1 [35.6 kB]
Fetched 35.6 kB in 0s (229 kB/s)      
Preconfiguring packages ...
dpkg-deb: error: archive '/var/cache/apt/archives/mysql-apt-config_0.8.13-1_all.deb' has premature member 'control.tar.xz' before 'contro
l.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/mysql-apt-config_0.8.13-1_all.deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-apt-config_0.8.13-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

And followed it with:

$ sudo apt-get update

which did not help.

I still got the same error.

Finally, the following worked:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5072E1F5

I'm speculating (blindly) that maybe pgp.mit.edu has changed their structure or maybe "MySQL Release Engineering" (run apt-key list) has moved their keys to the ubuntu key server or some such thing (I have no idea of how keys are maintained).

This comment on the duplicate thread says the same thing.

Hope this saves someone some time and effort.

2
  • The last step worked for my ubuntu 14.04 LTS, where as all the other steps failed.
    – a4aravind
    Jul 27, 2019 at 9:13
  • just for the "files" - it also worked on my debian "jessie"
    – halfbit
    Mar 21, 2023 at 4:12
2

As displayed earlier First, to delete the expired key:

sudo apt-key del 1436387333

Then go to the site:

http://download.opensuse.org/repositories/home:/sarimkhan/xUbuntu_14.04/

and download "Release.key" Then import the key using the ubuntu14.04 software updater or synaptic package manager.

1

Setting the correct system time in the BIOS solved the issue for me.

1

A GUI oriented answer:

Navigate to /etc/apt/sources.list.d in your File Manager and double-click sources.list.

This should open the Software and Updates dialog. Click Other Software, find the offending PPA, click Remove. This stopped the error on my end.

2
  • 2
    Removing the PPA can be dangerous. It needs some checks before. If the PPA is removed, the applications installed from the PPA will not be updated anymore (no more security updates and no more bug fixes). Remove a PPA (or any repository) only if it is not used anymore. Mar 15, 2020 at 18:05
  • In my specific case, it was an unneeded PPA I was looking for. Not to say it's always a valid idea, but it is an option (and this comment's mostly there so I could find it again later).
    – SteveHeist
    Mar 27, 2020 at 5:43
1

Also, the following helped me with Retroshare's repo for Ubuntu 20.04:

sudo apt -o Acquire::AllowInsecureRepositories=true \
  -o Acquire::AllowDowngradeToInsecureRepositories=true \
  update

See also: How do I bypass/ignore the gpg signature checks of apt?

0

This solution worked best for me.

wget -nv https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key -O Release.key

sudo apt-key add - < Release.key

Once these commands were run I was able to update and upgrade as expected.

0

When tried to apply this solution, it failed, but at least it returned the right KEYS

apt-key adv --keyserver hkps://keyserver.ubuntu.com --refresh-keys

And with the right KEYS I could update them using...

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys <KEY>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .