Merge ~jslarraz/ubuntu-security-tools:add-apt-source-to-autopkgtest into ubuntu-security-tools:master

Proposed by Jorge Sancho Larraz
Status: Merged
Merged at revision: 694291ebf928872abfccd3b0a88e73980216e390
Proposed branch: ~jslarraz/ubuntu-security-tools:add-apt-source-to-autopkgtest
Merge into: ubuntu-security-tools:master
Diff against target: 39 lines (+26/-2)
1 file modified
build-tools/umt (+26/-2)
Reviewer Review Type Date Requested Status
Marc Deslauriers Approve
Review via email: mp+461357@code.launchpad.net

Commit message

umt/autopkgtest: add add apt source by default

Description of the change

when running autopkgtest for python-cryptography/noble, it ended with following error:

No VM guests are running outdated hypervisor (qemu) binaries on this host.
(Reading database ... 66760 files and directories currently installed.)
Removing autopkgtest-satdep (0) ...
E: You must put some 'deb-src' URIs in your sources.list
E: You must put some 'deb-src' URIs in your sources.list
qemu-system-x86_64: terminating on signal 15 from pid 200712 (/usr/bin/python3)
autopkgtest [15:16:45]: ERROR: testbed failure: rules extract failed with exit code 100 (apt failure)

Proposed change fixed the issue, however I'm not sure if there is a better way to fix this issue

To post a comment you must log in.
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

So, this is a hack until autopkgtest is properly fixed: https://salsa.debian.org/ci-team/autopkgtest/-/merge_requests/287

Could you make it only apply to noble, and put a comment that describes that as being a hack along with the url above.

Also, please make it honor build_tools_sbuildmirror like the code higher up does, and if that's not set default to the main repo, not a local mirror.

review: Needs Fixing
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

This is probably LP: #2052639, please add that to the comment also.

Revision history for this message
Jorge Sancho Larraz (jslarraz) wrote :

MR updated according to your commentaries.

I've been experimenting a very weird behavior. The MR worked perfectly when configuring build_tools_sbuildmirror with any mirror other than main archive. However, when using the main archive, apt update didn't fetch metadata properly (I could observe a hit instead of a get in the debug info), what resulted in apt crashing when tried to download a package version that no longer exist.
(In my case binutils-common2.42-2ubuntu1, which has been replaced by version 2.42-3ubuntu1).

Forcing apt update to download all the information by clearing apt's index (i.e. rm /var/lib/apt/lists/*_*) fixed the issue, but it looks even more hacky. I wonder if you have any clue of what may be happening here.

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

I don't really know why you're experiencing the apt issue, but apt often needs an "apt update" after modifying the list of sources. Could you try "apt clean" before doing the "apt update" instead of removing the files manually?

Revision history for this message
Jorge Sancho Larraz (jslarraz) wrote :

Changing `sudo rm /var/lib/apt/lists/*_*` for `apt clean` results in the error previously explained

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.42-2ubuntu1_amd64.deb 404 Not Found [IP: 91.189.91.81 80]

Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Hrm, that's odd. Ok, ack on this for now. Thanks!

review: Approve
Revision history for this message
Jorge Sancho Larraz (jslarraz) wrote :

Yup, agree it is really odd. It has took me forever realize what was happening...

Considering how hacky it looks and that we really want to get rid of it as soon as possible I wonder if it would be better to keep it in a separate branch we can pull when/if need to run autopkgtest for noble instead of merging to master. I'm not completely sure.

What's your opinion on that?

Revision history for this message
Marc Deslauriers (mdeslaur) wrote (last edit ):

We might as well add the hack so that others don't waste time investigating the same issue. But, please subscribe to the upstream merge commit and the bug and remove it when it's no longer necessary.

Revision history for this message
Jorge Sancho Larraz (jslarraz) wrote :

Done!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/build-tools/umt b/build-tools/umt
2index 3ff8767..ba53424 100755
3--- a/build-tools/umt
4+++ b/build-tools/umt
5@@ -3275,8 +3275,32 @@ def run_autopkgtest_tests(opt, args, details):
6 print("Executing autopkgtest baseline test for %s on %s..." % (details["package"], image))
7 cmd = ["/usr/bin/autopkgtest",
8 "-U", # apt upgrade for latest archive
9- "-o", os.path.join(autopkgtest_dest, prev_version),
10- details["package"]]
11+ "-o", os.path.join(autopkgtest_dest, prev_version)]
12+ # FIXME this is a hack needed because noble cloud images does not include deb-src currently,
13+ # possibly because of the new deb822 format. This should be removed when fixed in autopkgtest.
14+ # https://salsa.debian.org/ci-team/autopkgtest/-/merge_requests/287
15+ # https://bugs.launchpad.net/ubuntu/+source/autopkgtest/+bug/2052639
16+ if details["series"] == "noble":
17+ archive_url = "http://archive.ubuntu.com/ubuntu"
18+ if opt.arch in ["amd64", "i386"] and \
19+ 'build_tools_sbuildmirror' in ust and \
20+ ust['build_tools_sbuildmirror'] is not None:
21+ archive_url = ust['build_tools_sbuildmirror']
22+ cmd.append("--add-apt-source")
23+ cmd.append("deb-src %s noble main restricted universe multiverse" % archive_url)
24+ cmd.append("--add-apt-source")
25+ cmd.append("deb-src %s noble-updates main restricted universe multiverse" % archive_url)
26+ cmd.append("--add-apt-source")
27+ cmd.append("deb-src %s noble-security main restricted universe multiverse" % archive_url)
28+ # For a reason I don't know, when using the main archive (i.e. http://archive.ubuntu.com/ubuntu)
29+ # apt update does not fetch sources information properly (I can observe a hit instead of a get)
30+ # that result in apt crashing when tries to download a package version that no longer exists
31+ # (in my case binutils-common2.42-2ubuntu1, which has been replaced by version 2.42-3ubuntu1)
32+ # Removing apt cached info before running update seems to fix the problem.
33+ cmd.append("--setup-commands-boot")
34+ cmd.append("sudo rm /var/lib/apt/lists/*_*; sudo apt update")
35+ # END OF HACK
36+ cmd.append(details["package"])
37 if opt.autopkgtest_config is not None:
38 cmd.append(opt.autopkgtest_config)
39 if opt.test_name is not None:

Subscribers

People subscribed via source and target branches