"gpg: can't create '/etc/apt/keyrings/vcf-archive-keyring.gpg': Permission denied" error when trying to setup VCF CLI using Package Managers
search cancel

"gpg: can't create '/etc/apt/keyrings/vcf-archive-keyring.gpg': Permission denied" error when trying to setup VCF CLI using Package Managers

book

Article ID: 417823

calendar_today

Updated On:

Products

VMware Cloud Foundation

Issue/Introduction

  • The instructions under the document Installing VCF CLI Using Package Managers are used to setup VCF CLI using Package Managers.

  • The command "curl -fsSL https://packages.broadcom.com/artifactory/vcfcli-debian/tools/keys/BROADCOM-PACKAGING-GPG-RSA-KEY.pub; curl -fsSL https://packages.broadcom.com/artifactory/api/security/keypair/PackagesKey/public | gpg --dearmor -o /etc/apt/keyrings/vcf-archive-keyring.gpg" gives the following error.

    gpg: can't create '/etc/apt/keyrings/vcf-archive-keyring.gpg': Permission denied
    gpg: no valid OpenPGP data found.
    gpg: dearmoring failed: Permission denied

  • This happens on a Debian or Ubuntu Virtual Machine.

Environment

VMware Cloud Foundation 9.0

Cause

The current user account does not have the necessary privileges to write files to the /etc/apt/keyrings/ directory. This directory is a system location that requires root privilege for writing.

Resolution

Use "sudo tee" to complete the file writing. Use the below command.

curl -fsSL https://packages.broadcom.com/artifactory/vcfcli-debian/tools/keys/BROADCOM-PACKAGING-GPG-RSA-KEY.pub; curl -fsSL https://packages.broadcom.com/artifactory/api/security/keypair/PackagesKey/public | gpg --dearmor | sudo tee /etc/apt/keyrings/vcf-archive-keyring.gpg >/dev/null

Reason: The 'tee' command is responsible for reading the data and writing it to the system directory. 

Additional Information

Installing and Using VCF CLI v9.0