Fix dependency installation failures caused by outdated package indexes
on Debian-based systems. When the host's package index is stale, package
installation can fail with HTTP 404 errors because updated packages are
no longer available at their cached URLs.
Recent build server failures show this issue:
```
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/o/openldap/libldap-2.5-0_2.5.18%2bdfsg-0ubuntu0.22.04.3_arm64.deb 404 Not Found [IP: 91.189.91.104 80]
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/o/openldap/libldap-dev_2.5.18%2bdfsg-0ubuntu0.22.04.3_arm64.deb 404 Not Found [IP: 91.189.91.104 80]
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/o/openldap/libldap2-dev_2.5.18%2bdfsg-0ubuntu0.22.04.3_all.deb 404 Not Found [IP: 91.189.91.104 80]
```
In this change, we add `apt-get update` before installing the
ceph-build-deps meta package, following the same pattern used in
ensure_decent_gcc_on_ubuntu().
Note: Additional `apt-get update` calls are still required when installing
packages from custom repositories after adding their source lists.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
# Put this before any other invocation of apt so it can clean
# up in a broken case.
clean_boost_on_ubuntu
+
+ # update the local package index before installing any packages from the
+ # official repo
+ $SUDO env DEBIAN_FRONTEND=noninteractive apt-get update \
+ -y -o Acquire::Languages=none -o Acquire::Translation=none || true
+
if [ "$INSTALL_EXTRA_PACKAGES" ]; then
if ! $SUDO apt-get install -y $INSTALL_EXTRA_PACKAGES ; then
# try again. ported over from run-make.sh (orignally e278295)