Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/usr/local/Homebrew migration tracking issue #987

Closed
MikeMcQuaid opened this issue Sep 17, 2016 · 100 comments
Closed

/usr/local/Homebrew migration tracking issue #987

MikeMcQuaid opened this issue Sep 17, 2016 · 100 comments
Labels
bug Reproducible Homebrew/brew bug
Milestone

Comments

@MikeMcQuaid
Copy link
Member

MikeMcQuaid commented Sep 17, 2016

If you were directed to report your errors here by brew update please post a comment if your error is different to a previously mentioned comment and otherwise "Subscribe" to this issue rather than posting 👍 or "me too" etc.

Thanks and sorry for the inconvenience.

@MikeMcQuaid MikeMcQuaid added the bug Reproducible Homebrew/brew bug label Sep 17, 2016
@flokru
Copy link

flokru commented Sep 17, 2016

I am getting

$ brew update
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: Couldn't find remote ref refs/heads/master
Error: Fetching /usr/local/Library/Taps/flokru/homebrew-self failed!

Don't know if this is relevant for this issue. I was recently updating brew which went fine, afterwards I got the git error message above while running brew upgrade on packages. The latter failed as it told me the package was not properly linked (brew doctor noticed the same). After linking, the upgrade worked. Now brew update is stuck as noticed above.

@zmwangx
Copy link
Contributor

zmwangx commented Sep 17, 2016

