apt package cache marks packages that don't exist
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
craft-parts marks a package to install then fails find the package.
Possible problems could be that the cache is stale, `apt update` needs to be run, or there is a problem with how the `python-apt` library is used.
### To Reproduce
I have not been able to reproduce this failure, perhaps it depends on the age or condition of the instance or base instance.
See more details on the reproducer [here](https://github.com/snapcore/snapcraft/issues/4542)
### part yaml
```shell
parts:
netplan:
plugin: nil
stage-packages:
- libnetplan0:arm64
```
### Relevant log output
```shell
24-01-24 21:06:41.591 Fetching stage-packages
2024-01-24 21:06:41.591 Requested stage-packages: ['libnetplan0:arm64', 'libpython3-stdlib:arm64', 'libpython3.11-minimal:arm64', 'libpython3.11-stdlib:arm64', 'netplan.io:arm64', 'python3-dbus:arm64', 'python3-minimal:arm64', 'python3-netifaces:arm64', 'python3-yaml:arm64', 'python3.11-minimal:arm64', 'python3:arm64']
2024-01-24 21:06:41.691 Executing: ['apt-get', 'update']
2024-01-24 21:06:42.088 :: Hit:1 http://archive.ubuntu.com/ubuntu mantic InRelease
2024-01-24 21:06:42.094 :: Hit:2 http://archive.ubuntu.com/ubuntu mantic-updates InRelease
2024-01-24 21:06:42.114 :: Hit:3 http://archive.ubuntu.com/ubuntu mantic-backports InRelease
2024-01-24 21:06:42.235 :: Hit:4 http://security.ubuntu.com/ubuntu mantic-security InRelease
2024-01-24 21:06:45.560 :: Reading package lists...
2024-01-24 21:06:46.370 Marking libpython3.11-stdlib:arm64 (and its dependencies) to be fetched
2024-01-24 21:06:46.374 Stage package not found in part 'netplan': libpython3.11-stdlib:arm64.
2024-01-24 21:06:46.384 Traceback (most recent call last):
2024-01-24 21:06:46.384 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/executor/part_handler.py", line 897, in _fetch_stage_packages
2024-01-24 21:06:46.385 fetched_packages = packages.Repository.fetch_stage_packages(
2024-01-24 21:06:46.385 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/deb.py", line 602, in fetch_stage_packages
2024-01-24 21:06:46.385 return cls._fetch_stage_debs( # type: ignore[no-any-return]
2024-01-24 21:06:46.385 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/deb.py", line 262, in wrapped
2024-01-24 21:06:46.385 return method(*args, **kwargs)
2024-01-24 21:06:46.385 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/deb.py", line 647, in _fetch_stage_debs
2024-01-24 21:06:46.386 apt_cache.mark_packages(set(package_names))
2024-01-24 21:06:46.386 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/apt_cache.py", line 309, in mark_packages
2024-01-24 21:06:46.386 raise errors.PackageNotFound(name_arch)
2024-01-24 21:06:46.386 craft_parts.packages.errors.PackageNotFound: Package no
```
Evaluation history
No evaluation history available.