Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.66k stars 238 forks source link

Brew has lost the ability to install/upgrade packages from bottles or source #480

Closed JakeGoodall closed 7 years ago

JakeGoodall commented 7 years ago

Please always follow these steps:

Please note we will close your issue without comment if you delete or do not fill out the issue checklist and provide ALL the requested information.

Hi Linuxbrew help,

I'm hoping you can help me with an issue that has seemingly popped up out of no where. I've been using linuxbrew regularly over the last few months and am really happy with the program overall (seriously its great). But in the last week I seem to have lost all capacity to install new programs or upgrade existing ones. The issue appears to be related to brew's ability to install packages from websites. For example:

brew install muscle
==> Installing muscle from homebrew/science
==> Downloading https://linuxbrew.bintray.com/bottles-science/muscle-3.8.1551.x86_64_linux.bottle.tar.gz
Error: Failed to download resource "muscle"
Download failed: https://linuxbrew.bintray.com/bottles-science/muscle-3.8.1551.x86_64_linux.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading http://www.drive5.com/muscle/muscle_src_3.8.1551.tar.gz
Error: Failed to download resource "muscle"
Download failed: http://www.drive5.com/muscle/muscle_src_3.8.1551.tar.gz

This issue is not specific to muscle but all new programs and/or existing program updates. Brew will always try to download a program from bottle, fail, then move to downloading the program from source, which also fails. I was concerned that this issue was stemming from curl/openssl so followed the recommendations given on https://github.com/Linuxbrew/legacy-linuxbrew/issues/883. This allowed me to update curl/openssl yet the issue persists.

I suspect something has gone wrong with brews ability to interact with outside programs/resources. This seems to also extend to brews ability to update itself.

brew update
Error: Fetching /users/home/jake/.linuxbrew failed!
Fetching /users/home/jake/.linuxbrew/Library/Taps/homebrew/homebrew-core failed!
Fetching /users/home/jake/.linuxbrew/Library/Taps/linuxbrew/homebrew-extra failed!
Fetching /users/home/jake/.linuxbrew/Library/Taps/homebrew/homebrew-science failed!
Fetching /users/home/jake/.linuxbrew/Library/Taps/linuxbrew/homebrew-xorg failed!

The programs that are currently installed using linuxbrew are still functional. However, they cannot be upgraded as the upgrades seemingly cannot be downloaded from bottles or source. I have included my brew config and doctor outputs below. However please take note of the comment related to the brew doctor output.

brew config
HOMEBREW_VERSION: 1.3.0
ORIGIN: https://github.com/Linuxbrew/brew.git
HEAD: d07cc2d61efa996424c424ee11b8b0a6e92c76c7
Last commit: 9 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: dfbaf75b1b5bd8fa666a397ff65389eb27f57ca9
Core tap last commit: 5 days ago
HOMEBREW_PREFIX: /users/home/jake
HOMEBREW_REPOSITORY: /users/home/jake/.linuxbrew
HOMEBREW_CELLAR: /users/home/jake/.linuxbrew/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://linuxbrew.bintray.com
CPU: 16-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648 => /users/home/jake/.linuxbrew/Library/Homebrew/vendor/portable-ruby/2.0.0-p648/bin/ruby
Clang: N/A
Git: 2.13.3 => /users/home/jake/bin/git
Perl: /users/home/jake/bin/perl => /users/home/jake/.linuxbrew/Cellar/perl/5.26.0_1/bin/perl
Python: /users/home/jake/opt/python/libexec/bin/python => /users/home/jake/.linuxbrew/Cellar/python/2.7.13_1/bin/python2.7
Ruby: /users/home/jake/opt/ruby@2.2/bin/ruby => /users/home/jake/.linuxbrew/Cellar/ruby@2.2/2.2.7/bin/ruby
Java: 1.8.0_131
Kernel: Linux 3.10.0-327.36.3.el7.x86_64 x86_64 GNU/Linux
OS: CentOS Linux release 7.2.1511 (Core) 
Host glibc: 2.17
/usr/bin/gcc: 4.8.5
glibc: 2.23
gcc: 5.3.0
xorg: 20170115
brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Setting LD_* vars can break dynamic linking.
Set variables:
  LD_LIBRARY_PATH: /opt/ohpc/pub/mpi/openmpi-gnu/1.10.4/lib:/opt/ohpc/pub/compiler/gcc/5.4.0/lib64

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
  /bin/python2.7-config
  /bin/python2-config
  /bin/python-config
  /bin/pkg-config

