public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/1] Exit bootstrap with error if apt-get update fails
@ 2022-10-19  4:31 Uladzimir Bely
  2022-10-19  4:31 ` [PATCH 1/1] " Uladzimir Bely
  2022-10-26 14:02 ` [PATCH 0/1] " Anton Mikanovich
  0 siblings, 2 replies; 3+ messages in thread
From: Uladzimir Bely @ 2022-10-19  4:31 UTC (permalink / raw)
  To: isar-users

Sometimes we have issues with `deb.debian.org` availability. Usually, it
results in errors in the related tasks that are understandable, e.g.,
`Could not connect to deb.debian.org:80` and so on.

But if the issue happens while debootstrapping at the `apt-get update`
stage, it doesn't produce an error and the following tasks fail instead
with a pretty weird reason (no any errors in the nearest context).

For example, we can get errors in buildchroot-target:

```
E: Package 'make' has no installation candidate
E: Unable to locate package debhelper
...
```
The reason is that `actual` error happened in `bootstrap` task, but it
didn't fail with error code.

Adding `-o APT::Update::Error-Mode=any` (this is an apt configuration
equivalent of `--error-on=any` option) makes apt fail in such cases
during the debootstrapping.

Unfortunatelly, proposed solution doesn't work for `stretch` and
`buster` while they have older apt versions.

Technically, it's possible support these legacy distros, but it will
require ugly workarounds with redirecting apt-get output, parcing
it for `^W` messages (warnings) and generating artificial errors. It
doesn't looks like something that is worth implementing.

Uladzimir Bely (1):
  Exit bootstrap with error if apt-get update fails

 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Exit bootstrap with error if apt-get update fails
  2022-10-19  4:31 [PATCH 0/1] Exit bootstrap with error if apt-get update fails Uladzimir Bely
@ 2022-10-19  4:31 ` Uladzimir Bely
  2022-10-26 14:02 ` [PATCH 0/1] " Anton Mikanovich
  1 sibling, 0 replies; 3+ messages in thread
From: Uladzimir Bely @ 2022-10-19  4:31 UTC (permalink / raw)
  To: isar-users

If `apt-get update` can't reach one ore more mirrors listed in
sources.list, it consider this as 'transient' error and doesn't
produce non-zero error code.

So, `do_bootstrap` finishes with no errors in this case and we don't
have proper apt database here and face with errors in the later tasks,
e.g. `rootfs_install_pkg_download` in buildchroot.

The patch adds an option to `apt-get update` that makes it exit with
non-zero code for trancient failures.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index fdaad61b..f32d192e 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -386,7 +386,8 @@ do_bootstrap() {
             chroot "${ROOTFSDIR}" /usr/bin/dpkg --add-architecture ${COMPAT_DISTRO_ARCH}
         fi
 
-        chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y
+        chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y \
+                                -o APT::Update::Error-Mode=any
         chroot "${ROOTFSDIR}" /usr/bin/apt-get install -y -f
         chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \
                                 -o Debug::pkgProblemResolver=yes
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] Exit bootstrap with error if apt-get update fails
  2022-10-19  4:31 [PATCH 0/1] Exit bootstrap with error if apt-get update fails Uladzimir Bely
  2022-10-19  4:31 ` [PATCH 1/1] " Uladzimir Bely
@ 2022-10-26 14:02 ` Anton Mikanovich
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Mikanovich @ 2022-10-26 14:02 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

19.10.2022 07:31, Uladzimir Bely wrote:
> Sometimes we have issues with `deb.debian.org` availability. Usually, it
> results in errors in the related tasks that are understandable, e.g.,
> `Could not connect to deb.debian.org:80` and so on.
>
> But if the issue happens while debootstrapping at the `apt-get update`
> stage, it doesn't produce an error and the following tasks fail instead
> with a pretty weird reason (no any errors in the nearest context).
>
> For example, we can get errors in buildchroot-target:
>
> ```
> E: Package 'make' has no installation candidate
> E: Unable to locate package debhelper
> ...
> ```
> The reason is that `actual` error happened in `bootstrap` task, but it
> didn't fail with error code.
>
> Adding `-o APT::Update::Error-Mode=any` (this is an apt configuration
> equivalent of `--error-on=any` option) makes apt fail in such cases
> during the debootstrapping.
>
> Unfortunatelly, proposed solution doesn't work for `stretch` and
> `buster` while they have older apt versions.
>
> Technically, it's possible support these legacy distros, but it will
> require ugly workarounds with redirecting apt-get output, parcing
> it for `^W` messages (warnings) and generating artificial errors. It
> doesn't looks like something that is worth implementing.
>
> Uladzimir Bely (1):
>    Exit bootstrap with error if apt-get update fails
>
>   meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
Applied to next, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-26 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19  4:31 [PATCH 0/1] Exit bootstrap with error if apt-get update fails Uladzimir Bely
2022-10-19  4:31 ` [PATCH 1/1] " Uladzimir Bely
2022-10-26 14:02 ` [PATCH 0/1] " Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox