Permission denied during installation

I have a ubuntu machine and I am trying to deploy the application using the instructions at Install flyctl · Fly Docs and I am getting the following error.

Warning: Failed to open the file /home/ajitgoel/.fly/bin/flyctl.tar.gz:       
Warning: Permission denied
0.0%curl: (23) Failure writing output to destination

I see no files have been written to /home/ajitgoel/.fly/bin/. Is there a way to manually install the fly.io cli?

Update 1: downloaded file https://github.com/superfly/flyctl/releases/download/v0.0.475/flyctl_0.0.475_Linux_x86_64.tar.gz, unzipped it and tried to run it and I am getting the following error.

WARN failed loading cache file from /root/.fly/state.yml: open /tmp/flyctl.cache.lock: permission denied Error open /tmp/flyctl.config.lock: permission denied. Why does this have to be so hard?

Hey - how’re you unzipping and running exactly?

I unzipped the tar.gz file and then ran the sudo <FileNameWithFilePath> command

That doesn’t match the instructions I see on that page. Using sudo will mean that the files are owned by root, and this will prevent you from updating them.

I would suggest running sudo bash and from there delete the .fly directory and /tmp/fly*.

Once you exit that subshell, try the instructions from Install flyctl · Fly Docs :

curl -L https://fly.io/install.sh | sh

I followed your instructions and I see the same issue as before.

Quite odd. Here is what I get:

I suspect that you still have some files owned by root? I included the last command to show what you should be seeing.

Thank you for helping me debug this issue(I am a newbie linux/ubuntu guy)

I ran the commands as yours and I see that the results match with yours. Any other pointers?

I’ve used Ubuntu for around 20 years. Not sure what to suggest. Just as a wild guess, look at the ownership of your home directory and umask:

Still the same issue (Perhaps the file system is corrupted or something), Thank you so much for all your help.

Let’s add some trace.

Run:

wget https://fly.io/install.sh
chmod +x install.sh

Now edit install.sh, look for set -o (it should be on line 5). Immediately after that, add set -x. Now run the script:

./install.sh

Here’s the output.

ajitgoel@ajitgoel-Latitude-E6420:~$ ./install.sh
+ uname -s
+ os=Linux
+ uname -m
+ arch=x86_64
+ version=latest
+ curl -s https://api.fly.io/app/flyctl_releases/Linux/x86_64/latest
+ flyctl_uri=https://github.com/superfly/flyctl/releases/download/v0.0.475/flyctl_0.0.475_Linux_x86_64.tar.gz
+ [ ! https://github.com/superfly/flyctl/releases/download/v0.0.475/flyctl_0.0.475_Linux_x86_64.tar.gz ]
+ flyctl_install=/home/ajitgoel/.fly
+ bin_dir=/home/ajitgoel/.fly/bin
+ exe=/home/ajitgoel/.fly/bin/flyctl
+ simexe=/home/ajitgoel/.fly/bin/fly
+ [ ! -d /home/ajitgoel/.fly/bin ]
+ curl -q --fail --location --progress-bar --output /home/ajitgoel/.fly/bin/flyctl.tar.gz https://github.com/superfly/flyctl/releases/download/v0.0.475/flyctl_0.0.475_Linux_x86_64.tar.gz
Warning: Failed to open the file /home/ajitgoel/.fly/bin/flyctl.tar.gz:        
Warning: Permission denied
                                                                            0.0%curl: (23) Failure writing output to destination

let’s check to see if the directory is set up:

$ ls -ld .fly .fly/bin
drwxrwxr-x 3 rubys rubys 4096 Mar  4 20:10 .fly
drwxrwxr-x 2 rubys rubys 4096 Mar  4 20:10 .fly/bin

Assuming there is no problem there, let’s try downloading the tar file directly into your home directory:

curl -q --fail --location --progress-bar --output flyctl.tar.gz https://github.com/superfly/flyctl/releases/download/v0.0.475/flyctl_0.0.475_Linux_x86_64.tar.gz

done

weird. But you should now have a tar file. Let’s unpack and run the executable:

rubys@rubixlab:~$ tar xzf flyctl.tar.gz 
rubys@rubixlab:~$ ./flyctl 
This is flyctl, the Fly.io command line interface.

It doesn't look like you're logged in. Try "flyctl auth signup" to create an account,
or "flyctl auth login" to log in to an existing account.

Here's a few commands to get you started:
  fly launch      Launch a new application
  fly apps        Create and manage apps
  fly postgres    Create and manage Postgres databases
  fly redis       Create and manage Redis databases
  fly machines    Create and manage individual Fly.io machines

If you need help along the way:
  fly help            Display a complete list of commands
  fly help <command>  Display help for a specific command, e.g. 'fly help launch'

Visit https://fly.io/docs for additional documentation & guides

it works, Thank you so much for walking me through this, if you are ever in the Everett, Washington area, ping me and we can go to lunch(on me).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.