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

bluefin-cli brew install PACKAGE error no file or directory #111

Closed
lethedata opened this issue Jul 10, 2024 · 12 comments · Fixed by #119
Closed

bluefin-cli brew install PACKAGE error no file or directory #111

lethedata opened this issue Jul 10, 2024 · 12 comments · Fixed by #119

Comments

@lethedata
Copy link
Contributor

lethedata commented Jul 10, 2024

When trying to install any package with brew via bluefin-cli on bluefin-dx I'm receiving the following error with slightly different paths:

cp: No such file or directory (os error 2)
Error: Failure while executing; `/usr/bin/env cp -pR /tmp/homebrew-unpackXXXXXXXX-XXXXX-XXXXXX/icu4c/. /home/linuxbrew/.linuxbrew/Cellar/icu4c` exited with 1. Here's the output:
cp: No such file or directory (os error 2)

Verbosing the command reveals it's the /tmp/homebrew-unpackXXXXXXXX-XXXXX-XXXXXX/ not existing which is causing tar to fail. Testing with the Fedora and Ubuntu toolboxes work fine and even have access to tools that are already installed.

The other thing I noticed is that this box doesn't see any brew applications installed by the host tho this might actually be expected.

Brew Version: Homebrew >=4.1.0 (shallow or no git repository)

@m2Giles
Copy link
Member

m2Giles commented Jul 11, 2024

Bluefin-cli uses its own brew installation and is using brew packaged by Wolfi which is slightly different in implementation from brews default installation method.

This was done prior to having homebrew on the bluefin image.

@lethedata
Copy link
Contributor Author

lethedata commented Jul 11, 2024

Looks like it might have a broken brew installation. It seems to be cp command having a "." at the end. Instead of copying folder name to folder name it's trying to copy folder contents into a folder which doesn't exist.

Upstream might have fixed this as their brew.yaml was updated 3 days ago to version 4.3.9 manually getting a new brew version installed via homebrew directly lead to the same thing. Might be something on the Wolfi side?

To figure this out I monitored /tmp with inotifyd to see the tmp files were getting created. Freezing the command I was able to verify that it was extracting properly. I then manually stepped through the process it was trying to do and realized there was that extra dot in the copy command.


Bluefin-cli uses its own brew installation and is using brew packaged by Wolfi which is slightly different in implementation from brews default installation method.

That makes since and helps explain what I was reading on the introduction page and why the other two work.

@9d4
Copy link

9d4 commented Jul 28, 2024

I found same issue. Does it still happen to you @lethedata?

@lethedata
Copy link
Contributor Author

lethedata commented Jul 28, 2024

Yeah, still broken. I tried a lot of different things but it always gets stuck on copying files. Manually doing it works which confuses me.

The /. does cause copy errors but I think its because brew is failing to create folders before copying.

@9d4
Copy link

9d4 commented Jul 28, 2024

Did you run using distrobox create?

@lethedata
Copy link
Contributor Author

lethedata commented Jul 28, 2024

Distrobox assemble via ujust scripts and systemd quadlet. Same issue on both.

I took a peak at brews code snd the /. is actually legitimate: directory.rb line 25

This means brew is supposed to create folders before moving tho the debug doesn't really show that. I think the next thing to look at is if wolfi has this problem to see if its some packaging issue.

@azmodude
Copy link

Has anyone ever gotten bluefin-cli and brew to work? I got hit by this today.

@9d4
Copy link

9d4 commented Sep 19, 2024

I just tried it again, but still not working. At least the host-installed brew accessible from container, that's enough for not duplicating brew.

@azmodude
Copy link

True, that's what I am using right now. But I'd really like only having brew in a container, since I absolutely hate it clobbering system-wide components like systemd with it's own versions. Well, I suppose I could mess with homebrew shellenv to put it's path after the system paths.

@azmodude
Copy link

I think I got to the bottom of this - the culprit seems to be the cp command shipped by uutils that is included in bluefin-cli toolbox.

With uutils installed:

