public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@samsung.com>
To: <mcgrof@kernel.org>
Cc: <kdevops@lists.linux.dev>, Daniel Gomez <da.gomez@samsung.com>
Subject: [PATCH] bringup: devconfig: fix python3-apt debian issue
Date: Fri, 31 Jan 2025 22:05:52 +0100	[thread overview]
Message-ID: <20250131-fix-python3-apt-v1-1-bcdb14b149ba@samsung.com> (raw)
In-Reply-To: CGME20250131210630eucas1p18ab8dba510ee2ddc84ac28a653daf597@eucas1p1.samsung.com

Downgrade python3-apt package to 2.9.6 during bringup to avoid Ansible
error with apt module (see below).

Build from source python3-apt using pip, and lock any possible future
upgrades of the package to avoid overwriting the build from source
deployment.

This is a workaround until python3-apt package in Debian testing is
fixed. It will also delay the bringup process considerably depending on
the guest.

The latest python3-apt releases 2.9.8 and 2.9.7 produces the following
error with Ansible:

Error message:

TASK [create_partition : Install partition creation base tools]
fatal: [4da8c431f681-xfs-reflink-4k]: FAILED! => {
    "changed": false
}

MSG:

python3-apt must be installed and visible from /usr/bin/python3.

Tested with Ansible version:

ii  ansible        9.5.1+dfsg-1 all
ii  ansible-core   2.17.1-1

ansible --version
ansible [core 2.17.1]
  ...
  python version = 3.12.6 (main, Sep  7 2024, 14:20:15) [GCC 14.2.0]
(/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True
ansible-playbook --version
ansible-playbook [core 2.17.1]
  ...
  executable location = /usr/bin/ansible-playbook
  python version = 3.12.6 (main, Sep  7 2024, 14:20:15) [GCC 14.2.0]
(/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Latest versions of python3-apt produces playbook errors when apt or
package Ansible modules are used. Replace the current Debian testing
package with an older working version of python3-apt.

This workaround fixes the current kdevops CI issue in GitHub [1].

[1] https://github.com/linux-kdevops/kdevops/actions/runs/13040775569/job/36420451428

To: Luis Chamberlain <mcgrof@kernel.org>
Cc: kdevops@lists.linux.dev
---
 .../devconfig/tasks/install-deps/debian/main.yml   | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml b/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml
index c8c18bb0d8c75a853cdf86d19b1b57acc4bc29b3..c7d28776d1355ad4368a3feafb1df743363f50be 100644
--- a/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml
+++ b/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml
@@ -1,4 +1,46 @@
 ---
+- name: Update package lists
+  become: true
+  become_method: sudo
+  ansible.builtin.shell:
+    cmd: >
+      DEBIAN_FRONTEND=noninteractive apt
+      -o Acquire::Check-Valid-Until=false update
+  when:
+    - ansible_os_family == "Debian"
+  tags: vars_simple
+  register: apt_update_result
+  retries: 5
+  delay: 10
+  until: apt_update_result.rc == 0
+
+- name: Install required packages
+  become: true
+  become_method: sudo
+  ansible.builtin.shell:
+    cmd: >
+      DEBIAN_FRONTEND=noninteractive apt install -y
+      python3-setuptools libapt-pkg-dev python3-pip git
+  when:
+    - ansible_os_family == "Debian"
+  tags: vars_simple
+
+- name: Install python-apt from Git with pip3
+  become: true
+  become_method: sudo
+  ansible.builtin.shell:
+    cmd: pip3 install git+https://salsa.debian.org/apt-team/python-apt.git@2.9.6 --break-system-packages
+  when:
+    - ansible_os_family == "Debian"
+  tags: vars_simple
+
+- name: Hold python3-apt package version
+  become: yes
+  ansible.builtin.command: apt-mark hold python3-apt
+  when:
+    - ansible_os_family == "Debian"
+  tags: vars_simple
+
 - name: Remove unattended-upgrades package
   become: yes
   become_flags: 'su - -c'

---
base-commit: 4da8c431f681d6b8009518c6766c638267d9c61a
change-id: 20250131-fix-python3-apt-227607641858

Best regards,
-- 
Daniel Gomez <da.gomez@samsung.com>


       reply	other threads:[~2025-01-31 21:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250131210630eucas1p18ab8dba510ee2ddc84ac28a653daf597@eucas1p1.samsung.com>
2025-01-31 21:05 ` Daniel Gomez [this message]
2025-02-03  9:44   ` [PATCH] bringup: devconfig: fix python3-apt debian issue Daniel Gomez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250131-fix-python3-apt-v1-1-bcdb14b149ba@samsung.com \
    --to=da.gomez@samsung.com \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox