Installation issue (ubuntu 18.04.3 LTS)

It looks like it’s saying there’s an invalid key. Lets try this:

  1. In your terminal, enter sudo apt-key list and see if there are any entires for Brave

  2. Run sudo apt-key del C2D4E821 (this is the last 8 bytes of the key)

  3. Then run sudo apt remove brave-keyring

  4. Then sudo apt clean

  5. Then finally, run
    curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc | sudo apt-key --keyring /etc/apt/trusted.gpg.d/brave-browser-release.gpg add -

  6. Check if sudo apt update again throws error. If not, then run sudo apt install brave-browser

I tried running sudo apt-key list and I didn’t see any entry for Brave.

After running sudo apt-key del C2D4E821 I attempted to run sudo apt remove brave-keyring and received the error E: Unable to locate package brave-keyring.

Further, when I ran curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc | sudo apt-key --keyring /etc/apt/trusted.gpg.d/brave-browser-release.gpg add - I received the error gpg: no valid OpenPGP data found.

Not sure where to start after this, but it seems like there are many errors arising from different issues…

Here is a screenshot of my latest terminal output:

Are you behind VPN by any chance? If so can you try disconnecting VPN and try again just the curl command onwards

1 Like

I’m not behind a vpn. At first it was on autoconnect, but I have it turned off until I manually connect.
Still can’t figure out the problem.

Ok thats great. Any proxy being used in network?

If you simply open a browser to the address in the curl command, do you get a download prompt to save the brave-core.asc file?

What is supposed to be happening when you run that command:
curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc | sudo apt-key --keyring /etc/apt/trusted.gpg.d/brave-browser-release.gpg add -

  • curl fetches the contents of the URL, which is the repo PGP Public Key hash block
  • The PGP Public Key is piped (with the | character) into the apt-key command
  • apt-key then creates a key in the trusted keystore, /etc/apt/trusted.gpg.d/ named brave-browser-release.gpg that contains the PGP key that curl fetched

If you are unable to fetch the PGP from the URL for any reason, your PGP session with the repo will fail, and you cannot install the software.

I do get a download prompt whenever I type the url into a browser address field.
I’m not sure how to resolve the issue with the PGP key.
I think I understand more or less how it’s supposed to work. For whatever reason, it seems like the keys are wrong or maybe it’s trying to authenticate at a different address somehow.
Either way, it’s frustrating.

I don’t think there is any proxy being used in the network, either. At least it doesn’t show up when I check for one.

I do get a download prompt whenever I type the url into a browser address field.

That is what is supposed to be happening. If you can get that file at that URL, then the command should be working. I am out of ideas, personally.

@Mattches Any thoughts?

Alright, let’s first check that you’re able to download the correct key.

Try the following to download the key to a file:

$ curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc > brave-core.asc

and then check that it has the right size:

$ ls -l brave-core.asc
-rw-r--r-- 1 francois francois 3914 Jan 14 16:33 brave-core.asc

and that the contents are correct too:

 $ sha256sum brave-core.asc
caf94b3b31d5b49dbbf26b8b05232057a4107b0b8a2a9f990774d4d1a6289a87  brave-core.asc

If you’re getting a different size or a different sha256, can you try downloading using a web browser and saving to a file. Then you can check the file size and run the sha256sum command again.

So after checking the curl command, I noticed nothing happened (still quite new to linux so this may be normal, thought I’d mention anyway). Regardless, I input the next commands as you suggested and here is my output:

~ ls -l brave-core.asc -rw-r--r-- 1 richard richard 3914 Jan 14 16:41 brave-core.asc sha256sum brave-core.asc
caf94b3b31d5b49dbbf26b8b05232057a4107b0b8a2a9f990774d4d1a6289a87 brave-core.asc

Looks like everything is checking out so far…

Good, now let’s check what keys are installed on your system before and after trying to import the Brave key. Can you copy here the output of:

apt-key list

Then try importing the key:

sudo apt-key add brave-core.asc

and then check the output of this command again:

apt-key list

Here is the output before trying to import the key:

richard@lenovo:~$ apt-key list
/etc/apt/trusted.gpg.d/linrunner_ubuntu_tlp.gpg
-----------------------------------------------
pub   rsa1024 2009-07-27 [SC]
      2042 F03C 5FAB D0BA 2CED  4041 2B3F 92F9 02D6 5EFF
uid           [ unknown] Launchpad PPA for linrunner

/etc/apt/trusted.gpg.d/nordvpn-keyring.gpg
------------------------------------------
pub   rsa4096 2018-08-02 [SC]
      BC54 80EF EC5C 081C E5BC  FBE2 6B21 9E53 5C96 4CA1