azmo@apollo in ~
at 11:48:27 ⬢ [bluefin-cli] 🐧 ->>  brew install btop
/home/linuxbrew/.linuxbrew/Library/Homebrew/brew.sh: line 442: /home/linuxbrew/.linuxbrew/.git/HEAD: No such file or directory
/home/linuxbrew/.linuxbrew/Library/Homebrew/brew.sh: line 442: /home/linuxbrew/.linuxbrew/.git/HEAD: No such file or directory
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:59ef4f6ac9f87e09d0047eb68d5533e81c6171507bffb9485ec60e24164bd313
Already downloaded: /home/azmo/.cache/Homebrew/portable-ruby-3.3.4_1.x86_64_linux.bottle.tar.gz
==> Pouring portable-ruby-3.3.4_1.x86_64_linux.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/btop/manifests/1.4.0-1
Already downloaded: /home/azmo/.cache/Homebrew/downloads/98397bd625832146ebc3bde030793c17d7e077cfddd65e854d61491c3be978cf--btop-1.4.0-1.bottle_manifest.json
==> Fetching btop
==> Downloading https://ghcr.io/v2/homebrew/core/btop/blobs/sha256:3bf71bc7a9e5ceab6fda7308ea326590a21dd7690d966830483f55c8dc9db8c5
Already downloaded: /home/azmo/.cache/Homebrew/downloads/f3df5e27a4c62d3919f06a5fbea82c1eba174b08bd788cef23c867406dc99b48--btop--1.4.0.x86_64_linux.bottle.1.tar.gz
==> Pouring btop--1.4.0.x86_64_linux.bottle.1.tar.gz
cp: No such file or directory (os error 2)
Error: Failure while executing; `/usr/bin/env cp -pR /tmp/homebrew-unpack20240928-191314-64swl3/btop/. /home/linuxbrew/.linuxbrew/Cellar/btop` exited with 1. Here's the output:
cp: No such file or directory (os error 2)

Removing uutils automatically installs the GNU coreutils, then everything works just fine:

azmo@apollo in ~ 🕙 2s
at 11:48:40 [❌ERROR] ⬢ [bluefin-cli] 🐧 ~~>  sudo apk del uutils
(1/2) Purging uutils (0.0.27-r2)
(2/2) Installing coreutils (9.5-r2)
OK: 897 MiB in 155 packages

azmo@apollo in ~/
at 11:48:54 ⬢ [bluefin-cli] 🐧 ->>  brew install btop
/home/linuxbrew/.linuxbrew/Library/Homebrew/brew.sh: line 442: /home/linuxbrew/.linuxbrew/.git/HEAD: No such file or directory
==> Downloading https://ghcr.io/v2/homebrew/core/btop/manifests/1.4.0-1
Already downloaded: /home/azmo/.cache/Homebrew/downloads/98397bd625832146ebc3bde030793c17d7e077cfddd65e854d61491c3be978cf--btop-1.4.0-1.bottle_manifest.json
==> Fetching btop
==> Downloading https://ghcr.io/v2/homebrew/core/btop/blobs/sha256:3bf71bc7a9e5ceab6fda7308ea326590a21dd7690d966830483f55c8dc9db8c5
Already downloaded: /home/azmo/.cache/Homebrew/downloads/f3df5e27a4c62d3919f06a5fbea82c1eba174b08bd788cef23c867406dc99b48--btop--1.4.0.x86_64_linux.bottle.1.tar.gz
==> Pouring btop--1.4.0.x86_64_linux.bottle.1.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/btop/1.4.0: 43 files, 1.7MB
==> Running `brew cleanup btop`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

This seems to be related/is this issue upstream: uutils/coreutils#6671

If it were me, I'd drop the uutils package from the container default - replacing something as core (pun intended) as coreutils causes more headaches than what it's worth. But that's just me. The issue might get fixed in uutils soon-ish, but since this particular issue has been open since July, the particular bug has been in there for quite a while.

@9d4
Copy link

9d4 commented Sep 29, 2024

It looks nice, need to try it later.

@lethedata
Copy link
Contributor Author

Nice work figuring that out @azmodude !

Looks like the uutils package was introduced with #53 so reverting that should fix this issue.

I was able to validate this by reverting it, building the container, then editing the quadlets to the local image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants