hashicorp / hcdiag

hcdiag is a CLI utility that collects and bundles product and platform diagnostics. It supports Consul, Nomad, TFE, and Vault.
Mozilla Public License 2.0
56 stars 8 forks source link

bash: /usr/share/keyrings/hashicorp-archive-keyring.gpg: Permission denied #310

Closed MikaelHashiCorp closed 1 year ago

MikaelHashiCorp commented 1 year ago

What is the bug?
When I try to install hcdiag from the installation instructions for Example: Ubuntu, running the command:

wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main" | tee /etc/apt/sources.list.d/hashicorp.list

I get the following error:

bash: /usr/share/keyrings/hashicorp-archive-keyring.gpg: Permission denied

Full message:

ubuntu@ip-172-31-22-248:~/hcd-uat$ wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main" | tee /etc/apt/sources.list.d/hashicorp.list

bash: /usr/share/keyrings/hashicorp-archive-keyring.gpg: Permission denied
--2023-01-30 22:30:46--  https://apt.releases.hashicorp.com/gpg
Resolving apt.releases.hashicorp.com (apt.releases.hashicorp.com)... 18.160.46.62, 18.160.46.37, 18.160.46.7, ...
Connecting to apt.releases.hashicorp.com (apt.releases.hashicorp.com)|18.160.46.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3980 (3.9K) [binary/octet-stream]
Saving to: ‘STDOUT’

-                                          0%[                                                                                 ]       0  --.-KB/s    in 0s      

Cannot write to ‘-’ (Success).

What version are you using?
Trying to install hcdiag version hcdiag_0.5.0-rc1

Which HashiCorp products does this affect?
hcdiag

When does the error occur?

  1. Spin up an instance of Ubuntu 20.04.5 LTS.
  2. Log into the new instance of the OS.
  3. From the home directory, run the following command:
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main" | tee /etc/apt/sources.list.d/hashicorp.list

What is the expected behavior?
That the hashicorp repository would be added to the local package manager.

Is there a workaround?
No

How does this impact you?
I cannot install hcdiag hcdiag_0.5.0-rc1 for user acceptance testing.

Are there any deadlines?
"Tuesday, January 31st at the latest. " - Alicia Clark

Is there any additional context?
No.

groovemonkey commented 1 year ago

Hi Mikael,

unprivileged users can't modify the Ubuntu system keyring (nor the apt sources), so you'll need to run these commands as a root user.

I'll make a PR to add a note about running as root to those instructions you linked. Thanks!

MikaelHashiCorp commented 1 year ago

Confirmed that running command as root worked:

root@ip-172-31-30-8:~# wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main" | tee /etc/apt/sources.list.d/hashicorp.list

--2023-01-31 19:08:15--  https://apt.releases.hashicorp.com/gpg
Resolving apt.releases.hashicorp.com (apt.releases.hashicorp.com)... 18.160.46.62, 18.160.46.37, 18.160.46.33, ...
Connecting to apt.releases.hashicorp.com (apt.releases.hashicorp.com)|18.160.46.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3980 (3.9K) [binary/octet-stream]
Saving to: ‘STDOUT’

-                                      100%[============================================================================>]   3.89K  --.-KB/s    in 0s      

2023-01-31 19:08:15 (172 MB/s) - written to stdout [3980/3980]