Doctor Comment: I'm working within a high performance cluster system and thus I do not have root access to /bin/.. I can remove the /bin/ directory from my environment path, however I will then lose basic command functions (such as vi, ls, etc). For this reason I have not removed them yet (although I can). I can also remove the LD_LIBRARY_PATH however this does not seem to have any impact on whether brew is able to install/upgrade programs. I have thus left it here in case it does have some unforeseen relevance, however again I can remove it from my path if required.

sjackman commented 7 years ago

I'm glad to hear that you find Linuxbrew useful!

Warning: Setting LD_* vars can break dynamic linking.
Set variables:
  LD_LIBRARY_PATH: /opt/ohpc/pub/mpi/openmpi-gnu/1.10.4/lib:/opt/ohpc/pub/compiler/gcc/5.4.0/lib64

is the most common culprit to breaking things. As a sanity check, please report the output of…

env -u LD_LIBRARY_PATH brew fetch -v hello

Please also report the output of…

brew list --versions openssl curl
brew linkage curl
brew postinstall openssl
which -a curl
curl --version
ldd $(which curl)
JakeGoodall commented 7 years ago

Thanks for getting back to me so quickly. Outputs are as follows:

env -u LD_LIBRARY_PATH brew fetch -v hello
==> Downloading https://linuxbrew.bintray.com/bottles/hello-2.10.x86_64_linux.bottle.tar.gz
Already downloaded: /users/home/jake/.cache/Homebrew/hello-2.10.x86_64_linux.bottle.tar.gz
SHA256: f81d7c0a3eee9fd62ebdecf685fbc5284e40d4a61c372d554fd45719e52a43cc
==> Verifying hello-2.10.x86_64_linux.bottle.tar.gz checksum
$ brew list --versions openssl curl
openssl 1.0.2l
curl 7.55.1

$ brew linkage curl
Homebrew libraries:
  /users/home/jake/lib/libcurl.so.4 (curl)
  /users/home/jake/lib/libc.so.6 (glibc)
  /users/home/jake/lib/libpthread.so.0 (glibc)
  /users/home/jake/lib/libcrypto.so.1.0.0 (openssl)
  /users/home/jake/lib/libssl.so.1.0.0 (openssl)
  /users/home/jake/lib/libz.so.1 (zlib)
Possible undeclared dependencies:
  zlib

$ brew postinstall openssl
==> Postinstalling openssl
==> Downloading https://curl.haxx.se/ca/cacert-2017-01-18.pem
Already downloaded: /users/home/jake/.cache/Homebrew/openssl--cacert-2017-01-18.pem

$ which -a curl
~/bin/curl
/bin/curl
curl --version
Illegal instruction

$ ldd $(which curl)
linux-vdso.so.1 (0x00007ffeec9d4000)
    libcurl.so.4 => /users/home/jake/lib/libcurl.so.4 (0x00007f4f0dd84000)
    libssl.so.1.0.0 => /users/home/jake/lib/libssl.so.1.0.0 (0x00007f4f0db11000)
    libcrypto.so.1.0.0 => /users/home/jake/lib/libcrypto.so.1.0.0 (0x00007f4f0d6bb000)
    libz.so.1 => /users/home/jake/lib/libz.so.1 (0x00007f4f0d4a6000)
    libpthread.so.0 => /users/home/jake/lib/libpthread.so.0 (0x00007f4f0d289000)
    libc.so.6 => /users/home/jake/lib/libc.so.6 (0x00007f4f0ceea000)
    libdl.so.2 => /users/home/jake/.linuxbrew/lib/libdl.so.2 (0x00007f4f0cce6000)
    /users/home/jake/lib/ld.so (0x00007f4f0dff8000)