uid           [ unknown] NordVPN <admin@nordvpn.com>
sub   rsa4096 2018-08-02 [S]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      790B C727 7767 219C 42C8  6F93 3B4F E6AC C0B2 1F32
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
uid           [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub   rsa4096 2018-09-17 [SC]
      F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>

After inputting the ‘sudo apt-key add brave-core.asc’ command (and receiving the “OK” confirmation, here is the output:

richard@lenovo:~$ apt-key list
/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2018-10-15 [SC] [expires: 2020-02-05]
      D8BA D4DE 7EE1 7AF5 2A83  4B2D 0BB7 5829 C2D4 E821
uid           [ unknown] Brave Software <support@brave.com>
sub   rsa4096 2019-10-17 [S] [expires: 2020-05-14]

/etc/apt/trusted.gpg.d/linrunner_ubuntu_tlp.gpg
-----------------------------------------------
pub   rsa1024 2009-07-27 [SC]
      2042 F03C 5FAB D0BA 2CED  4041 2B3F 92F9 02D6 5EFF
uid           [ unknown] Launchpad PPA for linrunner

/etc/apt/trusted.gpg.d/nordvpn-keyring.gpg
------------------------------------------
pub   rsa4096 2018-08-02 [SC]
      BC54 80EF EC5C 081C E5BC  FBE2 6B21 9E53 5C96 4CA1
uid           [ unknown] NordVPN <admin@nordvpn.com>
sub   rsa4096 2018-08-02 [S]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      790B C727 7767 219C 42C8  6F93 3B4F E6AC C0B2 1F32
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
uid           [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub   rsa4096 2018-09-17 [SC]
      F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>

Ok, so now that you have the Brave key installed (the first entry in the last command you ran), you should be able to pull from our repository without issues.

Start by adding the repository:

echo "deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list

and then check the contents of the file (you can paste it here to confirm that this step worked):

cat /etc/apt/sources.list.d/brave-browser-release.list

Once that’s in place, pull down the list of packages from that repository and then try installing `brave-browser:

sudo apt update

sudo apt install brave-browser

It worked! I have finally installed it successfully! Thank you so much!!
Just out of curiosity, can you explain where it probably went wrong during the installation process or what might have happened that this occurred in the first place?
Just in case I have a similar problem in the future, I am still super new to using Linux.

1 Like

Great!

One last thing I would recommend is to cleanup /etc/apt/trusted.gpg since the Brave key should now also be installed in /etc/apt/trusted.gpg.d/brave-browser-release.gpg.

Double-check that it’s been properly installed by running apt-key list and making sure that you see the same key in /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/brave-browser-release.gpg. Then delete the file (rm /etc/apt/trusted.gpg). As a final check that everything is right, run apt update which should work without errors.

As for what went wrong, that’s hard to tell since we basically went through all of the installation steps again one by one (pausing at each step to verify that they all worked) and this time it worked. Based on some of the earlier output you pasted, my guess would be a typo somewhere in the first couple of steps (where we install the key using apt-key).

When I run apt-key list, there is no longer an entry for /etc/apt/trusted.gpg.
Not sure what this means, but just so you can see, here is the current output:

richard@lenovo:~$ apt-key list
/etc/apt/trusted.gpg.d/brave-browser-release.gpg
------------------------------------------------
pub   rsa4096 2018-10-15 [SC] [expires: 2020-02-05]
      D8BA D4DE 7EE1 7AF5 2A83  4B2D 0BB7 5829 C2D4 E821
uid           [ unknown] Brave Software <support@brave.com>
sub   rsa2048 2018-10-15 [S] [expires: 2020-02-05]
sub   rsa4096 2019-10-17 [S] [expires: 2020-05-14]

/etc/apt/trusted.gpg.d/linrunner_ubuntu_tlp.gpg
-----------------------------------------------
pub   rsa1024 2009-07-27 [SC]
      2042 F03C 5FAB D0BA 2CED  4041 2B3F 92F9 02D6 5EFF
uid           [ unknown] Launchpad PPA for linrunner

/etc/apt/trusted.gpg.d/nordvpn-keyring.gpg
------------------------------------------
pub   rsa4096 2018-08-02 [SC]
      BC54 80EF EC5C 081C E5BC  FBE2 6B21 9E53 5C96 4CA1
uid           [ unknown] NordVPN <admin@nordvpn.com>
sub   rsa4096 2018-08-02 [S]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      790B C727 7767 219C 42C8  6F93 3B4F E6AC C0B2 1F32
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
uid           [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub   rsa4096 2018-09-17 [SC]
      F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2018) <ftpmaster@ubuntu.com>

However, I will note that running apt update resulted in several errors:

richard@lenovo:~$ apt update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

That looks exactly like what it should be.

Sorry, I forgot to include sudo. Try this:

sudo apt update

That’s it. No errors whatsoever.
Thank you very much!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.