GoogleCloudPlatform / artifact-registry-apt-transport

Apache License 2.0
9 stars 15 forks source link

Not working with Ubuntu21.10 #4

Closed cbodenst closed 2 years ago

cbodenst commented 2 years ago

Hi,

I tried to use google cloud artifact registry on docker ubuntu:21.10. It seems that the transport module can not determine the size of the packages in the repo and gives following error:

apt update
apt install opencv

E: Repository is broken: ar+https://europe-west3-apt.pkg.dev/projects/aisw-ww-ai stage-apt/main amd64 opencv amd64 4.5.5 has no Size information

using apt -oAcquire::AllowUnsizedPackages=1 install opencv suppressed the error but the download stucks at 0%.

With Ubuntu 20.04 there it comes to a warning but it generally works.

illfelder commented 2 years ago

It looks like your package may be malformed, but it's very difficult for us to root cause the issue given the current information provided. Can you provide us with a way to reproduce your error?

cbodenst commented 2 years ago

It is possible to reproduce the error using this script on docker ubuntu:21.10

#!/bin/bash
mkdir mypackage
cd mypackage
mkdir usr
mkdir usr/share
mkdir usr/share/mypackage
echo "Hello World" | tee usr/share/mypackage/hello
mkdir DEBIAN
cat > DEBIAN/control <<- EOM
Package: mypackage
Version: 0.1
Section: devel
Priority: optional
Architecture: amd64
Maintainer: me
Installed-Size: 1
Description: Desc
EOM
cd ..
dpkg-deb -b mypackage
gcloud beta artifacts apt upload $REPO --project=$PROJECT --location=$LOCATION --source=mypackage.deb

now if you want to install the package inside the same docker container yo will receive the error:

apt update
apt install mypackage
E: Repository is broken: ... amd64 mypackage amd64 0.1 has no Size information

This workaround actually helps:

echo "Acquire::AllowUnsizedPackages true;" | tee -a /etc/apt/apt.conf.d/90artifact-registry
ericdand commented 2 years ago

Thank you for the bug report.

This was indeed a flaw in our backend: we had previously omitted the "Size" field in "Packages" index files and apt never cared to check it, but it seems like apt was changed in v2.3.1 on April 13 of last year to emit this new warning when that field is missing (according to http://changelogs.ubuntu.com/changelogs/pool/main/a/apt/apt_2.3.9/changelog).

I've written a fix, but it'll take a few weeks to make it all the way through our release process. In the meantime, that workaround you identified should get you unblocked without any negative side-effects. :)

adaszko commented 2 years ago

Thank you for the bug report.

This was indeed a flaw in our backend: we had previously omitted the "Size" field in "Packages" index files and apt never cared to check it, but it seems like apt was changed in v2.3.1 on April 13 of last year to emit this new warning when that field is missing (according to http://changelogs.ubuntu.com/changelogs/pool/main/a/apt/apt_2.3.9/changelog).

I've written a fix, but it'll take a few weeks to make it all the way through our release process. In the meantime, that workaround you identified should get you unblocked without any negative side-effects. :)

Hi 👋 It's been 3 months since the last comment on this issue. Is the fix still unreleased? Thank you in advance.

illfelder commented 2 years ago

Apologies for not closing this off sooner. The fix rolled out a couple months back.

adaszko commented 2 years ago

Thanks for letting me know @illfelder. Although, the problem seems to be still present. There's a pretty simple way to reproduce it:

docker run -it ubuntu:20.04 /bin/bash
apt update
apt install --yes curl gnupg2
curl https://europe-west6-apt.pkg.dev/doc/repo-signing-key.gpg | apt-key add -
echo deb https://europe-west6-apt.pkg.dev/projects/radicle-services radicle-cli main | tee -a /etc/apt/sources.list.d/radicle-registry.list
apt update
apt install --yes radicle-cli

it results in:

[...]
root@39abe876ed56:/# apt install --yes radicle-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  radicle-cli
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
After this operation, 98.5 MB of additional disk space will be used.
Get:1 https://europe-west6-apt.pkg.dev/projects/radicle-services radicle-cli/main amd64 radicle-cli amd64 0.4.0 [16.9 MB]
Fetched 16.9 MB in 2s (8571 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package radicle-cli.
(Reading database ... 4901 files and directories currently installed.)
Preparing to unpack .../radicle-cli_0.4.0_amd64.deb ...
Unpacking radicle-cli (0.4.0) ...
Setting up radicle-cli (0.4.0) ...
W: Repository is broken: radicle-cli:amd64 (= 0.4.0) has no Size information
root@39abe876ed56:/# apt --version
apt 2.0.6 (amd64)
ericdand commented 2 years ago

@adaszko You'll need to make a modification to the repository to trigger index file regeneration. Updating (or deleting and re-uploading) any package would be sufficient.

adaszko commented 2 years ago

@adaszko You'll need to make a modification to the repository to trigger index file regeneration. Deleting and re-uploading any package would be sufficient.

Oh great. Thanks for the tip 👍

adaszko commented 2 years ago

@adaszko You'll need to make a modification to the repository to trigger index file regeneration. Updating (or deleting and re-uploading) any package would be sufficient.

I have just uploaded a new .deb file and the problem still persists:

image

The deb has been uploaded like so, from GitHub Actions:

image

A screenshot from GCP Console:

image

The way to reproduce hasn't changed.

Am I perhaps using the wrong gcloud CLI tools channel (i.e. beta)?

ericdand commented 2 years ago

Thanks for your continued attention on this Adam. I took another look at our code and found one more place where I had missed making the change to add the "Size" field -- right now it's added under certain circumstances but not all. I've got the change in to actually fix this issue under all cases now, but it'll once again take a couple of weeks to roll out to production.