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

Doesn't work as non-root user #123

Open
parched opened this issue Jan 15, 2021 · 7 comments
Open

Doesn't work as non-root user #123

parched opened this issue Jan 15, 2021 · 7 comments

Comments

@parched
Copy link

parched commented Jan 15, 2021

I'm trying to use this in gitpod, where there is a non-root user, but it fails with

Flutter failed to open a file at "/sdks/flutter/bin/cache/lockfile". The flutter tool cannot access the file.
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.

I just added

RUN chmod -R a+w $FLUTTER_HOME

to fix it, but I'm not sure if there is a better solution.

@fkorotkov
Copy link
Contributor

Could you please provide a bit more details about gitpod and how it's configured for you?

@parched
Copy link
Author

parched commented Jan 21, 2021

Gitpod is a cloud IDE which gives you a shell in a docker instance. You can specify the Dockerfile, e.g., I'm trying this one. The user it gives you is not the root user, but gitpod.

You can try it here if you like
http://gitpod.io/#https://github.com/parched/strain-gauge/commit/cfde495f0160ca4a3e533373cd2b1b3acb78e66f

@fkorotkov
Copy link
Contributor

I think it's a question for the GitPod folks. If you can use a custom Dockerfile then you probably can try the following one:

FROM cirrusci/flutter:stable

USER gitpod
RUN chmod -R a+w $FLUTTER_HOME

🤷

@lidholm
Copy link

lidholm commented Apr 16, 2022

I have a similar issue. I am trying to use this image with dagger.io.
It works well if I run my commands as root, but I get a warning from flutter saying that I shouldn't
Running it as a different user doesn't work
I got the same error around the lockfile, if I remove it I get
Flutter failed to check for directory existence at "/root/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-31.0.0/lib/". instead

Maybe I shouldn't use this image, but wanted to let it be known at least

@8thgencore
Copy link

I have the same mistake when I launch pipeline not from root

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalReportStagingRelease'.
> Failed to install the following SDK components:
      build-tools;30.0.3 Android SDK Build-Tools 30.0.3
      tools Android SDK Tools
      emulator Android Emulator
      platforms;android-34 Android SDK Platform 34
  The SDK directory is not writable (/opt/android-sdk-linux)

@gmeligio
Copy link

If I can suggest a different image, I created a repo for Flutter images that uses non-root use by default. It was also to solve other issues like preaching Android SDK, etc. After trying many existing images like this repository and others, I couldn't find one to fit my needs. @8thgencore, give it a try if you can. It would be nice if some of the things I did could be contributed to this repo, but I wanted to try a different approach, so I created a separate repo.

@beroso
Copy link

beroso commented Aug 27, 2024

I just added

RUN chmod -R a+w $FLUTTER_HOME

to fix it, but I'm not sure if there is a better solution.

I'm using the following approach:

RUN chown -R $MY_USER:$MY_USER $FLUTTER_HOME

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

No branches or pull requests

6 participants