Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.
When including the dnsmasq default recipe, the dns setting on my vagrant box are broken by the DNSSTUBLISTENER option. This prevents the dnsmasq package from being installed.
apt_update 'update' do
action :update
end
include_recipe 'dnsmasq::default'
the /etc/systemd/resolved.conf.d/dnsmasq.conf is updated with DNSStubListener=no which break any DNS queries and prevents the next step from installing the dnsmasq package.
Recipe: dnsmasq::default
* directory[/etc/systemd/resolved.conf.d] action create
- create new directory /etc/systemd/resolved.conf.d
* file[Fix systemd-resolved conflict] action create
- create new file /etc/systemd/resolved.conf.d/dnsmasq.conf
- update content in file /etc/systemd/resolved.conf.d/dnsmasq.conf from none to 4f33e1
--- /etc/systemd/resolved.conf.d/dnsmasq.conf 2022-10-26 08:01:38.049011854 +0000
+++ /etc/systemd/resolved.conf.d/.chef-dnsmasq20221026-12866-fsbqaf.conf 2022-10-26 08:01:38.049011854 +0000
@@ -1,2 +1,4 @@
+[Resolve]
+DNSStubListener=no
* service[systemd-resolved] action restart
- restart service service[systemd-resolved]
* service[systemd-resolved] action nothing (skipped due to action :nothing)
* apt_package[dnsmasq] action install
================================================================================
Error executing action `install` on resource 'apt_package[dnsmasq]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '100'
---- Begin output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "dnsmasq=2.80-1.1ubuntu1.5"] ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
dns-root-data dnsmasq-base libidn11
Suggested packages:
resolvconf
The following NEW packages will be installed:
dns-root-data dnsmasq dnsmasq-base libidn11
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 383 kB of archives.
After this operation, 1,155 kB of additional disk space will be used.
Err:1 http://in.archive.ubuntu.com/ubuntu focal/main amd64 dns-root-data all 2019052802
Temporary failure resolving 'in.archive.ubuntu.com'
Err:2 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libidn11 amd64 1.33-2.2ubuntu2
Temporary failure resolving 'in.archive.ubuntu.com'
Ign:3 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.5
Ign:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 dnsmasq all 2.80-1.1ubuntu1.5
Err:3 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.5
Temporary failure resolving 'in.archive.ubuntu.com'
Err:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 dnsmasq all 2.80-1.1ubuntu1.5
Temporary failure resolving 'in.archive.ubuntu.com'
STDERR: E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/d/dns-root-data/dns-root-data_2019052802_all.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.33-2.2ubuntu2_amd64.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/d/dnsmasq/dnsmasq-base_2.80-1.1ubuntu1.5_amd64.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/universe/d/dnsmasq/dnsmasq_2.80-1.1ubuntu1.5_all.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---- End output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "dnsmasq=2.80-1.1ubuntu1.5"] ----
Ran ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "dnsmasq=2.80-1.1ubuntu1.5"] returned 100
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/dnsmasq/recipes/default.rb
15: package 'dnsmasq'
16: user 'dnsmasq'
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/dnsmasq/recipes/default.rb:15:in `from_file'
apt_package("dnsmasq") do
package_name "dnsmasq"
action [:install]
default_guard_interpreter :default
declared_type :package
cookbook_name "dnsmasq"
recipe_name "default"
end
System Info:
------------
chef_version=17.10.3
platform=ubuntu
platform_version=20.04
ruby=ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
program_name=/opt/chef/bin/chef-client
executable=/opt/chef/bin/chef-client
Running handlers:
[2022-10-26T08:01:42+00:00] ERROR: Running exception handlers
Running handlers complete
[2022-10-26T08:01:42+00:00] ERROR: Exception handlers complete
Infra Phase failed. 3 resources updated in 08 seconds
[2022-10-26T08:01:42+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2022-10-26T08:01:42+00:00] FATAL: ---------------------------------------------------------------------------------------
[2022-10-26T08:01:42+00:00] FATAL: PLEASE PROVIDE THE CONTENTS OF THE stacktrace.out FILE (above) IF YOU FILE A BUG REPORT
[2022-10-26T08:01:42+00:00] FATAL: ---------------------------------------------------------------------------------------
[2022-10-26T08:01:42+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: apt_package[dnsmasq] (dnsmasq::default line 15) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "dnsmasq=2.80-1.1ubuntu1.5"] ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
dns-root-data dnsmasq-base libidn11
Suggested packages:
resolvconf
The following NEW packages will be installed:
dns-root-data dnsmasq dnsmasq-base libidn11
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 383 kB of archives.
After this operation, 1,155 kB of additional disk space will be used.
Err:1 http://in.archive.ubuntu.com/ubuntu focal/main amd64 dns-root-data all 2019052802
Temporary failure resolving 'in.archive.ubuntu.com'
Err:2 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libidn11 amd64 1.33-2.2ubuntu2
Temporary failure resolving 'in.archive.ubuntu.com'
Ign:3 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.5
Ign:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 dnsmasq all 2.80-1.1ubuntu1.5
Err:3 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.5
Temporary failure resolving 'in.archive.ubuntu.com'
Err:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 dnsmasq all 2.80-1.1ubuntu1.5
Temporary failure resolving 'in.archive.ubuntu.com'
STDERR: E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/d/dns-root-data/dns-root-data_2019052802_all.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.33-2.2ubuntu2_amd64.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/d/dnsmasq/dnsmasq-base_2.80-1.1ubuntu1.5_amd64.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/universe/d/dnsmasq/dnsmasq_2.80-1.1ubuntu1.5_all.deb Temporary failure resolving 'in.archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---- End output of ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "dnsmasq=2.80-1.1ubuntu1.5"] ----
Ran ["apt-get", "-q", "-y", "--allow-downgrades", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "dnsmasq=2.80-1.1ubuntu1.5"] returned 100
The default recipe to install dnsmasq without breaking dns resolution until further configurations are applied.