Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.28k stars 9.7k forks source link

Brew link step fail if installing multiple formulae with common symlink using a system with symlinked /home #18036

Open asen23 opened 2 months ago

asen23 commented 2 months ago

brew doctor output

// not sure how to fix this and i already followed the suggestion
βœ–  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: Homebrew's share was not found in your XDG_DATA_DIRS but you have
this variable set to include other locations.
Some programs like `vapigen` may not work correctly.
Consider adding Homebrew's share directory to XDG_DATA_DIRS like so:
  echo 'export XDG_DATA_DIRS="/home/linuxbrew/.linuxbrew/share:$XDG_DATA_DIRS"' >> /home/asen23/.bash_profile

Verification

brew config output

βœ–  brew config 
HOMEBREW_VERSION: 4.3.15
ORIGIN: https://github.com/Homebrew/brew
HEAD: fa53e7b1e51a2deb7ec5a1e12452a1182dc342f7
Last commit: 27 hours ago
Core tap JSON: 13 Aug 09:14 UTC
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: /usr/bin/nano
HOMEBREW_MAKE_JOBS: 16
SUDO_ASKPASS: /usr/bin/ksshaskpass
Homebrew Ruby: 3.3.4 => /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: 16-core 64-bit zen3
Clang: N/A
Git: 2.46.0 => /bin/git
Curl: 8.6.0 => /bin/curl
Kernel: Linux 6.9.12-203.fsync.fc40.x86_64 x86_64 GNU/Linux
OS: Bazzite 40 (FROM Fedora Kinoite) (Holographic)
Host glibc: 2.39
/usr/bin/gcc: 14.2.1
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A

What were you trying to do (and why)?

Installing docker-compose and docker-buildx in my machine.

What happened (include all command output)?

the first one to be installed will be installed correctly but the second one to be installed will fail the brew link step logs

βœ–  brew install docker-buildx
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/docker-buildx/manifests/0.16.2
Already downloaded: /home/asen23/.cache/Homebrew/downloads/acad9b50d061a2956e6bfa8c399eabeb2e71ad476103907eb6703affa723e5cf--docker-buildx-0.16.2.bottle_manifest.json
==> Fetching docker-buildx
==> Downloading https://ghcr.io/v2/homebrew/core/docker-buildx/blobs/sha256:fa77
Already downloaded: /home/asen23/.cache/Homebrew/downloads/b7c6a054e57fa99dd8b08fff7ab7e608f583aa4176e789e943aef99414bcbbb9--docker-buildx--0.16.2.x86_64_linux.bottle.tar.gz
==> Pouring docker-buildx--0.16.2.x86_64_linux.bottle.tar.gz
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################### 100.0%
==> Caveats
docker-buildx is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json:
  "cliPluginsExtraDirs": [
      "/home/linuxbrew/.linuxbrew/lib/docker/cli-plugins"
  ]

Bash completion has been installed to:
  /home/linuxbrew/.linuxbrew/etc/bash_completion.d
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/docker-buildx/0.16.2: 29 files, 54.7MB
==> Running `brew cleanup docker-buildx`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

➜  ls /home/linuxbrew/.linuxbrew/lib/docker/cli-plugins 
Permissions Size User   Date Modified Name
lrwxrwxrwx@    - asen23 25 Jul 21:45  docker-buildx -> ../../../bin/docker-buildx

➜  brew install docker-compose                         
==> Downloading https://ghcr.io/v2/homebrew/core/docker-compose/manifests/2.29.1
Already downloaded: /home/asen23/.cache/Homebrew/downloads/84c40a756c31331a09d604d3229ee8f784a892f521b2d637cadb4c56eb93007e--docker-compose-2.29.1.bottle_manifest.json
==> Fetching docker-compose
==> Downloading https://ghcr.io/v2/homebrew/core/docker-compose/blobs/sha256:7eb
Already downloaded: /home/asen23/.cache/Homebrew/downloads/ae329d75947416f38d93e4d527cc82bff8872e065887d88174d62123e887cbed--docker-compose--2.29.1.x86_64_linux.bottle.tar.gz
==> Pouring docker-compose--2.29.1.x86_64_linux.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /home/linuxbrew/.linuxbrew
Could not symlink ../../../../../../../home/linuxbrew/.linuxbrew/Cellar/docker-buildx/0.16.2/lib/docker/cli-plugins/docker-buildx
Target /home/linuxbrew/.linuxbrew/Cellar/docker-buildx/0.16.2/lib/docker/cli-plugins/docker-buildx
is a symlink belonging to docker-buildx. You can unlink it:
  brew unlink docker-buildx

To force the link and overwrite all conflicting files:
  brew link --overwrite docker-buildx

To list all files that would be deleted:
  brew link --overwrite docker-buildx --dry-run

Possible conflicting files are:
==> Caveats
Compose is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json:
  "cliPluginsExtraDirs": [
      "/home/linuxbrew/.linuxbrew/lib/docker/cli-plugins"
  ]
==> Summary
🍺  /home/linuxbrew/.linuxbrew/Cellar/docker-compose/2.29.1: 8 files, 53.4MB
==> Running `brew cleanup docker-compose`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

βœ–  ls /home/linuxbrew/.linuxbrew/lib/docker/cli-plugins
"/home/linuxbrew/.linuxbrew/lib/docker/cli-plugins": No such file or directory (os error 2)

What did you expect to happen?

Both are installed and usable without conflict.

Step-by-step reproduction instructions (by running brew commands)

have a system with symlinked home (e.g https://fedoraproject.org/atomic-desktops/ or https://universal-blue.org/), i'm currently using bazzite from universal blue.
then run
brew install docker-buildx
brew install docker-compose
MikeMcQuaid commented 2 months ago

@asen23 Thanks for the issue!

@Homebrew/maintainers given we have a few known issues with symlinked homes that no maintainers seem to be running into or personally working on fixing: I'm increasing tempted to say we should have a brew doctor warning for it. Thoughts?

carlocab commented 2 months ago

Sounds ok to me. There's a relatively straightforward workaround for this particular issue: https://github.com/Homebrew/homebrew-core/issues/181016#issuecomment-2285619753

Related issues can be handled in the same way.

The issue is that a symlinked /home confuses brew into mishandling the way it resolves symlinked directories, and the workaround is for the user to resolve the conflict themselves by manually creating the directory.

asen23 commented 2 months ago

@Homebrew/maintainers given we have a few known issues with symlinked homes that no maintainers seem to be running into or personally working on fixing: I'm increasing tempted to say we should have a brew doctor warning for it. Thoughts?

I don't mind if workaround is available, also if it possible to put the message in the brew link error it could give more visibility

MikeMcQuaid commented 2 months ago

Sounds ok to me. There's a relatively straightforward workaround for this particular issue: Homebrew/homebrew-core#181016 (comment)

Yeh, the workaround here and how we're saying "PRs, not issues" communicates brew doctor to me at a minimum, if not even a warning on all installations.

cho-m commented 2 months ago

In current state of Homebrew, Fedora Silverblue and similar systems should probably fall into the "unsupported" category like ARM Linux and old macOS versions. It seems reasonable to add message to brew doctor and maybe additional info at https://docs.brew.sh/Homebrew-on-Linux

MikeMcQuaid commented 2 months ago

@cho-m Strongly agreed.