From the '$ which -a curl' output I can see that my system is using the wrong version of curl for some reason. It's not using the linuxbrew installed version, but instead the one that loaded onto the cluster system. This seems pretty odd given that I've set my environment path up to call the linuxbrew version of curl.

curl -> ../.linuxbrew/Cellar/curl/7.55.1/bin/curl
curl-config -> ../.linuxbrew/Cellar/curl/7.55.1/bin/curl-config

I also have my .bash_profile set up so that the /bin directory within my home directory should be accessed before the cluster /bin directory. export PATH=/users/home/jake/bin:/bin >>~/.bash_profile

But then again, I'm still learning command line so its quite likely I've still done something wrong. I've also tried to remove the LD_LIBRARY_PATH using the following:

export LD_LIBRARY_PATH=""
export -n LD_LIBRARY_PATH

Removing it doesn't seem to help, but I'm not totally convinced I've removed the LD_LIBRARY_PATH correctly as it gets reset when I reset/log back into the terminal. Had a look though my .bashrc, .bash_profile and .profile files and can't seem to locate where exactly the path variable is coming from.

sjackman commented 7 years ago
$ which -a curl
~/bin/curl
/bin/curl

From the '$ which -a curl' output I can see that my system is using the wrong version of curl for some reason.

That output is actually fine. ~/bin/curl is first in the list before /bin/curl

sjackman commented 7 years ago
$ curl --version
Illegal instruction

Here's the problem. It's using a CPU opcode that's not supported by your system. I likely culprit is compiling openssl on one system with a newer CPU, and then attempting to run it on an older system. If that's the case, try brew reinstall openssl on the oldest system that you plan to use.

Try also…

env -u LD_LIBRARY_PATH curl --version
JakeGoodall commented 7 years ago

Hello again. So following your advice, here are the results:

$ brew reinstall openssl
==> Reinstalling openssl 
/users/home/jake/opt/curl/bin/curl: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
/users/home/jake/opt/curl/bin/curl: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
==> Downloading https://www.openssl.org/source/openssl-1.0.2l.tar.gz
Already downloaded: /users/home/jake/.cache/Homebrew/openssl-1.0.2l.tar.gz
==> Downloading https://github.com/openssl/openssl/pull/1524.patch
Already downloaded: /users/home/jake/.cache/Homebrew/openssl--patch-bc954e98673a78983e58da2fe6decfcf94b38eeec78d8b456ca716a539f78b06.patch
==> Patching
==> Applying 1524.patch
patching file Configure
Hunk #1 succeeded at 1723 (offset 2 lines).
==> perl ./Configure --prefix=/users/home/jake/.linuxbrew/Cellar/openssl/1.0.2l --openssldir=/users/home/jake/etc/openssl no-s
==> make depend
==> make
==> make test
==> make install MANDIR=/users/home/jake/.linuxbrew/Cellar/openssl/1.0.2l/share/man MANSUFFIX=ssl
==> Downloading https://curl.haxx.se/ca/cacert-2017-01-18.pem
Already downloaded: /users/home/jake/.cache/Homebrew/openssl--cacert-2017-01-18.pem
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /users/home/jake/etc/openssl/certs

and run
  /users/home/jake/opt/openssl/bin/c_rehash

==> Summary
🍺  /users/home/jake/.linuxbrew/Cellar/openssl/1.0.2l: 1,708 files, 14.4MB, built in 12 minutes 17 seconds
$ env -u LD_LIBRARY_PATH curl --version
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2l zlib/1.2.11
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy

So following the re-installation of openssl I tried to download the program muscle (example from my original post). The output was the following:

