Making apt cms ricker in pimox workers
This commit is contained in:
parent
a47f4b56e9
commit
9df2dd0fd4
|
|
@ -52,10 +52,25 @@ configure_debian_apt_https() {
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnose_apt_network() {
|
diagnose_apt_network() {
|
||||||
echo "APT package install failed; checking Debian mirror reachability..." >&2
|
local reason="${1:-APT package install failed}"
|
||||||
|
local packages="${2:-}"
|
||||||
|
|
||||||
|
echo "$reason; checking APT state and mirror reachability..." >&2
|
||||||
|
if [ -n "$packages" ]; then
|
||||||
|
echo "Requested packages:$packages" >&2
|
||||||
|
fi
|
||||||
|
echo "APT sources:" >&2
|
||||||
|
sudo grep -R -n -E '^(Types:|URIs:|Suites:|Components:|Architectures:|Signed-By:|deb )' \
|
||||||
|
/etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null >&2 || true
|
||||||
ip route >&2 || true
|
ip route >&2 || true
|
||||||
getent hosts deb.debian.org >&2 || true
|
getent hosts deb.debian.org >&2 || true
|
||||||
curl -I --connect-timeout 5 --max-time 10 https://deb.debian.org/debian/ >&2 || true
|
curl -I --connect-timeout 5 --max-time 10 https://deb.debian.org/debian/ >&2 || true
|
||||||
|
if [ -n "$packages" ]; then
|
||||||
|
for package in $packages; do
|
||||||
|
echo "--- apt-cache policy $package" >&2
|
||||||
|
apt-cache policy "$package" >&2 || true
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_missing_packages() {
|
install_missing_packages() {
|
||||||
|
|
@ -67,9 +82,12 @@ install_missing_packages() {
|
||||||
done
|
done
|
||||||
if [ -n "$missing_packages" ]; then
|
if [ -n "$missing_packages" ]; then
|
||||||
configure_debian_apt_https
|
configure_debian_apt_https
|
||||||
apt_get update
|
apt_get update || {
|
||||||
|
diagnose_apt_network "APT update failed before installing worker bootstrap packages" "$missing_packages"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
apt_get install -y --no-install-recommends $missing_packages || {
|
apt_get install -y --no-install-recommends $missing_packages || {
|
||||||
diagnose_apt_network
|
diagnose_apt_network "APT package install failed for worker bootstrap packages" "$missing_packages"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
@ -96,8 +114,14 @@ DOCKER_SOURCES
|
||||||
sudo apt-get remove -y containerd runc || true
|
sudo apt-get remove -y containerd runc || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt_get update
|
apt_get update || {
|
||||||
apt_get install -y --no-install-recommends containerd.io
|
diagnose_apt_network "APT update failed before installing containerd.io" "containerd.io"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
apt_get install -y --no-install-recommends containerd.io || {
|
||||||
|
diagnose_apt_network "APT package install failed for containerd.io" "containerd.io"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
sudo apt-mark hold containerd.io
|
sudo apt-mark hold containerd.io
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -586,10 +610,25 @@ configure_debian_apt_https() {
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnose_apt_network() {
|
diagnose_apt_network() {
|
||||||
echo "APT package install failed; checking Debian mirror reachability..." >&2
|
local reason="${1:-APT package install failed}"
|
||||||
|
local packages="${2:-}"
|
||||||
|
|
||||||
|
echo "$reason; checking APT state and mirror reachability..." >&2
|
||||||
|
if [ -n "$packages" ]; then
|
||||||
|
echo "Requested packages:$packages" >&2
|
||||||
|
fi
|
||||||
|
echo "APT sources:" >&2
|
||||||
|
sudo grep -R -n -E '^(Types:|URIs:|Suites:|Components:|Architectures:|Signed-By:|deb )' \
|
||||||
|
/etc/apt/sources.list /etc/apt/sources.list.d 2>/dev/null >&2 || true
|
||||||
ip route >&2 || true
|
ip route >&2 || true
|
||||||
getent hosts deb.debian.org >&2 || true
|
getent hosts deb.debian.org >&2 || true
|
||||||
curl -I --connect-timeout 5 --max-time 10 https://deb.debian.org/debian/ >&2 || true
|
curl -I --connect-timeout 5 --max-time 10 https://deb.debian.org/debian/ >&2 || true
|
||||||
|
if [ -n "$packages" ]; then
|
||||||
|
for package in $packages; do
|
||||||
|
echo "--- apt-cache policy $package" >&2
|
||||||
|
apt-cache policy "$package" >&2 || true
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_missing_packages() {
|
install_missing_packages() {
|
||||||
|
|
@ -601,9 +640,12 @@ install_missing_packages() {
|
||||||
done
|
done
|
||||||
if [ -n "$missing_packages" ]; then
|
if [ -n "$missing_packages" ]; then
|
||||||
configure_debian_apt_https
|
configure_debian_apt_https
|
||||||
apt_get update
|
apt_get update || {
|
||||||
|
diagnose_apt_network "APT update failed before installing worker bootstrap packages" "$missing_packages"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
apt_get install -y --no-install-recommends $missing_packages || {
|
apt_get install -y --no-install-recommends $missing_packages || {
|
||||||
diagnose_apt_network
|
diagnose_apt_network "APT package install failed for worker bootstrap packages" "$missing_packages"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
@ -630,8 +672,14 @@ DOCKER_SOURCES
|
||||||
sudo apt-get remove -y containerd runc || true
|
sudo apt-get remove -y containerd runc || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt_get update
|
apt_get update || {
|
||||||
apt_get install -y --no-install-recommends containerd.io
|
diagnose_apt_network "APT update failed before installing containerd.io" "containerd.io"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
apt_get install -y --no-install-recommends containerd.io || {
|
||||||
|
diagnose_apt_network "APT package install failed for containerd.io" "containerd.io"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
sudo apt-mark hold containerd.io
|
sudo apt-mark hold containerd.io
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -651,8 +699,14 @@ install_tailscale() {
|
||||||
sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
|
sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
|
||||||
curl -fsSL "https://pkgs.tailscale.com/stable/debian/$${codename}.tailscale-keyring.list" |
|
curl -fsSL "https://pkgs.tailscale.com/stable/debian/$${codename}.tailscale-keyring.list" |
|
||||||
sudo tee /etc/apt/sources.list.d/tailscale.list >/dev/null
|
sudo tee /etc/apt/sources.list.d/tailscale.list >/dev/null
|
||||||
apt_get update
|
apt_get update || {
|
||||||
apt_get install -y --no-install-recommends tailscale
|
diagnose_apt_network "APT update failed before installing tailscale" "tailscale"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
apt_get install -y --no-install-recommends tailscale || {
|
||||||
|
diagnose_apt_network "APT package install failed for tailscale" "tailscale"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
sudo systemctl enable --now tailscaled
|
sudo systemctl enable --now tailscaled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue