Brew upgrade get stuck in `removing...`

Hey!

It’s been several times that this happen when I run a brew upgrade… in the last package that has to upgrade brew get stuck in Removing... message. Some times it takes a quite sometime and it finally continues —in other words, return to the prompt since this is the last action— but some others I need to hit ctrl+c because it stay there for perhaps an hour or more.

As you can see in the image, while brew sit on there, Ruby is usually using 100% of one of the CPUs of my machine. I’m under High Sierra.

This isn’t something new. I have been experiencing this behavior for a couple of months or perhaps more, but I wasn’t sure what was going on… and I also thought that it was just a temporal glitch.

Any idea of what is going on?

Thank you!

PS/ I haven’t fill an issue because I don’t know if it’s really reproducible or not.

Try to run brew cleanup --verbose --debug manually and see if it produces the same behaviour.

No, it ended well and quite fast.

PS/ I usually perform a brew cleanup after each brew upgrade and usually here is no issue.

Best bet is to run brew upgrade --debug next time and try to figure out where it’s stuck.

OK!

I’ll do that form now so see what is going on.

Thanks!

As of 2.0 this isn’t needed anymore. Cleanup will be done by default.

1 Like

BRAVO! :clap: :stuck_out_tongue:

it seems to get stuck here:

==> Summary
🍺  /usr/local/Cellar/wxpython/4.0.6: 1,130 files, 57.2MB
Removing: /usr/local/Cellar/wxpython/3.0.2.0_1... (1,108 files, 37.9MB)
find /usr/local/Cellar/wxpython -name .DS_Store -delete
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/cairo.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/r.rb

I don’t really know what is going on… those two formulae (cairo and r) are installed from another tap instead from core and they have the same name.

Could you try to untap that tap or uninstall those formulae?

Hardly no… because I need it. But I think I have a theory about what could be the issue at least in origin.

I have some other formulae that depends in R and therefore Cairo, but the Core ones instead of the ones from this tap. Since I don’t want to uninstall and install when the dependents are updated, I just unlink those cellars —R & cairo— and rename them. Brew installs the ones from core and after the install finish I just unlink the ones form core, delete them and the ones from the alternative tap and renamed back.

I’ll do a proper uninstall and install and let’s see how it turns out.

It’s still getting more or less stuck in that step:

Changing install name in /usr/local/Cellar/harfbuzz/2.5.1/lib/libharfbuzz.0.dylib
  from @@HOMEBREW_PREFIX@@/opt/graphite2/lib/libgraphite2.3.dylib
    to /usr/local/opt/graphite2/lib/libgraphite2.3.dylib
/usr/local/Homebrew/Library/Homebrew/postinstall.rb (Formulary::FromPathLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/harfbuzz.rb
🍺  /usr/local/Cellar/harfbuzz/2.5.1: 151 files, 10.0MB
Removing: /usr/local/Cellar/harfbuzz/2.5.0... (150 files, 10.0MB)
find /usr/local/Cellar/harfbuzz -name .DS_Store -delete
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/r.rb

I really don’t understand why it’s loading a formulae from core that aren’t installed in that step.

I tried to brew rm homebrew/core/r homebrew/core/cairo and it delete the ones from the other tap. I checked that no r or cairo formulae was installed and installed again the ones from the tap.

This is the tap of that formulae https://github.com/sethrfore/homebrew-r-srf

This is still happening almost every time I brew upgrade. Any idea? @srfore is the maintainer of the alternative tap for R and Cairo. Is this happening to you? Any idea what is going on here?

By the way… not it’s stuck in here and no R or Cairo related message.

Next week I’m going to change my computer and upgrade to Mojave, perhaps is something related with the last version Ruby and High Sierra?

At this point it’s probably worth adding more debugging information to your local installations of Homebrew and the formulae to figure out what’s going on.

Yes, this happens to me intermittently as well. I’ve no idea what is causing it and cannot systematically reproduce the problem. Moreover, I am running Mojave so it is unlikely OS related.

In terms of additional information, I currently have the Homebrew cask version of R installed for all personal related use as well as the Homebrew core versions of R and Cairo installed (not the versions maintained at https://github.com/sethrfore/homebrew-r-srf) due to external formula dependencies.

The only reason I’m using the cask R version rather than my own or the core version is due to a quartz graphics related issue where fonts and lines get blurred upon resizing the plotting device. I have no idea if others have had this issue or it in any way relates to the subject at hand.

In short, I don’t know if brew upgrade hangs due to an issue with my tap or multiple versions of R being installed or something else entirely.

Also, just so you all know, I am no expert in any of this so it certainly could relate to my tap. If there are problems or other ways it could be improved to integrate better with other Homebrew formulas, I’d be happy implement them to the extent my skill allows!

1 Like

Definitely smells R and/or Cairo related.

I’m seeing this too, and also only have the ‘standard’ versions of r and cairo installed because of dependencies. I’d be happy to help debug - how would you suggest “adding debugging information”?

Debugging information can be obtained by running the relevant command with --debug --verbose and pasting your brew config and brew doctor in here. What would be better still is to modify Homebrew’s source code to output things with puts or p or pp so you can get a sense of where exactly things are getting stuck.

It’s also worth asking: how long is it being left before it’s deemed to be stuck? 1 minute, 5 minutes, 1 hour, 5 hours?

Ah, that’s maybe getting us somewhere. Running upgrade just now with --debug --verbose shows it’s actually stuck on ==> Checking dependents for broken library links. The ruby process then takes up a lot of cpu - I’ve let it run for hours before.

Brew config:

HOMEBREW_VERSION: 2.1.6-18-g9a1936c
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9a1936cd4b773dbd74695d3c110583570b58771b
Last commit: 5 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 489783c90329f48c3fd51a89b5ab715b4851b891
Core tap last commit: 5 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
CPU: quad-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1001
Git: 2.22.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_31
macOS: 10.14.5-x86_64
CLT: 10.2.1.0.1.1554506761
Xcode: 10.2.1
CLT headers: 10.2.1.0.1.1554506761
XQuartz: 2.7.11 => /opt/X11

Brew doctor:

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 or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  openjpeg

Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
  brew install postgresql proj

Run `brew missing` for more details.

The warnings are caused by having osgeo4mac’s qgis, which is stuck outside of homebrew because of this issue.

Actually, that just completed after about 25 minutes in total for one libssh upgrade. Hmm.