0

I try to create an compute instance with gcloud util from cli and have some troubles. There is my creation command:

gcloud compute instances create bastion \
  --boot-disk-size=20GB \
  --image-family centos-8 \
  --image-project=centos-cloud \
  --machine-type=f1-micro \
  --tags bastion-server \
  --zone=europe-west1-d \
  --restart-on-failure \
  --can-ip-forward \
  --address=bastion-external \
  --private-network-ip=bastion \
  --metadata-from-file startup-script=/tmp/infra-rh8-pritunl/setupvpn.sh

setupvpn.sh installs Pritunl server with MongoDB and when I run it from installed instance - there are no problems, but when I try to send it through metadata to run as startup-script I have this issue: Error: GPG check FAILED.

There is setup.sh:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

sudo tee /etc/yum.repos.d/mongodb-org-4.2.repo << EOF

[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
EOF

sudo tee /etc/yum.repos.d/pritunl.repo << EOF
[pritunl]
name=Pritunl Repository
baseurl=https://repo.pritunl.com/stable/yum/oraclelinux/8/
gpgcheck=1
enabled=1
EOF

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 7568D9BB55FF9E5287D586017AE645C0CF8E292A
gpg --armor --export 7568D9BB55FF9E5287D586017AE645C0CF8E292A > key.tmp
sudo rpm --import key.tmp
sudo rm -f key.tmp

sudo yum -y install pritunl mongodb-org
sudo systemctl start mongod pritunl
sudo systemctl enable mongod pritunl

journalctl log:

>

May 27 16:19:44 bastion sudo[1548]:     root : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/bin/tee /etc/yum.repos.d/mongodb-org-4.2.repo
May 27 16:19:44 bastion sudo[1548]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script:
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: [mongodb-org-4.2]
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: name=MongoDB Repository
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.2/x86_64/
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: gpgcheck=1
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: enabled=1
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
May 27 16:19:44 bastion sudo[1548]: pam_unix(sudo:session): session closed for user root
May 27 16:19:44 bastion sudo[1571]:     root : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/bin/tee /etc/yum.repos.d/pritunl.repo
May 27 16:19:44 bastion sudo[1571]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: [pritunl]
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: name=Pritunl Repository
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: baseurl=https://repo.pritunl.com/stable/yum/oraclelinux/8/
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: gpgcheck=1
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: enabled=1
May 27 16:19:44 bastion sudo[1571]: pam_unix(sudo:session): session closed for user root
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: gpg: directory '/root/.gnupg' created
May 27 16:19:44 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:44 GCEMetadataScripts: startup-script: gpg: keybox '/root/.gnupg/pubring.kbx' created
May 27 16:19:45 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:45 GCEMetadataScripts: startup-script: gpg: connecting dirmngr at '/run/user/0/gnupg/S.dirmngr' failed: IPC connect call failed
May 27 16:19:45 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:45 GCEMetadataScripts: startup-script: gpg: keyserver receive failed: No dirmngr
May 27 16:19:45 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:45 GCEMetadataScripts: startup-script: gpg: WARNING: nothing exported
May 27 16:19:45 bastion sudo[1612]:     root : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/bin/rpm --import key.tmp
May 27 16:19:46 bastion sudo[1612]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 27 16:19:46 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:46 GCEMetadataScripts: startup-script: error: key.tmp: import read failed(0).
May 27 16:19:46 bastion sudo[1612]: pam_unix(sudo:session): session closed for user root
May 27 16:19:46 bastion sudo[1626]:     root : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/bin/rm -f key.tmp
May 27 16:19:46 bastion sudo[1626]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 27 16:19:46 bastion sudo[1626]: pam_unix(sudo:session): session closed for user root
May 27 16:19:46 bastion sudo[1650]:     root : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/bin/yum -y install pritunl mongodb-org
May 27 16:19:46 bastion sudo[1650]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 27 16:19:49 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:49 GCEMetadataScripts: startup-script: Extra Packages for Enterprise Linux Modular 8 -  77 kB/s | 118 kB     00:01
May 27 16:19:51 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:51 GCEMetadataScripts: startup-script: Extra Packages for Enterprise Linux 8 - x86_64  3.8 MB/s | 6.8 MB     00:01
May 27 16:19:54 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:54 GCEMetadataScripts: startup-script: MongoDB Repository                               24 kB/s | 9.1 kB     00:00
May 27 16:19:55 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:55 GCEMetadataScripts: startup-script: Pritunl Repository                               91 kB/s |  85 kB     00:00
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Dependencies resolved.
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: ================================================================================
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  Package            Arch   Version                        Repository       Size
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: ================================================================================
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Installing:
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  mongodb-org        x86_64 4.2.7-1.el8                    mongodb-org-4.2  10 k
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  pritunl            x86_64 1.29.2435.70-1.el8.oraclelinux pritunl          35 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Installing dependencies:
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  psmisc             x86_64 23.1-3.el8                     BaseOS          151 k
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  openvpn            x86_64 2.4.9-1.el8                    epel            542 k
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  pkcs11-helper      x86_64 1.22-7.el8                     epel             64 k
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  mongodb-org-mongos x86_64 4.2.7-1.el8                    mongodb-org-4.2  15 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  mongodb-org-server x86_64 4.2.7-1.el8                    mongodb-org-4.2  25 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  mongodb-org-shell  x86_64 4.2.7-1.el8                    mongodb-org-4.2  17 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  mongodb-org-tools  x86_64 4.2.7-1.el8                    mongodb-org-4.2  62 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:  pritunl-ndppd      x86_64 0.2.5-1.el8.oraclelinux        pritunl          86 k
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Transaction Summary
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: ================================================================================
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Install  10 Packages
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script:
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Total download size: 154 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Installed size: 491 M
May 27 16:19:57 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:57 GCEMetadataScripts: startup-script: Downloading Packages:
May 27 16:19:58 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:58 GCEMetadataScripts: startup-script: (1/10): pkcs11-helper-1.22-7.el8.x86_64.rpm     148 kB/s |  64 kB     00:00
May 27 16:19:58 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:58 GCEMetadataScripts: startup-script: (2/10): mongodb-org-4.2.7-1.el8.x86_64.rpm       65 kB/s |  10 kB     00:00
May 27 16:19:58 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:58 GCEMetadataScripts: startup-script: (3/10): openvpn-2.4.9-1.el8.x86_64.rpm          727 kB/s | 542 kB     00:00
May 27 16:19:59 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:59 GCEMetadataScripts: startup-script: (4/10): mongodb-org-mongos-4.2.7-1.el8.x86_64.r  40 MB/s |  15 MB     00:00
May 27 16:19:59 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:59 GCEMetadataScripts: startup-script: (5/10): psmisc-23.1-3.el8.x86_64.rpm            138 kB/s | 151 kB     00:01
May 27 16:19:59 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:59 GCEMetadataScripts: startup-script: (6/10): mongodb-org-shell-4.2.7-1.el8.x86_64.rp  41 MB/s |  17 MB     00:00
May 27 16:19:59 bastion GCEMetadataScripts[1255]: 2020/05/27 16:19:59 GCEMetadataScripts: startup-script: (7/10): mongodb-org-server-4.2.7-1.el8.x86_64.r  37 MB/s |  25 MB     00:00
May 27 16:20:00 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:00 GCEMetadataScripts: startup-script: (8/10): pritunl-ndppd-0.2.5-1.el8.oraclelinux.x 130 kB/s |  86 kB     00:00
May 27 16:20:00 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:00 GCEMetadataScripts: startup-script: (9/10): mongodb-org-tools-4.2.7-1.el8.x86_64.rp  52 MB/s |  62 MB     00:01
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: (10/10): pritunl-1.29.2435.70-1.el8.oraclelinux 8.5 MB/s |  35 MB     00:04
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: --------------------------------------------------------------------------------
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: Total                                            26 MB/s | 154 MB     00:05
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: warning: /var/cache/dnf/epel-6519ee669354a484/packages/openvpn-2.4.9-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: Extra Packages for Enterprise Linux 8 - x86_64  1.1 MB/s | 1.6 kB     00:00
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: Importing GPG key 0x2F86D6A1:
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script:  Userid     : "Fedora EPEL (8) <epel@fedoraproject.org>"
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script:  Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script:  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: Key imported successfully
May 27 16:20:03 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:03 GCEMetadataScripts: startup-script: warning: /var/cache/dnf/mongodb-org-4.2-fddc3ec541fac48b/packages/mongodb-org-4.2.7-1.el8.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 058f8b6b: NOKEY
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: MongoDB Repository                              4.3 kB/s | 1.7 kB     00:00
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: Importing GPG key 0x058F8B6B:
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script:  Userid     : "MongoDB 4.2 Release Signing Key <packaging@mongodb.com>"
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script:  Fingerprint: E162 F504 A20C DF15 827F 718D 4B7C 549A 058F 8B6B
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script:  From       : https://www.mongodb.org/static/pgp/server-4.2.asc
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: Key imported successfully
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: warning: /var/cache/dnf/pritunl-0e8cf675bff600ae/packages/pritunl-1.29.2435.70-1.el8.oraclelinux.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID cf8e292a: NOKEY
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: Public key for pritunl-1.29.2435.70-1.el8.oraclelinux.x86_64.rpm is not installed
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: Public key for pritunl-ndppd-0.2.5-1.el8.oraclelinux.x86_64.rpm is not installed
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: The downloaded packages were saved in cache until the next successful transaction.
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: You can remove cached packages by executing 'dnf clean packages'.
May 27 16:20:04 bastion GCEMetadataScripts[1255]: 2020/05/27 16:20:04 GCEMetadataScripts: startup-script: Error: GPG check FAILED

I need your help. What I do wrong? Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.