Bug: error while building from source
Is this urgent?
Yes
What parts are affected
Frontend
What is the server version
latest
What is the client version
latest
What platform are you using
Linux
What's the problem 🤔
the RUN flutter doctor -v command throws an error
Share your logs
=> ERROR [builder 10/18] RUN flutter doctor -v 1.4s
------
> [builder 10/18] RUN flutter doctor -v:
0.228 Woah! You appear to be trying to run flutter as root.
0.228 We strongly recommend running the flutter tool without superuser privileges.
0.228 /
0.228 📎
0.487 Downloading Material fonts... 368ms
0.932 Downloading Gradle Wrapper... 12ms
0.953 /usr/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.953 /usr/bin/tar: Exiting with failure status due to previous errors
0.954 Downloading Gradle Wrapper... 9ms
0.970 /usr/bin/tar: gradle/wrapper/gradle-wrapper.properties: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: gradle/wrapper/gradle-wrapper.jar: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: gradle/wrapper: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: gradle: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: gradlew: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: gradlew.bat: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: NOTICE: Cannot change ownership to uid 397546, gid 5000: Invalid argument
0.970 /usr/bin/tar: Exiting with failure status due to previous errors
1.243 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 https://flutter.dev/setup.
1.243 The original exception was: ProcessException: The command failed with exit code 2
1.243 Command: tar -xzf /usr/local/src/flutter/bin/cache/downloads/storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz -C /usr/local/src/flutter/bin/cache/artifacts/gradle_wrapper.
1.243
1.243 #0 throwToolExit (package:flutter_tools/src/base/common.dart:34:3)
1.243 #1 ArtifactUpdater._downloadArchive (package:flutter_tools/src/cache.dart:1203:11)
1.243 <asynchronous suspension>
1.243 #2 GradleWrapper.updateInner (package:flutter_tools/src/flutter_cache.dart:498:5)
1.243 <asynchronous suspension>
1.243 #3 CachedArtifact.update (package:flutter_tools/src/cache.dart:894:5)
1.243 <asynchronous suspension>
1.243 #4 Cache.updateAll (package:flutter_tools/src/cache.dart:765:9)
1.243 <asynchronous suspension>
1.243 #5 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1862:7)
1.243 <asynchronous suspension>
1.243 #6 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1558:27)
1.243 <asynchronous suspension>
1.243 #7 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
1.243 <asynchronous suspension>
1.243 #8 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
1.243 <asynchronous suspension>
1.243 #9 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:496:9)
1.243 <asynchronous suspension>
1.243 #10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
1.243 <asynchronous suspension>
1.243 #11 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:431:5)
1.243 <asynchronous suspension>
1.243 #12 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:98:11)
1.243 <asynchronous suspension>
1.243 #13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
1.243 <asynchronous suspension>
1.243 #14 main (package:flutter_tools/executable.dart:99:3)
1.243 <asynchronous suspension>
1.243
1.243
------
Dockerfile:36
--------------------
34 |
35 | # Run flutter doctor
36 | >>> RUN flutter doctor -v
37 |
38 | # Copy the app files to the container
--------------------
ERROR: failed to solve: process "/bin/sh -c flutter doctor -v" did not complete successfully: exit code: 1
Share your configuration
Can you make sure that https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz is reachable? It looks like it cannot be reached, judging by the logs.
Can you make sure that https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa/gradle-wrapper.tgz is reachable? It looks like it cannot be reached, judging by the logs.
It is reachable.
I tried building it in an LXC container and found that the problem was not with the download, but with the extraction. I searched for a similar error and found that it was a tar permission issue and setting this environment variable might fix the problem: TAR_OPTIONS=--no-same-owner. Tested in an LXC container, it works.
Adding the following line to the Dockerfile fixed the problem: ENV TAR_OPTIONS --no-same-owner