@flokru It's not related because we haven't even started the migration (#963) yet.

Re linking problem:

$ brew unlink $(brew ls)
$ brew link $(brew ls)

As for the update problem, could you

$ brew untap flokru/self
$ brew tap flokru/self

and see if that helps?

@flokru
Copy link

flokru commented Sep 17, 2016

Thanks, that helps. Actually my tap at https://github.com/flokru/homebrew-self is empty. I don't know when and why it got in there (nor what I was trying to accomplish while foolishly adding it in the past). Not tapping it after untapping helps. Sorry for the noise.

@Cynlic
Copy link

Cynlic commented Sep 17, 2016

Edit: It's fixed with cd /usr/local; git fetch; git reset --hard origin/master set of commands, even though it didn't work the first time I tried it. Shrug

Hello, I'm not really a super literate brew user so I'm not sure how to address this but I think this is a similar error. It seems that brew link/brew unlink and brew doctor also produce the same error.

$ brew update 
Error: No such file or directory - (../../../Cellar/autoconf/2.69, /usr/local/var/homebrew/linked/autoconf)

@MikeMcQuaid
Copy link
Member Author

@Cynlic Run brew update twice and that should fix it.

@MikeMcQuaid MikeMcQuaid added this to the 1.0.0 milestone Sep 17, 2016
@justinclift
Copy link

Posting this (new) error message here, for general awareness:

$ brew install ansible
==> Auto-updated Homebrew!
Updated Homebrew from 5654100 to f4a8d28.
Updated 1 tap (homebrew/core).
==> Updated Formulae
ponyc

==> Migrating HOMEBREW_REPOSITORY (please wait)...
share/man/man1/brew-cask.1: needs merge
share/man/man1/brew-cask.1: needs merge
share/man/man1/brew-cask.1: unmerged (483feec5ebfefa746c6f36d40a69965c56807986)
share/man/man1/brew-cask.1: unmerged (dd2bc133c7dccf4a7a1e7fc9960c61e3c60ae570)
fatal: git-write-tree: error building trees
Cannot save the current index state
Error: Failure while executing: git -c user.email=brew-update@localhost -c user.name=brew\ update stash save --include-untracked
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your (new) error in issue:
  https://github.com/Homebrew/brew/issues/987
/usr/local/Library/Homebrew/utils.rb:367:in `safe_system'
/usr/local/Library/Homebrew/cmd/update-report.rb:211:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `block in cd'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `chdir'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `cd'
/usr/local/Library/Homebrew/cmd/update-report.rb:210:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'
==> Installing dependencies for ansible: libyaml
==> Installing ansible dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.6_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.1.6_1.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libyaml/0.1.6_1: 8 files, 312.9K
==> Installing ansible
==> Downloading https://homebrew.bintray.com/bottles/ansible-2.1.1.0.el_capitan.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring ansible-2.1.1.0.el_capitan.bottle.1.tar.gz
🍺  /usr/local/Cellar/ansible/2.1.1.0: 9,928 files, 99.3M

The list of installed Homebrew packages at the time of the error isn't large:

$ brew list
ansible     cmake       libyaml     openssl     sqlcipher   xz

Things still seem to be working. eg brew list works, as did both brew remove and brew doctor (without warnings) afterwards.

The error message itself though is kind of concerning. 😉

@rodrigues
Copy link

Getting this problem also on the build of PR Homebrew/homebrew-core#4945, sierra passed, elcapitan and yosemite failed with same problem:

[el_capitan] $ /bin/sh -xe /var/folders/03/jqjv4qms2b18_hwt2dcgsghc0000gp/T/hudson8974165171645172947.sh
+ env
+ grep JENKINS
+ grep -iv cookie
JENKINS_HOME=/Users/brew/Jenkins
JENKINS_URL=https://bot.brew.sh/
+ GIT_WORK_TREE=/usr/local
+ GIT_DIR=/usr/local/.git
+ git reset --hard origin/master
HEAD is now at 59b7f16 Merge pull request #989 from MikeMcQuaid/rubocop-final
+ brew update
Updated Homebrew from 59b7f16 to e204679.
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: No such file or directory - (../Homebrew/bin/brew, /usr/local/bin/brew)
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your (new) error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:347:in `ln_s'
/usr/local/Library/Homebrew/cmd/update-report.rb:260:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'
Build step 'Execute shell' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Archiving artifacts
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in  7 second
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
Finished: FAILURE

@MikeMcQuaid
Copy link
Member Author

@rodrigues You can ignore that, it's been addressed, thanks.

@MikeMcQuaid
Copy link
Member Author

@justinclift You need to resolve the Git conflicts/merges in your repository.

@justinclift
Copy link

justinclift commented Sep 18, 2016

@MikeMcQuaid You mean nuke my local branches?

@justinclift
Copy link

@MikeMcQuaid I'm trying to figure out what the conflicts/merges are about.

  • There were several branches in git. Thankfully, they were mostly just old stuff, so nuked them.
  • There were two git stashes left over from previous fighting with Homebrew. Nuked those too.

It's still complaining with the same error message. Any idea how to figure out what the problems it's complaining about are?

@MikeMcQuaid
Copy link
Member Author

@justinclift Actually, I may have a fix. Coming right up...

@justinclift
Copy link

Cool. 😄

@MikeMcQuaid
Copy link
Member Author

@justinclift Try to brew pull https://github.com/Homebrew/brew/pull/1020 and then brew update and it should sort you out. If not: post again in that PR, thanks!

@justinclift
Copy link

Thanks @MikeMcQuaid, that worked. 😄

@krsmes
Copy link

krsmes commented Sep 19, 2016

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: unknown file type: /usr/local/Caskroom/suspicious-package/latest/.fseventsd/00000000001a4b41
Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Please comment with your new error in issue or +1 an existing error:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1375:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1485:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1488:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1487:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:235:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:103:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@viktorbenei
Copy link

viktorbenei commented Sep 19, 2016

$ brew install awscli

==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

@MatzFan
Copy link
Contributor

MatzFan commented Sep 19, 2016

I just got the following (error on last line) after being migrated while trying to upgrade a formula:

$ brew upgrade postgresql
==> Auto-updated Homebrew!
Updated Homebrew from 8e9a9b6 to 13f08a2.
Updated 3 taps (homebrew/core, homebrew/science, homebrew/versions).
==> Updated Formulae
git-town                        homebrew/versions/gcc6          languagetool                    mg3a                            pkg-config ✔                    proof-general                 

==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory -- /usr/local/Library/Homebrew/brew.rb (LoadError)

Is this just because the formula upgrade is trying to find brew.rb in the old location this one time, or some other harmless reason? Same command works fine now. brew doctor is fine and git status inside /usr/local/Homebrew says:

On branch master
nothing to commit, working tree clean

Thanks

Edit: Same as @viktorbenei it seems.

@zmwangx
Copy link
Contributor

zmwangx commented Sep 19, 2016

Is this just because the formula upgrade is trying to find brew.rb in the old location this one time.

Probably, rough edge I guess.

Do you have any problem afterwards?

EDIT: I missed the "Same command works fine now." part, sorry.

@viktorbenei
Copy link

TL;DR; for my and @MatzFan 's issue: brew install X fails if install performs the update, but brew update && brew install X works, as there brew update handles the migration correctly, and then install can proceed

@viktorbenei
Copy link

This is mainly an issue in CI environment btw

@zmwangx
Copy link
Contributor

zmwangx commented Sep 19, 2016

I believe this is an issue of install/upgrade calling udpate first (without HOMEBREW_NO_AUTO_UPDATE, that is).

@viktorbenei
Copy link

correct @zmwangx

@MatzFan
Copy link
Contributor

MatzFan commented Sep 19, 2016

No issues @zmwangx . As per @viktorbenei's comment, seems any arg passed during brew install or brew upgrade is ignored if migration is triggered.

@zmwangx
Copy link
Contributor

zmwangx commented Sep 19, 2016

@MatzFan Yeah, just as you said it was trying to find brew.rb in the old location (brew install without HOMEBREW_NO_AUTO_UPDATE runs update logic first which is in brew's bash layer, it then relays to the ruby layer for install which fails to find the file). This should only happen once and you shouldn't need to worry about it. We'll probably come up with a solution or warning for future folks though, thanks for the report.

@MikeMcQuaid
Copy link
Member Author

Working on a fix to the auto-update issue.

@luiscobot
Copy link

luiscobot commented Sep 23, 2016

@MikeMcQuaid but and my packages? i lose?

@jawshooah
Copy link
Contributor

@unluisco Your packages are in /usr/local/Cellar, not /usr/local/Homebrew.

@antruongnguyen
Copy link

This is my error:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Permission denied - /usr/local/lib/pkgconfig
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
/usr/local/Library/Homebrew/cmd/update-report.rb:259:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:258:in `each'
/usr/local/Library/Homebrew/cmd/update-report.rb:258:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

Later on when I type brew update it shows -bash: /usr/local/bin/brew: No such file or directory

Please help!

@MikeMcQuaid
Copy link
Member Author

@antruongnguyen sudo chown -R $USER /usr/local; ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew; brew update --force should sort you out.

@hmijail
Copy link

hmijail commented Sep 26, 2016

Another error, and fix:

$ brew update
/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19: /usr/local/var/homebrew/locks/update: Permission denied
-e:1:in `initialize': Bad file descriptor (Errno::EBADF)
    from -e:1:in `new'
    from -e:1:in `<main>'
Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.

Fix:

$ sudo chown -R $(whoami) /usr/local/var/homebrew/

@hmijail
Copy link

hmijail commented Sep 26, 2016

And yet another:

Error: Permission denied - /usr/local/Caskroom/qlstephenMost likely, this means you have an outdated version of Homebrew-Cask. Please run:

    brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup

Fix:

sudo chown -R $(whoami) /usr/local/Caskroom

@MikeMcQuaid
Copy link
Member Author

@hmijail If you know how to fix these issues you don't need to post them here.

@hmijail
Copy link

hmijail commented Sep 26, 2016

Sorry, was looking for the fixes here and then I realized the easy fix seemed to work OK. So I wrote them in case it helped someone else, or could get documented.

@driskell
Copy link

When running brew update - it did it's usual thing and then:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Failure while executing: git checkout --force .
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/usr/local/Library/Homebrew/utils.rb:360:in `safe_system'
/usr/local/Library/Homebrew/cmd/update-report.rb:225:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `block in cd'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `chdir'
/usr/local/Library/Homebrew/extend/pathname.rb:328:in `cd'
/usr/local/Library/Homebrew/cmd/update-report.rb:224:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

I removed the lock file and ran brew update and then it said:

sed: .git/GITHUB_HEADERS: No such file or directory
Already up-to-date.

Now when I run again it just says Already up-to-date - and I'm left with a /usr/local/Homebrew containing nothing but a .git folder. Not sure how I migrate this manually as I really like the idea of tidying up /usr/local!

@driskell
Copy link

I needed to run brew update --force to get it to run the migration again. Now all fine.

@malopezcruz
Copy link

➜  ~ brew update --force
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.
➜  ~ rm -rf /usr/local/Homebrew
➜  ~ ls /usr/local/Homebrew
ls: /usr/local/Homebrew: No such file or directory
➜  ~ sudo chown -R $USER /usr/local
Password:
➜  ~ brew update --force
Updated 1 tap (homebrew/core).
No changes to formulae.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Permission denied - /usr/local/Library/Taps/homebrew/homebrew-versions/.git/objects/83/38d89c06dad15c3c008541527b2e289e7ced66.incompleteMigration
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1374:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1374:in `open'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1374:in `copy_file'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1342:in `copy'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:463:in `block in copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1479:in `call'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1479:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1482:in `block in wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1481:in `wrap_traverse'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:460:in `copy_entry'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:435:in `block in cp_r'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1552:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1568:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1550:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:434:in `cp_r'
/usr/local/Library/Homebrew/cmd/update-report.rb:234:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:105:in `update_report'
/usr/local/Library/Homebrew/brew.rb:99:in `<main>'

@MikeMcQuaid
Copy link
Member Author

@malopezcruz brew untap homebrew/versions; brew tap homebrew/versions; brew update --force; brew update --force

@spullara
Copy link

spullara commented Oct 3, 2016

samair11:~ sam$ brew update
Updated 4 taps (caskroom/cask, caskroom/versions, homebrew/core, homebrew/services).
==> New Formulae
amqp-cpp
==> Updated Formulae
castxml glide terminal-notifier
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: /usr/local/Homebrew already exists.
Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.
samair11:~ sam$

@MikeMcQuaid
Copy link
Member Author

Please remove it manually or uninstall and reinstall Homebrew into a new
location as the migration cannot be done automatically.

@spullara Do that or ask a more specific question if you're unsure, thanks.

@machale
Copy link

machale commented Oct 9, 2016

I'm an infrequent brew user. For whatever reason today I ran a brew doctor which told me to do a brew update. I did so, with this result:

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  File exists - (../Homebrew/bin/brew, /usr/local/bin/brew)
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `symlink'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:349:in `block in ln_s'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:347:in `ln_s'
/usr/local/Library/Homebrew/cmd/update-report.rb:266:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:107:in `update_report'
/usr/local/Library/Homebrew/brew.rb:94:in `<main>'

Now any brew command I try yields this message:

$ brew
/usr/local/bin/brew: line 47: /usr/local/Library/Homebrew/brew.sh: No such file or directory

I decided to try re-installing, but that didn't help:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
From https://github.com/Homebrew/brew
 x [deleted]         (none)     -> origin/master
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Failed during: git reset --hard origin/master

Any ideas on how to proceed would be helpful. Thanks.

@MikeMcQuaid
Copy link
Member Author

@machale Run https://github.com/homebrew/install#uninstall-homebrew and try to install again. Sorry for the inconvenience.

@yeahdongcn
Copy link

yeahdongcn commented Oct 11, 2016

Installing homebrew to a new machine with /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

==> Downloading and installing Homebrew...
remote: Counting objects: 3397, done.
remote: Compressing objects: 100% (2406/2406), done.
remote: Total 3397 (delta 1557), reused 2171 (delta 855), pack-reused 0
Receiving objects: 100% (3397/3397), 2.17 MiB | 618.00 KiB/s, done.
Resolving deltas: 100% (1557/1557), done.
From https://github.com/Homebrew/brew
 * [new branch]      master     -> origin/master
 * [new tag]         0.1        -> 0.1
 * [new tag]         0.2        -> 0.2
 * [new tag]         0.3        -> 0.3
 * [new tag]         0.4        -> 0.4
 * [new tag]         0.5        -> 0.5
 * [new tag]         0.6        -> 0.6
 * [new tag]         0.7        -> 0.7
 * [new tag]         0.7.1      -> 0.7.1
 * [new tag]         0.8        -> 0.8
 * [new tag]         0.8.1      -> 0.8.1
 * [new tag]         0.9        -> 0.9
 * [new tag]         0.9.1      -> 0.9.1
 * [new tag]         0.9.2      -> 0.9.2
 * [new tag]         0.9.3      -> 0.9.3
 * [new tag]         0.9.4      -> 0.9.4
 * [new tag]         0.9.5      -> 0.9.5
 * [new tag]         0.9.8      -> 0.9.8
 * [new tag]         0.9.9      -> 0.9.9
 * [new tag]         1.0.0      -> 1.0.0
 * [new tag]         1.0.1      -> 1.0.1
 * [new tag]         1.0.2      -> 1.0.2
 * [new tag]         1.0.3      -> 1.0.3
 * [new tag]         1.0.4      -> 1.0.4
 * [new tag]         1.0.5      -> 1.0.5
 * [new tag]         1.0.6      -> 1.0.6
 * [new tag]         1.0.7      -> 1.0.7
 x [deleted]         (none)     -> origin/master
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Failed during: git reset --hard origin/master

and tried to uninstall and install it again as @MikeMcQuaid said, but got no success, any idea?

@MikeMcQuaid
Copy link
Member Author

@yeahdongcn Apologies, this was a regression that's now fixed in Homebrew/install#74. Please try again.

@machale
Copy link

machale commented Oct 11, 2016

@MikeMcQuaid Thanks, uninstalling cleaned things up. The uninstall process deleted everything under /usr/local/Cellar/ but luckily I saved a list of what I had in there before uninstalling, so I know what to go and reinstall. After a fresh install of brew 1.0.7, I was able to do a quick brew install ascii and it worked fine. brew doctor seems happy.

The uninstall process does not appear to have touched the one Cask I had and brew cask doctor also seems happy.

Thank you so much for your contribution to this amazing facility!

@MikeMcQuaid
Copy link
Member Author

Glad to be of help.

@ofWay
Copy link

ofWay commented Oct 17, 2016

After I run brew update, I get an error
==> Migrating HOMEBREW_REPOSITORY (please wait)... Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew! The error was: Permission denied - /usr/local/lib/pkgconfig Please try to resolve this error yourself and then runbrew updateagain to complete the migration. If you need help please +1 an existing error or comment with your new error in issue: https://github.com/Homebrew/brew/issues/987

Then I run brew doctor, I get
-bash: /usr/local/bin/brew: No such file or directory

It seems that after the brew update fails, the system cannot locate homegrew

@MikeMcQuaid
Copy link
Member Author

@ofWay I'd recommend running the Homebrew installer again.

@Zpunky
Copy link

Zpunky commented Oct 22, 2016

I'm planning on following the advice above and just re-installing. But thought this info may be helpful.
I had an update fail, apparently usr/local/lib was a file instead of dir. After I resolved that I ran brew update again, and got:
-bash: /usr/local/bin/brew: No such file or directory

FWIW this is the output of the original update attempt.

==> Migrating Homebrew to v0.9.9
remote: Counting objects: 932, done.
remote: Compressing objects: 100% (828/828), done.
remote: Total 932 (delta 234), reused 410 (delta 82), pack-reused 0
Receiving objects: 100% (932/932), 849.12 KiB | 729.00 KiB/s, done.
Resolving deltas: 100% (234/234), completed with 153 local objects.
From https://github.com/Homebrew/brew
 + 5a9e19f...8019afb master     -> origin/master  (forced update)
HEAD is now at 8019afb Merge pull request #1346 from MikeMcQuaid/more-rubocop-tweaks
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3741, done.
remote: Compressing objects: 100% (3631/3631), done.
remote: Total 3741 (delta 12), reused 299 (delta 1), pack-reused 0
Receiving objects: 100% (3741/3741), 2.99 MiB | 1.49 MiB/s, done.
Resolving deltas: 100% (12/12), done.
Checking connectivity... done.
Tapped 3620 formulae (3,768 files, 9.3M)
Already up-to-date.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  File exists - /usr/local/lib
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
/usr/local/Library/Homebrew/cmd/update-report.rb:260:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:259:in `each'
/usr/local/Library/Homebrew/cmd/update-report.rb:259:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:107:in `update_report'
/usr/local/Library/Homebrew/brew.rb:94:in `<main>' 

@nuhuxi
Copy link

nuhuxi commented Oct 25, 2016

Hey Mike - appreciate any direction you can provide.

I am running sierra and uninstalled an old version of home brew beccause I was having some probs. Try to re-install it and get the following:

Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.
Failed during: /usr/local/bin/brew update --force

I saw a similar error in another post but wasnt able to grok how to make it work.

Many thanks

@ilovezfs
Copy link
Contributor

@nuhuxi are there files in /usr/local/var/homebrew/locks? If so, removing them will make that message go away. You may want to make sure it's not telling the truth by rebooting first or checking ps aux | grep brew for any brew process(es) other than the grep itself and killing them.

@nuhuxi
Copy link

nuhuxi commented Oct 25, 2016

@ilovezfs Thanks for the post. grep'd brew and saw nothing. Also no files in /usr/local/var/homebrew/locks. Tried to install again - no go. Here is the entire message:

==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at 79e8cdd Merge pull request #1253 from jawshooah/perf/relocate-text-files
/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19: /usr/local/var/homebrew/locks/update: Permission denied
-e:1:in initialize': Bad file descriptor (Errno::EBADF) from -e:1:innew'
from -e:1:in `

'
Error: Another active Homebrew process is already in progress.
Please wait for it to finish or terminate it to continue.
Failed during: /usr/local/bin/brew update --force

@nuhuxi
Copy link

nuhuxi commented Oct 25, 2016

@ilovezfs It installed. It may have been absolute brute force but it worked. I went into /usr/local/var and rm's homebrew. Installed no problem.

Thanks for your help - truly appreciated.

@alexmgr
Copy link

alexmgr commented Feb 1, 2017

Hi,

I didn't read through the full thread, but a simple search did not find anything relating to the error I encountered:

Removing: /Library/Caches/Homebrew/xz-5.2.2.el_capitan.bottle.tar.gz... (450.2K)
==> Migrating /Library/Caches/Homebrew to /Users/amoneger/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
==> Migrating HOMEBREW_REPOSITORY (please wait)...
error: 'share/doc/homebrew/Acceptable-Formulae.md' is beyond a symbolic link
fatal: Unable to process path share/doc/homebrew/Acceptable-Formulae.md
Cannot save the current worktree state
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
  Failure while executing: git -c user.email=brew-update@localhost -c user.name=brew\ update stash save --include-untracked
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
  https://github.com/Homebrew/brew/issues/987

Basically homebrew was a symlink to ../../docs:

amoneger@silvertip local/Homebrew (master !*%) » ls -l ../share/doc  | grep -i homebrew
lrwxr-x---  1 amoneger  admin   10 Jan 31 20:24 homebrew -> ../../docs

I just moved all stuff under ../../docs under a temp dir, deleted the symlink and created a directory instead:

amoneger@silvertip local/Homebrew (master !*%) » mkdir /tmp/brew_docs
amoneger@silvertip local/Homebrew (master !*%) » mv ../share/doc/homebrew/* /tmp/brew_docs
amoneger@silvertip local/Homebrew (master !*%) » rm -rf ../share/doc/homebrew/
amoneger@silvertip local/Homebrew (master !*%) » mkdir ../share/doc/homebrew/
amoneger@silvertip local/Homebrew (master !*%) » mv /tmp/abcd/brew_docs ../share/doc/homebrew/
amoneger@silvertip local/Homebrew (master !*%) » git -c user.email=brew-update@localhost -c user.name=brew\ update stash save --include-untracked
Saved working directory and index state WIP on master: 5a9e19f Fix documentation links (#50695)
HEAD is now at 5a9e19f Fix documentation links (#50695)

Hope it helps someone.

@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug
Projects
None yet
Development

No branches or pull requests