How to fix apt-get missing key error after adding deb source for package?

5,191
sudo apt-key list
sudo apt-key del [bad key]

Look at your keys and figure out which one or ones are bad and remove them, then try your apt-get update again.

Share:
5,191

Related videos on Youtube

crobar
Author by

crobar

Updated on September 18, 2022

Comments

  • crobar
    crobar over 1 year

    I'm using Mint Linux 17. I tried to install a debian package by adding a repository to my source list like so:

    # add heroku repository to apt
    echo "deb http://toolbelt.heroku.com/ubuntu ./" > /etc/apt/sources.list.d/heroku.list
    
    # install heroku's release key for package verification
    wget -O- https://toolbelt.heroku.com/apt/release.key | apt-key add -
    

    (actually this is from a script provided by the package vendor). However, after doing this, and running apt-get update I get a GPG key error:

    Reading package lists... Error!
    W: GPG error: http://download.opensuse.org  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D54CC349F42D5F07
    E: Encountered a section with no Package: header
    E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_qiana_import_i18n_Translation-en
    E: The package lists or status file could not be parsed or opened.
    Reading package lists... Error!
    E: Encountered a section with no Package: header
    E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_qiana_import_i18n_Translation-en
    E: The package lists or status file could not be parsed or opened.
    

    So after googling I tried:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D54CC349F42D5F07
    

    Now I get:

    Reading package lists... Error!
    W: GPG error: http://download.opensuse.org  Release: The following signatures were invalid: KEYEXPIRED 1307152882
    E: Encountered a section with no Package: header
    E: Problem with MergeList /var/lib/apt/lists/packages.linuxmint.com_dists_qiana_import_i18n_Translation-en
    E: The package lists or status file could not be parsed or opened.
    

    Because the key is expired. Now apt-get update always fails with this error.

    So, how can I fix my now broken package system? I'm not that bothered about keeping the new sources list. I just wan to get back to being able to run apt-get update again.

    EDIT

    doing apt-key list reveals the following problem key:

    pub   1024D/F42D5F07 2009-03-26 [expired: 2011-06-04]
    uid                  home:felfert OBS Project <home:[email protected]>
    

    I run apt-key del F42D5F07, but now when running apt-get update I get back to:

    W: GPG error: http://download.opensuse.org  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D54CC349F42D5F07
    
  • crobar
    crobar over 9 years
    Thanks, this gets me back to the "missing key" error, see my edit to the question. Is this just a warning, and can I ignore it?
  • Optichip
    Optichip over 9 years
    Well it's erring on a repo, do you need that repo? check your /etc/apt/sources.list and remark out the repo in error for the time being until you can get a new signed key for it.
  • crobar
    crobar over 9 years
    I commented out the contents of /etc/apt/sources.list.d/heroku.list but I still get the same warning. Is there anywhere else I need to do this?