Skip to content

Commit 53d1d15

Browse files
committed
guestfs: bringup: fix debian networking issue
When doing make bringup, virt-builder boots an image with network to be able to install packages for image baseline creation. In order to have network in the booted image, virt-builder assumes isc-dhcp-client is the default Debian package for this task. However, this is not the case as Debian trixie has replaced the default dhcp client isc-dhcp-client with dhcpcd. The proper way to fix this is to address the problem at libguestfs and ensure both packages can be used. This was supported already in libguestfs for Fedora/Red Hat but not for Debian. So, package support has been added to libguestfs for Debian hosts [1][2][3]. The fix is now merged in libguestfs v1.54.1. [1] https://lists.libguestfs.org/archives/list/[email protected]/ thread/ANINW4N4D2VYRD5GTAUQWDZDECAN6XFM/#ANINW4N4D2VYRD5GTAUQWDZDECAN6XF M [2] 91fab3f498b6847454656acd2f3d5788c533033b ("appliance: add dhcpcd support on Debian") [3] libguestfs/libguestfs@91fab3f498b6847454656acd 2f3d5788c533033b While we wait Debian to upgrade the package to a newer libguestfs release that includes the fix, we need to ensure isc-dhcp-client is part of the host tools. Note that we need to be explicit as isc-dhcp-client is listed as optional runtime dependency for libguestfs [4]. [4] https://packages.debian.org/trixie/libguestfs0t64 This was reported already in a previous Debian release: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775514 In order to fix this, introduce a new target under the bringup_guestfs playbook to install libguestfs and it's dependencies. Add this for Debian, Suse and Fedora/RedHat. This new target also allows to remove the dependency check at min_deps introduced by commit 0111187 ("Makefile.min_deps: ensure you have virt-builder when using guestfs"). Min deps is intended for minimal kdevops dependencies to run kdevops. And it's kdevops job with Ansible/Makefile dedicated playbooks-roles/targets to ensure libguestfs (including virt-builder) is installed in the host. To replicate the issue in Debian testing (without isc-dhcp-client installed and a libguestfs version < 1.54.1 ), run any of the following virt-builder commands: virt-builder fedora-27 --install qemu-guest-agent [ 3.2] Downloading: http://archive.libguestfs.org/builder/fedora-27.xz [ 3.7] Planning how to build this image [ 3.7] Uncompressing [ 5.3] Opening the new disk libguestfs: warning: current user is not a member of the KVM group (group ID 994). This user cannot access /dev/kvm, so libguestfs may run very slowly. It is recommended that you 'chmod 0666 /dev/kvm' or add the current user to the KVM group (you might need to log out and log in again). [ 27.3] Setting a random seed [ 27.4] Installing packages: qemu-guest-agent Error: Failed to synchronize cache for repo 'updates' virt-builder: error: dnf -y install 'qemu-guest-agent': command exited with an error If reporting bugs, run virt-builder with debugging enabled and include the complete output: virt-builder -v -x [...] sudo virt-builder debian-12 --install sudo [ 0.7] Downloading: http://builder.libguestfs.org/debian-12.xz [ 1.0] Planning how to build this image [ 1.0] Uncompressing [ 2.9] Opening the new disk [ 6.3] Setting a random seed virt-builder: warning: random seed could not be set for this type of guest [ 6.4] Installing packages: sudo Ign:1 http://security.debian.org/debian-security bookworm-security InRelease Ign:2 http://deb.debian.org/debian bookworm InRelease Ign:3 http://deb.debian.org/debian bookworm-updates InRelease Ign:1 http://security.debian.org/debian-security bookworm-security InRelease Ign:2 http://deb.debian.org/debian bookworm InRelease Ign:3 http://deb.debian.org/debian bookworm-updates InRelease Ign:2 http://deb.debian.org/debian bookworm InRelease Ign:1 http://security.debian.org/debian-security bookworm-security InRelease Ign:3 http://deb.debian.org/debian bookworm-updates InRelease Err:2 http://deb.debian.org/debian bookworm InRelease Temporary failure resolving 'deb.debian.org' Err:1 http://security.debian.org/debian-security bookworm-security InRelease Temporary failure resolving 'security.debian.org' Err:3 http://deb.debian.org/debian bookworm-updates InRelease Temporary failure resolving 'deb.debian.org' Reading package lists... W: Failed to fetch http://deb.debian.org/debian/dists/bookworm/InRelease Temporary failure resolving 'deb.debian.org' W: Failed to fetch http://security.debian.org/debian-security/dists/bookworm-security/InRel ease Temporary failure resolving 'security.debian.org' W: Failed to fetch http://deb.debian.org/debian/dists/bookworm-updates/InRelease Temporary failure resolving 'deb.debian.org' W: Some index files failed to download. They have been ignored, or old ones used instead. Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: sudo 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 1889 kB of archives. After this operation, 6199 kB of additional disk space will be used. Ign:1 http://deb.debian.org/debian bookworm/main amd64 sudo amd64 1.9.13p3-1 Ign:1 http://deb.debian.org/debian bookworm/main amd64 sudo amd64 1.9.13p3-1 Ign:1 http://deb.debian.org/debian bookworm/main amd64 sudo amd64 1.9.13p3-1 Err:1 http://deb.debian.org/debian bookworm/main amd64 sudo amd64 1.9.13p3-1 Temporary failure resolving 'deb.debian.org' E: Failed to fetch http://deb.debian.org/debian/pool/main/s/sudo/sudo_1.9.13p3-1_amd64.deb Temporary failure resolving 'deb.debian.org' E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? virt-builder: error: export DEBIAN_FRONTEND=noninteractive apt_opts='-q -y -o Dpkg::Options::=--force-confnew' apt-get $apt_opts update apt-get $apt_opts install 'sudo' : command exited with an error If reporting bugs, run virt-builder with debugging enabled and include the complete output: virt-builder -v -x [...] Reviewed-by: Chuck Lever <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Signed-off-by: Daniel Gomez <[email protected]>
1 parent 920df5c commit 53d1d15

