Installing packaged on linuxbrew fails due to invalid chown argument


#1

I’m on a linux machine at university and don’t have sudo rights. However, I’d like to install some software like gnuplot, rstudio, a fortran compiler and the like without calling for IT every single time. I’ve used homebrew on OS X for 5 years or so, so I figured linuxbrew would work.

I have installed git from apt-get (got the IT guy to do it) and installed curl and patchelf from source. When I try to install any package, be it a bottle or from source, it fails due to the INSTALL_RECEIPT having the wrong permissions. Here’s the verbose output of brew install m4

==> Downloading https://linuxbrew.bintray.com/bottles/m4-1.4.18.x86_64_linux.bottle.tar.gz Already downloaded: /home/au522021/.cache/Homebrew/downloads/9fbd4721316274995db37b5f92441b550d09bd131339ecc447377ee886970363--m4-1.4.18.x86_64_linux.bottle.tar.gz ==> Verifying 9fbd4721316274995db37b5f92441b550d09bd131339ecc447377ee886970363--m4-1.4.18.x86_64_linux.bottle.tar.gz checksum ==> Pouring m4-1.4.18.x86_64_linux.bottle.tar.gz tar xf /home/au522021/.cache/Homebrew/downloads/9fbd4721316274995db37b5f92441b550d09bd131339ecc447377ee886970363--m4-1.4.18.x86_64_linux.bottle.tar.gz -C /tmp/d20190221-28950-hqhgto cp -pR /tmp/d20190221-28950-hqhgto/m4/. /home/au522021/.linuxbrew/Cellar/m4 chmod -Rf +w /tmp/d20190221-28950-hqhgto /home/au522021/.linuxbrew/bin/patchelf --force-rpath --set-rpath /home/au522021/.linuxbrew/lib --set-interpreter /home/au522021/.linuxbrew/lib/ld.so /home/au522021/.linuxbrew/Cellar/m4/1.4.18/bin/m4 Error: Invalid argument @ chown_internal - /home/au522021/.linuxbrew/Cellar/m4/1.4.18/.INSTALL_RECEIPT.json20190221-28950-zy84nb Warning: Bottle installation failed: building from source.

Building from source also fails with the same error and the error happens to all packages I’ve tried.

I tried looking and it seems it may be related to the way the computer is set up, that is on a NFS4 server or something. I tried looking at the homebrew ruby source and figure out how to change the behavior, but with no luck.

I can sort of “install packages manually”, that is

  • downloading a bottle from https://linuxbrew.bintray.com/bottles/
  • unpack it
  • run chmod 664 on file .INSTALL_RECEIPT.json
  • run patchelf to set the correct paths for the dynamic loading of shared libraries
  • cp directory to ~/.Linuxbrew/Cellar
  • run brew link

(Jonathan Chang) #2

When pouring bottles Homebrew first extracts the bottled files to a temporary directory, then moves those to the correct Cellar location. It’s possible that the permissions of the temporary directory are set in a way that conflicts with how Homebrew operates.

One thing that might work would be to set HOMEBREW_TEMP to somewhere in your home directory.

Otherwise, you check brew doctor and ensure that you’ve fixed the issues that you can fix and paste the results here?


#3

Changing the temp and cache directory did not change anything. It happens on a completely clean installation of linuxbrew.

Brew doctor some warnings, mostly not related to linuxbrew itself, such as python being linked to python3 and config scripts existing somewhere else.

However, I find this one a bit strange:

Warning: Your Homebrew's prefix is not /home/linuxbrew/.linuxbrew. Some of Homebrew's bottles (binary packages) can only be used with the default prefix (/home/linuxbrew/.linuxbrew). You will encounter build failures with some formulae. Please create pull requests instead of asking for help on Homebrew's GitHub, Discourse, Twitter or IRC. You are responsible for resolving any issues you experience, as you are running this unsupported configuration.

I mean, how on earth is /home/linuxbrew even a sensible path?

Also, in the end it gives this error:

Error: undefined method prepend_variable_in_profile' for Utils::Shell:Module Did you mean? prepend_path_in_profile

Which seems to be fixed in PR 895 (https://github.com/Linuxbrew/brew/issues/892) so that’s also strange.


(Shaun Jackman) #4

Regarding the /home/linuxbrew, here’s my stock response:

Consider installing Linuxbrew in /home/linuxbrew/.linuxbrew/ if possible so that you can use precompiled binary packages (known as bottles) for non-relocatable formula like util-linux.
Another possible workaround for you is brew install --force-bottle util-linux, but no promises.

If it’s an option for you, you could open a ticket with your information systems department to ask that they create a linuxbrew role account with home directory /home/linuxbrew.

The precompiled binary bottles of non-relocatable bottles can only be used if you install in /home/linuxbrew/.linuxbrew, otherwise they have to be built from source. See the documentation below. On macOS the default installation directory is /usr/local. On Linux the default installation directory is /home/linuxbrew/.linuxbrew.


(Shaun Jackman) #5

I’ve opened PR https://github.com/Homebrew/brew/pull/5782 to hopefully fix the brew doctor error.


(Shaun Jackman) #6

Please open an issue at https://github.com/Homebrew/brew to report the brew install m4 failure.


#7

It’s a university computer, I can’t make an account for linuxbrew. I figured the big selling point was I didn’t need root access to install software in userspace.

I’ll open a issue with the install failure, which happens no matter what I install.