Installation issue (ubuntu 18.04.3 LTS)

Let me preface this by saying that I am completely new to linux and working with the terminal (I only started using linux 3 days ago).
That said, I am having an issue while trying to install linux on the terminal. I have seen similar issues described here, but with other error codes. Now, whenever I try to install the browser, I receive the following error in the terminal:

E: Malformed line 1 in source list /etc/apt/sources.list.d/brave-browser-release.list (type)
E: The list of sources could not be read.
E: Malformed line 1 in source list /etc/apt/sources.list.d/brave-browser-release.list (type)
E: The list of sources could not be read.

I am using ubuntu 18.04.3 LTS and am trying to install the latest Brave version.
I’m still learning to work with linux, so detailed explanation would be much appreciated!
Thank you in advance for your time.

This is a screenshot of the exact error that displays in the top right corner of my screen when I log on.
The error is still persistent.

Screenshot from 2020-01-08 15-47-00

And here is a screenshot of my terminal when I run ‘apt-get update’, or really anything to do with apt-get.
Any advice is appreciated.

@Rb8623,
Thanks for reaching out! I would recommend doing a clean install – that is, removing any Brave data you currently have on your machine and then using the commands to instal the browser:

  1. Open your terminal and enter the following commands:
    • rm -rf /etc/apt/sources.list.d/brave-browser*
    • rm -rf /etc/apt/trusted.gpg.d/brave-browser*
      This will delete any Brave filed stored in sources/trusted.
  2. Then, enter
    • sudo apt-key del D8BAD4DE7EE17AF52A834B2D0BB75829C2D4E821
    • sudo apt-key del 9228DBCE20DDE5EC46488DE90B31DBA06A8A26F9
      This removes any signing keys
  3. Then, remove any remaining packages:
    • sudo apt purge brave-browser brave-keyring
  4. Then, use the regular installation instructions to try and install Brave. I would recommend doing one line at a time for clarity:
sudo apt install apt-transport-https curl

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 -

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

sudo apt update

sudo apt install brave-browser

Thank you so much for the reply!
I followed your instructions and got all the way to the last line before receiving an error message ‘unable to locate package brave-browser’.
Not sure what happened, but here is my command line up to that point.

richard@lenovo:~$ rm -rf /etc/apt/sources.list.d/brave-browser*
richard@lenovo:~$ rm -rf /etc/apt/trusted.gpg.d/brave-browser*
richard@lenovo:~$ sudo apt-key del D8BAD4DE7EE17AF52A834B2D0BB75829C2D4E821
OK
richard@lenovo:~$  sudo apt-key del 9228DBCE20DDE5EC46488DE90B31DBA06A8A26F9
OK
richard@lenovo:~$ 
richard@lenovo:~$     sudo apt purge brave-browser brave-keyring
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package brave-browser
E: Unable to locate package brave-keyring
richard@lenovo:~$ sudo apt install apt-transport-https curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version (7.58.0-2ubuntu3.8).
apt-transport-https is already the newest version (1.6.12).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
richard@lenovo:~$ 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 -
gpg: no valid OpenPGP data found.
richard@lenovo:~$ 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
deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main
richard@lenovo:~$ sudo apt update
Get:1 https://brave-browser-apt-release.s3.brave.com stable InRelease [2,835 B]
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease                     
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]    
Err:1 https://brave-browser-apt-release.s3.brave.com stable InRelease          
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4FE13824E3FFC656
Get:4 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]   
Hit:5 http://ppa.launchpad.net/linrunner/tlp/ubuntu bionic InRelease           
Get:6 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] 
Get:7 https://repo.nordvpn.com/deb/nordvpn/debian stable InRelease [6,174 B]   
Get:8 http://us.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages [629 kB]
Get:9 https://repo.nordvpn.com/deb/nordvpn/debian stable/main amd64 Packages [3,148 B]
Get:10 https://repo.nordvpn.com/deb/nordvpn/debian stable/main i386 Packages [3,130 B]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages [417 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [830 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [290 kB]
Get:14 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [295 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [73.8 kB]
Get:16 http://us.archive.ubuntu.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [143 kB]
Get:17 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [26.0 kB]
Get:18 http://us.archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [6,976 B]
Get:19 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages [997 kB]
Get:20 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,035 kB]
Get:21 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [320 kB]
Get:22 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [264 kB]
Get:23 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [201 kB]
Get:24 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [457 kB]
Get:25 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [9,500 B]
Get:26 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [4,540 B]
Get:27 http://us.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:28 http://us.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [7,972 B]
Get:29 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [606 kB]
Get:30 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [196 kB]
Get:31 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]
Get:32 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]
Get:33 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]
Get:34 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [17.0 kB]
Get:35 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [5,032 B]
Get:36 http://security.ubuntu.com/ubuntu bionic-security/universe i386 Packages [601 kB]
Get:37 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [628 kB]
Get:38 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [210 kB]
Get:39 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.2 kB]
Get:40 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]
Get:41 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [113 kB]
Get:42 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,460 B]
Reading package lists... Done                                               
W: GPG error: https://brave-browser-apt-release.s3.brave.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4FE13824E3FFC656
E: The repository 'https://brave-browser-apt-release.s3.brave.com stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
richard@lenovo:~$ sudo apt install brave-browser
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package brave-browser
richard@lenovo:~$ 

I’m unsure as to what happened.

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