File tree

7 files changed

+62
-5
lines changed

7 files changed

+62
-5
lines changed

Makefile.min_deps

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ BINARY_DEPS += sudo
1010
BINARY_DEPS += make
1111
BINARY_DEPS += nc
1212
BINARY_DEPS += ansible-playbook
13-
ifneq (y,$(CONFIG_KDEVOPS_FIRST_RUN))
14-
ifeq (y,$(CONFIG_GUESTFS))
15-
BINARY_DEPS += virt-builder
16-
endif
17-
endif
1813

1914
BINARY_DEPS_VCHECKS := $(subst $(TOPDIR)/,,$(wildcard $(TOPDIR)/scripts/version_check/*))
2015

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Install libguestfs
3+
become: true
4+
become_method: ansible.builtin.sudo
5+
ansible.builtin.package:
6+
update_cache: true
7+
name:
8+
- libguestfs-tools
9+
- isc-dhcp-client
10+
state: present
11+
tags: ['install-deps']
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Debian-specific setup
3+
ansible.builtin.include_tasks: debian/main.yml
4+
when: ansible_facts['os_family']|lower == 'debian'
5+
tags: ['install-deps']
6+
7+
- name: SuSE-specific setup
8+
ansible.builtin.include_tasks: suse/main.yml
9+
when: ansible_facts['os_family']|lower == 'suse'
10+
tags: ['install-deps']
11+
12+
- name: Fedora/Red Hat Enterprise-specific setup
13+
ansible.builtin.include_tasks: redhat/main.yml
14+
when:
15+
- ansible_facts['os_family']|lower == 'redhat'
16+
- ansible_facts['distribution']|lower != "fedora"
17+
tags: ['install-deps']
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Install libguestfs on Fedora/RedHat
3+
become: true
4+
become_method: ansible.builtin.sudo
5+
ansible.builtin.package:
6+
update_cache: true
7+
name:
8+
- libguestfs-tools
9+
- dhcpcd
10+
state: present
11+
tags: ['install-deps']
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: Install libguestfs on SUSE
3+
become: true
4+
become_method: ansible.builtin.sudo
5+
ansible.builtin.package:
6+
name:
7+
- libguestfs-tools
8+
- dhcpcd
9+
state: present
10+
tags: ['install-deps']

playbooks/roles/bringup_guestfs/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
- name: Install dependencies
2+
ansible.builtin.include_tasks: install-deps/main.yml
3+
tags: ['install-deps']
4+
15
- name: Verify we're configured {{ topdir_path }}/.config directory exists
26
stat:
37
path: "{{ topdir_path }}/.config"

scripts/guestfs.Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ANSIBLE_EXTRA_ARGS += $(GUESTFS_ARGS)
4747
GUESTFS_BRINGUP_DEPS :=
4848
GUESTFS_BRINGUP_DEPS += $(9P_HOST_CLONE)
4949
GUESTFS_BRINGUP_DEPS += $(LIBVIRT_PCIE_PASSTHROUGH)
50+
GUESTFS_BRINGUP_DEPS += install_libguestfs
5051

5152
KDEVOPS_PROVISION_METHOD := bringup_guestfs
5253
KDEVOPS_PROVISION_DESTROY_METHOD := destroy_guestfs
@@ -72,6 +73,14 @@ $(KDEVOPS_PROVISIONED_SSH):
7273
$(Q)ansible $(ANSIBLE_VERBOSE) -i hosts all -e 'ansible_python_interpreter=/usr/bin/python3' -m wait_for_connection
7374
$(Q)touch $(KDEVOPS_PROVISIONED_SSH)
7475

76+
install_libguestfs:
77+
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
78+
--inventory localhost, \
79+
playbooks/bringup_guestfs.yml \
80+
-e 'ansible_python_interpreter=/usr/bin/python3' \
81+
--extra-vars=@./extra_vars.yaml \
82+
--tags install-deps
83+
7584
bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
7685
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
7786
--inventory localhost, \

0 commit comments

Comments
 (0)