1

I'm running this script in AWS Opsworks. It worked before, but now it fails with the error message below the script. The script creates the linux-2 server instance and then immediately runs the script. Some suggest setting pgpcheck=0, but I don't exactly know where to add this. I don't know if that's the solution either.

template '/etc/sysconfig/clock' do
  source "timezone.erb"
  owner 'root'
  group 'root'
end

link '/etc/localtime' do
  to '/usr/share/zoneinfo/Australia/Sydney'
end

# execute 'enable epel' do
  # command 'yum-config-manager --enable epel'
  # sensitive true
# end

# package "barman" do
    # action :install
# end

packages = %w{tmux wget curl htop deltarpm vim-enhanced perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64}

for p in packages do
    package p do
      action :install
    end
end

remote_file "/root/postgres.rpm" do
    source "https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm"
    action :create_if_missing
end

remote_file "/tmp/wal-g.tar.gz" do
    source "https://github.com/wal-g/wal-g/releases/download/v0.2.14/wal-g.linux-amd64.tar.gz"
    action :create_if_missing
end

execute 'extract wal-g' do
  command 'tar xzvf /tmp/wal-g.tar.gz'
  cwd '/usr/local/sbin'
  creates '/usr/local/sbin/wal-g'
end

rpm_package "pgdg-redhat12" do
    source "/root/postgres.rpm"
    action :install
    options " --nodeps "
end

ruby_block "fix repo release path" do
  block do
    fe = Chef::Util::FileEdit.new("/etc/yum.repos.d/pgdg-redhat-all.repo")
    fe.search_file_replace(/rhel-\$releasever-\$basearch/,
                               "rhel-7.5-x86_64")
    fe.write_file
  end
end

package "postgresql12-server" do
    action :install
end

package "postgresql12-contrib" do
    action :install
end

The rest of the script is removed for brevity.

================================================================================
Error executing action `install` on resource 'yum_package[postgresql12-server]'
================================================================================
 
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/package/yum/yum-dump.py --options --all-provides --yum-lock-timeout 30 ----
STDOUT: [option installonlypkgs] kernel kernel-bigmem installonlypkg(kernel) installonlypkg(kernel-module) installonlypkg(vm) kernel-enterprise kernel-smp kernel-debug kernel-unsupported kernel-source kernel-devel kernel-PAE kernel-PAE-debug
STDERR: yum-dump Repository Error: failure: repodata/repomd.xml from pgdg-common: [Errno 256] No more mirrors to try.
https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-7.5-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for pgdg-common
---- End output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/package/yum/yum-dump.py --options --all-provides --yum-lock-timeout 30 ----
Ran /usr/bin/python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/package/yum/yum-dump.py --options --all-provides --yum-lock-timeout 30 returned 1
 
Resource Declaration:
---------------------
# In /var/chef/runs/4af4db66-94d5-43ff-89ca-1002521b8d4a/local-mode-cache/cache/cookbooks/pw_hosting/recipes/db_setup_al.rb
 
59: package "postgresql12-server" do
60:     action :install
61: end
62: 
 
Compiled Resource:
------------------
# Declared in /var/chef/runs/4af4db66-94d5-43ff-89ca-1002521b8d4a/local-mode-cache/cache/cookbooks/pw_hosting/recipes/db_setup_al.rb:59:in `from_file'
 
yum_package("postgresql12-server") do
package_name "postgresql12-server"
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :package
cookbook_name "pw_hosting"
recipe_name "db_setup_al"
flush_cache {:before=>false, :after=>false}
end
 
Platform:
---------
x86_64-linux
 
[2021-08-21T15:38:39+10:00] INFO: Running queued delayed notifications before re-raising exception
[2021-08-21T15:38:39+10:00] ERROR: Running exception handlers
[2021-08-21T15:38:39+10:00] ERROR: Exception handlers complete
[2021-08-21T15:38:39+10:00] FATAL: Stacktrace dumped to /var/chef/runs/4af4db66-94d5-43ff-89ca-1002521b8d4a/local-mode-cache/cache/chef-stacktrace.out
[2021-08-21T15:38:39+10:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2021-08-21T15:38:39+10:00] ERROR: yum_package[postgresql12-server] (pw_hosting::db_setup_al line 59) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/package/yum/yum-dump.py --options --all-provides --yum-lock-timeout 30 ----
STDOUT: [option installonlypkgs] kernel kernel-bigmem installonlypkg(kernel) installonlypkg(kernel-module) installonlypkg(vm) kernel-enterprise kernel-smp kernel-debug kernel-unsupported kernel-source kernel-devel kernel-PAE kernel-PAE-debug
STDERR: yum-dump Repository Error: failure: repodata/repomd.xml from pgdg-common: [Errno 256] No more mirrors to try.
https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-7.5-x86_64/repodata/repomd.xml: [Errno -1] repomd.xml signature could not be verified for pgdg-common
---- End output of /usr/bin/python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/package/yum/yum-dump.py --options --all-provides --yum-lock-timeout 30 ----
Ran /usr/bin/python /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.18.31/lib/chef/provider/package/yum/yum-dump.py --options --all-provides --yum-lock-timeout 30 returned 1
[2021-08-21T15:38:39+10:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Feedback
siwix
  • 91
  • 1
  • 7
  • This could be a temporary issue, going by the many threads that talk about it. You could try setting `gpgcheck=0` in `/etc/yum.repos.d/pgdg-redhat-all.repo`. The error talks about the `[pgdg-common]` section in that file. – seshadri_c Aug 21 '21 at 08:07
  • This lead to a solution. In the script I wrote some code to replace any gpgcheck to 0 and also repo_gpgcheck to 0 and the script worked. Could you please post an answer and I will accept it. Thank you. – siwix Aug 21 '21 at 12:30
  • Good to know that this lead to a solution! – seshadri_c Aug 21 '21 at 15:12

1 Answers1

0

Going by the results of search for this issue, it could be temporary. However for the time being you could change disable the GPG check for the repository in /etc/yum.repos.d/pgdg-redhat-all.repo.

The error indicates GPG verification issue for [pgdg-common] repo, but this could be for other repos in the pgdg-redhat-all.repo file. This is usually enabled with gpgcheck=1.

Changing this to gpgcheck=0 for all occurrences using something like Chef::Util::FileEdit should work in the meantime.

seshadri_c
  • 6,906
  • 2
  • 10
  • 24