canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.87k stars 856 forks source link

apt sources changes ignored while installing the packages #5707

Open Unb0rn opened 4 days ago

Unb0rn commented 4 days ago

Bug report

I'm trying to install docker (almost as per official instructions) But after adding the docker repo, package_update seems to ignore the changes to repos config and installing packages like docker-ce-cli results in:

[ 147.431858] cloud-init[1634]: E: Package 'docker-ce' has no installation candidate [ 147.432992] cloud-init[1634]: E: Package 'docker-ce-cli' has no installation candidate [ 147.434112] cloud-init[1634]: E: Unable to locate package containerd.io [ 147.435036] cloud-init[1634]: E: Couldn't find any package by glob 'containerd.io' [ 147.435991] cloud-init[1634]: E: Couldn't find any package by regex 'containerd.io' [ 147.437051] cloud-init[1634]: E: Unable to locate package docker-buildx-plugin [ 147.437987] cloud-init[1634]: E: Unable to locate package docker-compose-plugin Logging in to the machine and installing the packages works fine (the repo is added correctly)

I found almost the same issue on severfault that has never been resolved. Is this a bug? Is there any known workaround?

Steps to reproduce the problem

  1. Set up the cloud-config so it will add the docker repo to sources list and install packages after
  2. Pass it to Ubuntu image
  3. Check the logs

Environment details

cloud-init logs

cloud-init.tar.gz

a-dubs commented 3 days ago

Hello! Thank you for filing a bug. Would you be able to provide the cloud-config you used or at least the relevant portion of the cloud config?

Unb0rn commented 2 days ago

Hello! Thank you for filing a bug. Would you be able to provide the cloud-config you used or at least the relevant portion of the cloud config?

Thank you for a quick reply. Attaching the failing part cloud-init-example.txt

a-dubs commented 2 days ago

Pasting the contents here for easier visibility:

#cloud-config
apt:
  sources:
    docker.list:
      source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable
      keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88

package_update: true
package_upgrade: true

packages:
 - curl
 - ca-certificates
 - docker-ce
 - docker-ce-cli
 - containerd.io
 - docker-buildx-plugin
 - docker-compose-plugin