legacy-linuxbrew icon indicating copy to clipboard operation
legacy-linuxbrew copied to clipboard

fatal: unable to access ... linuxbrew.git: error setting certificate verify locations ...

Open DiagonalArg opened this issue 11 years ago • 17 comments

brew update is failing:

>brew update
fatal: unable to access 'https://github.com/Homebrew/linuxbrew.git/': error setting certificate verify locations:
  CAfile: /home/<me>/.linuxbrew/etc/openssl/cert.pem
  CApath: none
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

But ~/.linuxbrew/etc/openssl/cert.pem definitely exists.

Is this related to issue #158?

DiagonalArg avatar Jan 11 '15 03:01 DiagonalArg

Can you report the output of brew postinstall openssl and brew test openssl?

sjackman avatar Jan 12 '15 05:01 sjackman

@sjackman - here you go!

~$ brew postinstall openssl                                                                                                                                  
==> Downloading http://curl.haxx.se/ca/cacert.pem                                                                                                                         
################################################################################################################################################################## 100.0%
~$ brew test openssl                                                                                                                                         
Testing openssl                                                                                                                                                           
==> /home/me/.linuxbrew/Cellar/openssl/1.0.1j/bin/openssl dgst -sha1 -out checksum.txt testfile.txt                                                                    
~$ brew update                                                                                                                                               
fatal: unable to access 'https://github.com/Homebrew/linuxbrew.git/': error setting certificate verify locations:                                                         
  CAfile: /home/me/.linuxbrew/etc/openssl/cert.pem                                                                                                                     
  CApath: none                                                                                                                                                            
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

Thanks /DA

DiagonalArg avatar Jan 12 '15 11:01 DiagonalArg

Perhaps it's a permissions issue? It seems unlikely, but it's worth checking.

ls -ld /home/me/.linuxbrew/etc/openssl/cert.pem
ls -ld /home/me/.linuxbrew/etc/openssl/
ls -ld /home/me/.linuxbrew/etc/
ls -ld /home/me/.linuxbrew/
ls -ld /home/me/
ls -ld /home/
ls -ld /

Also a shot in the dark, but you can try…

brew install git --with-brewed-openssl --with-brewed-curl

sjackman avatar Jan 14 '15 19:01 sjackman

@sjackman - thanks for your response. I have checked each of the files/directories, and I have rw permission for first 5 and execute permission for all but the first.

Also, I tried your shot in the dark, but no luck. I get the same result when I try "brew update".

DiagonalArg avatar Jan 15 '15 09:01 DiagonalArg

Can you try wc /home/me/.linuxbrew/etc/openssl/cert.pem.

$ wc /home/sjackman/.linuxbrew/etc/openssl/cert.pem
  3894   4653 251894 /home/sjackman/.linuxbrew/etc/openssl/cert.pem

sjackman avatar Jan 16 '15 23:01 sjackman

Wow. Nothing there! (Empty file.)

How do I fix that?

DiagonalArg avatar Jan 17 '15 13:01 DiagonalArg

Try…

rm -f /home/me/.linuxbrew/etc/openssl/cert.pem
wc /home/me/.linuxbrew/etc/openssl/cert.pem
brew postinstall openssl
wc /home/me/.linuxbrew/etc/openssl/cert.pem

sjackman avatar Jan 19 '15 19:01 sjackman

If I understood anything at all about how this all work, I know I could have figured that out! (Feeling a bit stupid now.)

Thank, man.

DiagonalArg avatar Jan 23 '15 10:01 DiagonalArg

No worries. Glad we sorted it out.

sjackman avatar Jan 23 '15 17:01 sjackman

I solved this with ln -s /etc/pki/tls/cert.pem /home/myusername/.linuxbrew/etc/openssl/cert.pem.

kris-luminar avatar Mar 29 '17 17:03 kris-luminar

Thanks for the workaround. Did brew postinstall openssl work for you?

sjackman avatar Mar 29 '17 18:03 sjackman

Thanks for the workaround. Did brew postinstall openssl work for you?

@sjackman it's been a week, and I don't recall clearly, but I don't think it did.

kris-luminar avatar Apr 05 '17 19:04 kris-luminar

I was running into this same issue while trying to install bcftools. (BCFtools has openSSL as a prerequisite). It seems to be a bootstrapping/catch22 problem: curl can't download the cert.pem because it's an https:// and it doesn't have a cert.pem to confirm that the connection is secure. The ln -s /etc/pki/tls/cert.pem $HOME/.linuxbrew/etc/openssl/cert.pemas proposed by @kris-luminar above worked for me as well.

alanhoyle avatar Jun 12 '17 18:06 alanhoyle

I just ran into this as well. I manually downloaded the cert.pem it was trying to pull and dropped it into $HOME/.linuxbrew/etc/openssl/cert.pem. However, if I tried to run postinstall again it would wipe out this file and then choke on the lack of a rootca file again.

wduncanfraser avatar Jun 12 '17 22:06 wduncanfraser

I've created PR https://github.com/Linuxbrew/homebrew-core/pull/2924 to resolve this issue by adding an http mirror for the OpenSSL certificates cacert.pem.

sjackman avatar Jun 13 '17 19:06 sjackman

Fixed by https://github.com/Linuxbrew/homebrew-core/pull/2924

sjackman avatar Jun 13 '17 19:06 sjackman

brew postinstall openssl did trick for me and fixed the similar issue. Thank you very much!!!

skuznetsov avatar Sep 13 '17 02:09 skuznetsov