Skip to content

Dockerfile: set cache location#5865

Closed
jonchang wants to merge 1 commit intoHomebrew:masterfrom
jonchang:docker-cache
Closed

Dockerfile: set cache location#5865
jonchang wants to merge 1 commit intoHomebrew:masterfrom
jonchang:docker-cache

Conversation

@jonchang
Copy link
Copy Markdown
Contributor

When running docker pull linuxbrew/brew && docker run linuxbrew/brew brew test-bot it fails with:

==> brew update-test
Error: Permission denied @ dir_s_mkdir - /root/.cache

This sets XDG_CACHE_HOME to /home/linuxbrew/.cache to prevent this issue.

Copy link
Copy Markdown
Contributor

@sjackman sjackman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default user in the Docker container is root, and root should have write permission to its home directory /root/.cache. Have you changed users to for example linuxbrew?

@jonchang
Copy link
Copy Markdown
Contributor Author

jonchang commented Mar 12, 2019

The default user in the Docker container is root, and root should have write permission to its home directory /root/.cache. Have you changed users to for example linuxbrew?

There's something going on where docker run commands are getting prefixed with sudo -u #1000 running as the linuxbrew user. I'm not sure where this is happening, or if it's an issue with my local setup.

@sjackman
Copy link
Copy Markdown
Contributor

$ docker pull linuxbrew/brew
$ docker run --rm linuxbrew/brew id
uid=0(root) gid=0(root) groups=0(root)

What do you see?

@sjackman
Copy link
Copy Markdown
Contributor

The default user in linuxbrew/linuxbrew is 1000(linuxbrew).

@jonchang
Copy link
Copy Markdown
Contributor Author

I think test-bot is doing something weird. I will investigate further. This happens on both macOS machines I have access to.

$ docker run --rm linuxbrew/brew id
uid=0(root) gid=0(root) groups=0(root)

test-bot:

$ docker run --rm linuxbrew/brew brew test-bot
Updating Homebrew...
warning: unable to access '/root/.config/git/attributes': Permission denied
[snip]
==> Tapping homebrew/test-bot
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-test-bot'...
warning: unable to access '/root/.config/git/attributes': Permission denied
Tapped 1 command and 1 formula (49 files, 262KB).
Error: Permission denied @ dir_s_mkdir - /root/.cache
Error: Failure while executing; `/usr/bin/sudo -u \#1000 /home/linuxbrew/.linuxbrew/bin/brew tap homebrew/test-bot` exited with 1.

Not test-bot:

$ docker run --rm linuxbrew/brew brew tap homebrew/test-bot
Updating Homebrew...
[snip]
==> Tapping homebrew/test-bot
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-test-bot'...
Tapped 1 command and 1 formula (49 files, 262KB).

@sjackman
Copy link
Copy Markdown
Contributor

Error: Failure while executing; `/usr/bin/sudo -u \#1000 /home/linuxbrew/.linuxbrew/bin/brew tap homebrew/test-bot` exited with 1.

This error is quite weird to me. Is test-bot trying to run sudo? I don't see that in the test-bot code.

@iMichka
Copy link
Copy Markdown
Member

iMichka commented Mar 23, 2019

I am hit by this issue to on ubuntu. This was working fine previously:

==> Tapping linuxbrew/xorg
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/linuxbrew/homebrew-xorg'...
Tapped 150 formulae (185 files, 312.6KB).
/usr/bin/sudo -u #1000 /home/linuxbrew/.linuxbrew/bin/brew tap homebrew/test-bot
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/lock.sh: line 27: /home/linuxbrew/.linuxbrew/var/homebrew/locks/update: Permission denied
flock: 200: Bad file descriptor
Error: Another active Homebrew update process is already in progress.
Please wait for it to finish or terminate it to continue.
==> Tapping homebrew/test-bot
Cloning into '/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-test-bot'...
warning: unable to access '/root/.config/git/attributes': Permission denied
Tapped 1 command and 1 formula (49 files, 112.1KB).
Error: Permission denied @ dir_s_mkdir - /root/.cache
Error: Failure while executing; `/usr/bin/sudo -u \#1000 /home/linuxbrew/.linuxbrew/bin/brew tap homebrew/test-bot` exited with 1.
Homebrew/homebrew-test-bot e970dbb (Merge pull request #244 from woodruffw-forks/revert-rpath-rewriting)
ARGV: --ci-upload --bintray-org=linuxbrew --git-name=LinuxbrewTestBot --git-email=testbot@linuxbrew.sh

@iMichka
Copy link
Copy Markdown
Member

iMichka commented Mar 23, 2019

Maybe there is an issue with this line?
https://github.com/Homebrew/brew/blob/master/Library/Homebrew/brew.rb#L118

@sjackman
Copy link
Copy Markdown
Contributor

Yes! That's definitely the culprit. I hadn't found that line. Good sleuthing!

@iMichka
Copy link
Copy Markdown
Member

iMichka commented Mar 23, 2019

Should we just remove it?

@sjackman
Copy link
Copy Markdown
Contributor

sjackman commented Mar 23, 2019

Here's the commit that originally added that line: c4dcf8b

It addressed a use case of running sudo brew cask, which I don't believe is a supported method of running brew. This line is intended to sudo back to the Homebrew user before running brew tap. I suggest reverting this commit c4dcf8b.

@MikeMcQuaid
Copy link
Copy Markdown
Member

@sjackman Sounds good to me.

@iMichka iMichka mentioned this pull request Mar 23, 2019
6 tasks
iMichka added a commit to iMichka/brew that referenced this pull request Mar 24, 2019
@sjackman
Copy link
Copy Markdown
Contributor

Superseded by PR #5917

@iMichka iMichka mentioned this pull request Apr 16, 2019
6 tasks
@lock lock bot added the outdated PR was locked due to age label Apr 23, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants