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

Warn if brew is symlinked #786

Closed
2 tasks done
osalbahr opened this issue Jul 2, 2023 · 7 comments
Closed
2 tasks done

Warn if brew is symlinked #786

osalbahr opened this issue Jul 2, 2023 · 7 comments
Labels

Comments

@osalbahr
Copy link
Sponsor Contributor

osalbahr commented Jul 2, 2023

  • your problem was from running the official install or uninstall script?
  • after installation: ran brew config and brew doctor and included their output with your issue? If you couldn't install: provided your OS version with the output of your issue?
[dracula@fedora ~]$ brew config
HOMEBREW_VERSION: 4.0.26
ORIGIN: https://github.com/Homebrew/brew
HEAD: eff45ef570f265e226f14ce91da72d7a6e7d516a
Last commit: 5 days ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 1c6424f22ccd8cd46c4d46279ebc8ff4dba222c9
Core tap last commit: 56 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /var/home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /var/home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /var/home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: :0
HOMEBREW_EDITOR: /usr/bin/nano
HOMEBREW_MAKE_JOBS: 4
HOMEBREW_NO_INSTALL_FROM_API: set
Homebrew Ruby: 2.6.10 => /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: quad-core 64-bit skylake
Clang: N/A
Git: 2.41.0 => /bin/git
Curl: 8.0.1 => /bin/curl
Kernel: Linux 6.3.8-200.fc38.x86_64 x86_64 GNU/Linux
OS: Fedora release 38 (Thirty Eight)
Host glibc: 2.37
/usr/bin/gcc: 13.1.1
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A
[dracula@fedora ~]$ 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: Your Homebrew's prefix is not /home/linuxbrew/.linuxbrew.

Many of Homebrew's bottles (binary packages) can only be used with the default prefix.
Consider uninstalling Homebrew and reinstalling into the default prefix.
It is expected behaviour that some formulae will fail to build in this unsupported configuration.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

What you were trying to do (and why)

Install Homebrew on uBlue (based on Fedora Silverblue 38). Homebrew is a perfect tool to install userspace programs while on an immutable operating system (without needing to use container solutions like distrobox or toolbx).

What happened (include command output)

The installation went fine. But brew fails upon usage. When I ran brew install gcc, the first failure was installing xz (as in Homebrew/discussions#1282).

[dracula@fedora ~]$ brew install xz
==> Fetching xz
Warning: Building xz from source as the bottle needs:
- HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar (yours is /var/home/linuxbrew/.linuxbrew/Cellar)
- HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew (yours is /var/home/linuxbrew/.linuxbrew)
==> Downloading https://downloads.sourceforge.net/project/lzmautils/xz-5.4.3.tar
==> Downloading from https://versaweb.dl.sourceforge.net/project/lzmautils/xz-5.
######################################################################### 100.0%
==> ./configure --prefix=/var/home/linuxbrew/.linuxbrew/Cellar/xz/5.4.3
Last 15 lines from /var/home/dracula/.cache/Homebrew/Logs/xz/01.configure:

Initializing Automake:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether ln -s works... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/xz-20230702-53189-1cjhm40/xz-5.4.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

READ THIS: https://docs.brew.sh/Troubleshooting

Context:

[dracula@fedora ~]$ ls -l /home
lrwxrwxrwx. 3 root root 8 Jun 29 22:29 /home -> var/home
[dracula@fedora ~]$ realpath /home/linuxbrew/.linuxbrew/bin/brew
/var/home/linuxbrew/.linuxbrew/Homebrew/bin/brew

What you expected to happen

I initially expected Homebrew to work even if /home is a symlink. But since it doesn't, I think a warning during installation would be good.

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

  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Add eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" to ~/.bashrc and open a new Terminal (or run /home/linuxbrew/.linuxbrew/bin/brew shellenv)
  3. brew install xz
@osalbahr
Copy link
Sponsor Contributor Author

osalbahr commented Jul 2, 2023

I was able to reproduce a similar environment in the homebrew/brew container image as follows:

$ podman run -it homebrew/brew
// In the container
$ export NONINTERACTIVE=1
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
$ sudo mv /home /var
$ (cd / && sudo ln -s var/home home) # or "sudo ln -s var/home /home"
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
// No warning when reinstalling
// It works fine as far as I can tell, but it builds lots of stuff from source (as expected)

System info:

$ brew config
HOMEBREW_VERSION: 4.0.26
ORIGIN: https://github.com/Homebrew/brew
HEAD: eff45ef570f265e226f14ce91da72d7a6e7d516a
Last commit: 5 days ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 1c6424f22ccd8cd46c4d46279ebc8ff4dba222c9
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /var/home/linuxbrew/.linuxbrew
HOMEBREW_REPOSITORY: /var/home/linuxbrew/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /var/home/linuxbrew/.linuxbrew/Cellar
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 4
HOMEBREW_NO_INSTALL_FROM_API: set
Homebrew Ruby: 2.6.10 => /var/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: quad-core 64-bit skylake
Clang: N/A
Git: 2.41.0 => /bin/git
Curl: 7.81.0 => /bin/curl
Kernel: Linux 6.3.8-200.fc38.x86_64 x86_64 GNU/Linux
OS: Unknown
Host glibc: 2.35
/usr/bin/gcc: 11.3.0
/usr/bin/ruby: N/A
glibc: N/A
gcc@11: N/A
gcc: N/A
xorg: N/A

@MikeMcQuaid
Copy link
Member

Do not create any issues about this on Homebrew's GitHub repositories.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2023
@osalbahr
Copy link
Sponsor Contributor Author

osalbahr commented Jul 3, 2023

Do not create any issues about this on Homebrew's GitHub repositories.

Sorry, but I thought this was about issues when it comes to brew install <something> not the install.sh. The prefix is in the expected location, it’s just that /home is a symlink. But the installer doesn’t report any issues.

@MikeMcQuaid
Copy link
Member

Sorry

No worries and: thanks!

The prefix is in the expected location, it’s just that /home is a symlink.

We don't support that configuration, sorry.

But the installer doesn’t report any issues.

This is an edge-case we've not seen before. The installer warns/halts for some issues but not all.

@osalbahr
Copy link
Sponsor Contributor Author

osalbahr commented Jul 4, 2023

This is an edge-case we've not seen before. The installer warns/halts for some issues but not all.

Fair enough. I wanted to note the issue of a symlinked /home was mentioned a couple years ago in Homebrew/discussions#1282 and Homebrew/brew#14557. Fedora’s immutable distros like Silverblue and Kinoite (and images based on them) are getting more and more popular nowadays.

Try to figure out the problem yourself and submit a fix as a pull request.

That’s what I’m doing now, trying to see how to make Homebrew work even if /home is a symlink.

We will review it but may or may not accept it.

What’s the chance for such a PR gets accepted? Or should users apply the "patch" on their end only? I’m still messing around and trying to figure out how brew install works so not sure how elegant the fix will be, but it should be a proof-of-concept at least.

@MikeMcQuaid
Copy link
Member

Try to figure out the problem yourself and submit a fix as a pull request.

That’s what I’m doing now, trying to see how to make Homebrew work even if /home is a symlink.

Thanks, I'll review it when you do 👍🏻

What’s the chance for such a PR gets accepted?

Depends on how involved/reliable/understandable the fix ends up being. If you end up having to modify >100 lines of code, for instance: it's probably got complex enough it wouldn't get merged. If it's a one line fix: it seems very unlikely it won't be accepted in some form. Does that help?

I’m still messing around and trying to figure out how brew install works so not sure how elegant the fix will be, but it should be a proof-of-concept at least.

Yeh, feel free to open a draft PR with a POC and e.g. failing tests and we can validate it before you put too much effort in.

Thanks again!

@osalbahr
Copy link
Sponsor Contributor Author

osalbahr commented Jul 5, 2023

Does that help?

Absolutely! Thank you for clarifying.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants