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

[Bug]: Fails to create a directory in /var/opt due to permission by default #3198

Closed
1 task done
PythonHacker24 opened this issue Jun 20, 2024 · 3 comments · Fixed by #3570
Closed
1 task done

[Bug]: Fails to create a directory in /var/opt due to permission by default #3198

PythonHacker24 opened this issue Jun 20, 2024 · 3 comments · Fixed by #3570
Labels

Comments

@PythonHacker24
Copy link
Contributor

Bug Description

When I was installing flipt CLI with the "curl" method, I had an issue of failing to create a file in the "/var/opt" where the flipt.db is stored. This is actually a very basic issue but needs to be addressed since it becomes very confusing in the first installation. I remember I had to create "flipt" directory on by own and "chmod 777" it (which Mark suggested me).

Version Info

v1.44.0

Search

  • I searched for other open and closed issues before opening this

Steps to Reproduce

Download Flipt CLI on a fresh Ubuntu Server with a non-root user

Expected Behavior

It must create the folder by its own and continue to start flipt on the machine without throwing this error.

Additional Context

OS: Ubuntu (latest)
DB: Sqllite

Let me know where this error is triggered in the golang code. I would love to work on fixing this issue.

@PythonHacker24
Copy link
Contributor Author

The problem is not with fixing it manually, but it occurs in a way that creates traction for new users on freshly installed Ubuntu systems.

func defaultDatabaseRoot() (string, error) { return "/var/opt/flipt", nil }

Since this is returning the default path, it would be better if we could change it to something that has better permissions as non-root users since it's not safe to take passwords for sudo usage from the flipt CLI.

I am very new to this kind of issue, so let me know if this is feasible or not.

@markphelps
Copy link
Collaborator

yeah i see what you are saying, but its quite hard to change the default in a backward compatible way. since if we change the default for a new version of flipt, it wont find any pre-existing databases at /var/opt/flipt/flipt.db and will then create an entirely new one on startup at whatever new location we pick

what i think we should try to do is first check if it can read/write to /var/opt/flipt, and if not then change the default URL to somewhere else, perhaps just os.UserConfigDir() which will match the non-linux hosts

@PythonHacker24
Copy link
Contributor Author

PythonHacker24 commented Jul 4, 2024

That sounds reasonable, but this needs to be resolved quickly. This is a starting hurdle in fresh servers and takes time to troubleshoot from the user's point of view. In my case, I remember you helped me out. I think I should first update the troubleshooting guide and add this before we fix this issue.

I think this page: https://docs.flipt.io/introduction would be a better place to mention the troubleshooting since this is where it all starts. Let me know what you think.

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

Successfully merging a pull request may close this issue.

2 participants