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

[Question] Cannot change ownership to uid 397546, gid 5000: Invalid argument #587

Open
2 tasks done
RodrigoDornelles opened this issue Dec 19, 2023 · 4 comments
Open
2 tasks done
Labels
question Further information is requested

Comments

@RodrigoDornelles
Copy link

I don't know if it's a problem with flutter or fvm, but using only flutter had no problems.

Before creating a bug report please make check the following

  • You have read our FAQ
  • Run fvm doctor if possible and add the output to the issue.
FVM Version: 2.4.1
___________________________________________________

FVM config found:
___________________________________________________

Project: app
Directory: /app
Version: 3.13.9
Project Flavor: None selected
___________________________________________________

Version is currently cached locally.

Cache Path: /root/fvm/versions/3.13.9
Channel: false
SDK Version: 3.13.9

IDE Links
VSCode: .fvm/flutter_sdk
Android Studio: /app/.fvm/flutter_sdk


Configured env paths:
___________________________________________________

Flutter:


Dart:


FVM_HOME:
not set

Describe the bug
I can install flutter but not use it normally

To Reproduce
fvm install 3.13.9
fvm use 3.13.9
fvm pub get

Expected behavior
Normal use

Logs

root@9b15a017dc87:/app# fvm flutter pub get
Downloading Gradle Wrapper...                                      411ms
/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: Exiting with failure status due to previous errors
Downloading Gradle Wrapper...                                       87ms
/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument
/bin/tar: Exiting with failure status due to previous errors
Flutter could not download and/or extract https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz. Ensure you have network connectivity and all of the required dependencies listed at flutter.dev/setup.
The original exception was: ProcessException: The command failed
  Command: tar -xzf /tmp/flutter-fvm/versions/3.13.9/bin/cache/downloads/storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz -C /tmp/flutter-fvm/versions/3.13.9/bin/cache/artifacts/gradle_wrapper.

Desktop (please complete the following information):

  • OS: Linux
  • FVM Version 2.4.1

Additional context
running in docker as root

@RodrigoDornelles RodrigoDornelles added the bug Something isn't working label Dec 19, 2023
RodrigoDornelles added a commit to RodrigoDornelles/docker-images that referenced this issue Dec 19, 2023
RodrigoDornelles added a commit to RodrigoDornelles/docker-images that referenced this issue Dec 19, 2023
* chore: improve docker-entrypoint.sh in sdkman

* chore: add TMPDIR_PATH in the sdkman

* fix: some corrections flutter/flutter#140330 leoafarias/fvm#587

* feat: add fvm/fei to manage flutter version

* ci: ignore when edit README.md in sdkman

* docs: create an individual README.md to sdkman
@vbrandl
Copy link

vbrandl commented Jun 19, 2024

I have the same problem using podman and running as non-root (inside the container/build process, I am root, but I run docker build as non-root user). When building my dockerfile, I get the described permission errors. Running the build as root works, but I'd prefer building using a non-root user...

Were you able to fix this?

@leoafarias leoafarias added question Further information is requested and removed bug Something isn't working labels Jun 19, 2024
@leoafarias leoafarias changed the title [BUG] Cannot change ownership to uid 397546, gid 5000: Invalid argument [Question] Cannot change ownership to uid 397546, gid 5000: Invalid argument Jun 19, 2024
@mcmah309
Copy link

I have the same issue as well. Running as root does not fix it for me.

@RodrigoDornelles
Copy link
Author

@vbrandl @mcmah309 I have an opensource docker image that works around this problem.

https://github.com/RodrigoDornelles/docker-images/blob/db6f47bde097cf55a0ad87bf5de4bac715ea2147/sdkman/docker-entrypoint.sh#L13

how to use:

podman run --rm -v /tmp:/tmp -v $(pwd):/app -w /app rodrigodornelles/sdkman:latest
sdk install java 17.0.9-oracle
fei 3.13.9
flutter pub get
flutter build apk

@mcmah309
Copy link

mcmah309 commented Jun 25, 2024

You're the man! 🙌

I pulled your solution out into a script that works on my container instance

#!/bin/bash
# `./fvm_tar_workaround.sh on`  # To install the custom tar
# `./fvm_tar_workaround.sh off` # To remove the custom tar
set -euo pipefail

install_custom_tar() {
  # Create the custom tar script with the flag as default
  echo -e "#!/bin/bash\nset -e\n/bin/tar \"\$@\" --no-same-owner" > /tmp/tar
  chmod +x /tmp/tar
  if [ ! -d /usr/local/bin ]; then
    mkdir -p /usr/local/bin
  fi
  mv /tmp/tar /usr/local/bin/tar
  if ! echo "$PATH" | grep -q "/usr/local/bin"; then
    echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
    source ~/.bashrc
  fi
  if which tar | grep -q "/usr/local/bin/tar"; then
    echo "Custom tar command installed successfully."
  else
    echo "Failed to install the custom tar command."
  fi
}

uninstall_custom_tar() {
  if [ -f /usr/local/bin/tar ]; then
    rm /usr/local/bin/tar
    echo "Custom tar command removed successfully."
  else
    echo "Custom tar command is not installed."
  fi
}

if [ "$1" == "on" ]; then
  install_custom_tar
elif [ "$1" == "off" ]; then
  uninstall_custom_tar
else
  echo "Usage: $0 {on|off}"
  exit 1
fi

I'm not familiar with the fvm implementation, so not sure what needs to get done on that side to fix this bug

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

No branches or pull requests

4 participants