tfutils / tfenv

Terraform version manager
MIT License
4.48k stars 454 forks source link

tfenv use failed with Version directory for XXX is present, but the terraform binary is not executable! Manual intervention required. #308

Closed hayorov closed 2 years ago

hayorov commented 2 years ago

tfenv use latest:^0.14 Version directory for 0.14.11 is present, but the terraform binary is not executable! Manual intervention is required.

File is executable bash-5.1# file /opt/tfenv/versions/0.14.11/terraform

bash-5.1# tfenv use latest:^0.14

bash-5.1# cat /etc/issue

hayorov commented 2 years ago

It's actually weird

bash-5.1# test -x /opt/tfenv/versions/0.14.11/terraform 
bash-5.1# echo $?
1

bash-5.1# /opt/tfenv/versions/0.14.11/terraform
Usage: terraform [global options] <subcommand> [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
  init          Prepare your working directory for other commands
  validate      Check whether the configuration is valid
  plan          Show changes required by the current configuration
  apply         Create or update infrastructure
  destroy       Destroy previously-created infrastructure

All other commands:
  console       Try Terraform expressions at an interactive command prompt
  fmt           Reformat your configuration in the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote Terraform modules
  graph         Generate a Graphviz graph of the steps in an operation
  import        Associate existing infrastructure with a Terraform resource
  login         Obtain and save credentials for a remote host
  logout        Remove locally-stored credentials for a remote host
  output        Show output values from your root module
  providers     Show the providers required for this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  untaint       Remove the 'tainted' state from a resource instance
  version       Show the current Terraform version
  workspace     Workspace management

Global options (use these before the subcommand, if any):
  -chdir=DIR    Switch to a different working directory before executing the
                given subcommand.
  -help         Show this help output, or the help for a specified subcommand.
  -version      An alias for the "version" subcommand.
allenhumphreys commented 2 years ago

@hayorov I think you've run into this issue introduced in Alpine Linux 3.14. https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2

hayorov commented 2 years ago

@allenhumphreys U are right, that was just the first thing ... that I discovered.

Close issues.

joshmyers commented 2 years ago

What was the workaround chosen for this @hayorov ?

allenhumphreys commented 2 years ago

@joshmyers if you look at the alpine 3.14 release notes there are instructions for updating your container runtime settings to fix the issue.

Downgrading to alpine 3.13 temporarily was my fix while we push host OS and docker updates.

adrianolw commented 2 years ago

Just to help a little, in my case it was the zip package that was not installed on my ubuntu wsl system.

root@BLABLA ~/.tfenv (master)$ tfenv install 1.1.6 Installing Terraform v1.1.6 Downloading release tarball from https://releases.hashicorp.com/terraform/1.1.6/terraform_1.1.6_linux_amd64.zip ##################################################################################################################### 100.0% Downloading SHA hash file from https://releases.hashicorp.com/terraform/1.1.6/terraform_1.1.6_SHA256SUMS No keybase install found, skipping OpenPGP signature verification /root/.tfenv/libexec/tfenv-install: line 270: unzip: command not found Tarball unzip failed

after installing the zip and re-run the command, everything worked fine!

ndlanier commented 2 years ago

I'm seeing this issue on a debian based image. I can't exactly change it while it's up because this is being done on a jenkins task agent and it is hit or miss if it happens.

+ tfenv install 1.1.2
Installing Terraform v1.1.2
Downloading release tarball from https://releases.hashicorp.com/terraform/1.1.2/terraform_1.1.2_linux_amd64.zip
#=#=#                                                                         
#####                                                                      7.9%
########################################                                  55.7%
######################################################################## 100.0%
Downloading SHA hash file from https://releases.hashicorp.com/terraform/1.1.2/terraform_1.1.2_SHA256SUMS
Not instructed to use Local PGP (/home/jenkins/.tfenv/use-{gpgv,gnupg}) & No keybase install found, skipping OpenPGP signature verification
Archive:  /tmp/tfenv_download.0YriGo/terraform_1.1.2_linux_amd64.zip
  inflating: /home/jenkins/.tfenv/versions/1.1.2/terraform  
Installation of terraform v1.1.2 successful. To make this your default version, run 'tfenv use 1.1.2'
+ tfenv use 1.1.2
Version directory for 1.1.2 is present, but the terraform binary is not executable! Manual intervention required.
script returned exit code 1