brew install muscle
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from d07cc2d61 to 09208fb2a.
Updated 2 taps (homebrew/core, homebrew/science).
==> New Formulae
docfx                                                           poppler@0.57
==> Updated Formulae
abcmidi                                   fb-client                                 lynis
ace                                       fbida                                     lzlib
activemq                                  feh                                       macvim
agedu                                     ffe                                       mbedtls
allure                                    file-formula                              mdp
ansible-lint                              firebase-cli                              mgba
apache-opennlp                            fizmo                                     mikutter
app-engine-java                           flow                                      mutt
apr                                       flowgrind                                 mysql-sandbox
apr-util                                  fluent-bit                                nestopia-ue
armadillo                                 folly                                     nnn
ats2-postiats                             fossil                                    node@6
avfs                                      freeciv                                   nvm ✔
avro-c                                    freetds                                   opendetex
avro-cpp                                  freexl                                    paket
bacula-fd                                 fs-uae                                    pango
bashdb                                    fuse-emulator                             pdf2htmlex
bcpp                                      fuse-zip                                  pdftoedn
bento4                                    fzf                                       pdftoipe
bibutils                                  gabedit                                   pgformatter
bigloo                                    galen                                     ponyc
blockhash                                 gammaray                                  poppler
camlp5                                    gandi.cli                                 postgrest
carthage                                  gcsfuse                                   povray
cassandra                                 git-quick-stats                           pqiv
ccm                                       gitbucket                                 pre-commit
certbot                                   glibmm                                    psqlodbc
cheat                                     gmime                                     pulseaudio
checkbashisms                             gnome-builder                             pumba
chordii                                   gnuplot                                   qbs
cmark-gfm                                 goocanvas                                 qemu
conan                                     goofys                                    rtv
consul-backinator                         gource                                    ruby
consul-template                           gtk+3                                     ruby@2.2 ✔
coreutils                                 gtksourceview3                            ruby@2.3
crash                                     harfbuzz                                  rustup-init
cython                                    heroku                                    sbt
dar                                       homebrew/science/abinit                   sqlmap
deis                                      homebrew/science/astrometry-net           sslyze
diff-pdf                                  homebrew/science/bowtie2                  statik
diffoscope                                homebrew/science/cmdstan                  strongswan
digdag                                    homebrew/science/gubbins                  swiftformat
django-completion                         homebrew/science/itensor                  syncthing
dmd                                       homebrew/science/kent-tools               sysbench
dmtx-utils                                homebrew/science/nextflow                 systemd
docker-compose                            homebrew/science/openimageio              tee-clc
docker-compose-completion                 homebrew/science/spades                   telegraf
dsh                                       hunspell                                  termius
dtc                                       hwloc                                     terraform
dterm                                     icoutils                                  terragrunt
dub                                       imagemagick                               tippecanoe
duck                                      imagemagick@6                             todoman
duo_unix                                  io                                        tokei
duplicity                                 ios-deploy                                trafficserver
duply                                     jenkins                                   translate-toolkit
dvdauthor                                 jupyter                                   tth
dwarfutils                                kubernetes-helm                           urh
dwdiff                                    libchamplain                              vala
easyrpg-player                            libmagic                                  valabind
efl                                       libmowgli                                 vault
entr                                      libspectrum                               vim
eprover                                   libtiff                                   vtk
etcd                                      libu2f-host                               webpack
exact-image                               libuv                                     wpscan
exempi                                    libvirt                                   yaz
eye-d3                                    libxml++                                  youtube-dl
faas-cli                                  libxml2 ✔                                 zabbix
fabric                                    libzip                                    zbar
fatsort                                   lldpd                                     zimg
==> Deleted Formulae
abi-compliance-checker                    homebrew/science/statismo                 team-explorer-everywhere

==> Installing muscle from homebrew/science
==> Downloading https://linuxbrew.bintray.com/bottles-science/muscle-3.8.1551.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/c5/c554628301f042c9803c045da94ea9109c414b277f994cd6fc07763c93c7e510?__gda__=ex
######################################################################## 100.0%
==> Pouring muscle-3.8.1551.x86_64_linux.bottle.tar.gz
🍺  /users/home/jake/.linuxbrew/Cellar/muscle/3.8.1551: 3 files, 605.5KB

As a precaution I decided to install a couple of other programs, all of which downloaded, installed and function as expected. So from what I can tell brew is back to working perfectly - issue resolved.

Thankyou for all your help and prompt replies, much appreciated. And once again thanks for creating such a great program.

sjackman commented 7 years ago

Happy to help. Glad to hear that you got it working!