aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Installing in relative path installs broken symlinks

Open raymzag opened this issue 3 years ago • 4 comments

Describe the bug

Followed the linux installation steps with -i and -b option, but symlinks seem broken. I am unable to run aws after install. It is failing with "No such file or directory"

https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

It seems similar issue has been reported in this thread here too. https://www.reddit.com/r/Ubuntu/comments/hdrfly/aws_cli_command_not_working_when_installed_local/fvn1umn/

Expected Behavior

can run aws command.

Current Behavior

$ ./aws/install -i ./aws-cli -b ./aws-cli/bin --update
You can now run: ./aws-cli/bin/aws --version
$ ls -lad ./aws-cli/bin/aws
lrwxrwxrwx 1 root root 28 Apr  6 05:04 ./aws-cli/bin/aws -> ./aws-cli/v2/current/bin/aws
$ ls -lad ./aws-cli/v2/current
lrwxrwxrwx 1 root root 18 Apr  6 05:04 ./aws-cli/v2/current -> ./aws-cli/v2/2.5.2
$ ./aws-cli/bin/aws --version
/usr/bin/bash: line 140: ./aws-cli/bin/aws: No such file or directory

Reproduction Steps

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install -i ./aws-cli -b ./aws-cli/bin --update

Possible Solution

./aws-cli/v2/2.5.2/bin/aws this seems working when calling directly.

Additional Information/Context

No response

CLI version used

V2

Environment details (OS name and version, etc.)

ubuntu:20.04

raymzag avatar Apr 06 '22 05:04 raymzag

Hi @raymzag, Thank you for submitting the issue. It was reproducible using the steps above.

We will take a look at this and prioritize a fix.

aaoswal avatar Apr 07 '22 00:04 aaoswal

Hi @raymzag, This also seems to be a bug with respect to v1 and v2 both. Again, thank you for bringing this to our attention.

Also, a workaround this would be to use the following set of commands instead until a fix is shipped:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aaoswal avatar Apr 07 '22 17:04 aaoswal

To add some more context here, the issue is specifically the usage of relative pathing. If you use the absolute paths for -i and -b, we'd expect the functionality to work.

The fix for the current issue will be to automatically expand the paths at runtime for the install script so they're properly stored in the aws bin file.

nateprewitt avatar Apr 07 '22 19:04 nateprewitt

Thank you for looking into it!

raymzag avatar Apr 07 '22 23:04 raymzag