Skip to content

Base images store out-of-date apt package caches #5879

@lengau

Description

@lengau

Bug Description

This is pretty hard to reproduce and not specifically a bug in snapcraft (I put it here to keep it logged somewhere, as I'm unsure where the fix needs to go). @bepri encountered this today when trying to update a snapcraft.yaml file

What happened is that his LXD base image used for snapcraft was created before noble-updates got a cargo-1.85 package, so adding it as a build-package caused craft-parts to fail when trying to install it (because there was no package with that name).

Possible fixes:

  1. Asynchronously run apt update on boot.
  2. Always update before installing build-packages (up side: gets the latest packages. Down side: very slow)
  3. If there are errors when installing build-packages, run update and try again before failing.

This is also the sort of thing that could be worked around by a user if we implemented a purge command for all apps. That's not a fix, but it makes these types of bugs less annoying for users since they don't have to manually mess with the lxd project

To Reproduce

  1. Create a snapcraft.yaml file that adds your own PPA or similar.
  2. Run snapcraft pack
  3. Add a new package (that's not in the Ubuntu repos) to that PPA
  4. Add that package to the build-packages for a part

Expected behaviour: It installs that build package

Actual behaviour: It complains that the package does not exist

Environment

n/a

snapcraft.yaml

n/a

Relevant log output

n/a

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions