mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-27 19:07:49 +03:00
Compare commits
1 Commits
github-act
...
fix/apt-up
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8fcc067d7 |
@@ -4917,7 +4917,8 @@ create_lxc_container() {
|
||||
case "${_ans,,}" in
|
||||
y | yes)
|
||||
msg_info "Upgrading Proxmox LXC stack (pve-container, lxc-pve)"
|
||||
if $STD apt-get update && $STD apt-get install -y --only-upgrade pve-container lxc-pve; then
|
||||
apt_update_safe
|
||||
if $STD apt-get install -y --only-upgrade pve-container lxc-pve; then
|
||||
msg_ok "LXC stack upgraded."
|
||||
if [[ "$do_retry" == "yes" ]]; then
|
||||
msg_info "Retrying container creation after upgrade"
|
||||
|
||||
@@ -551,6 +551,53 @@ silent() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# apt_update_safe()
|
||||
#
|
||||
# - Runs apt-get update with graceful error handling
|
||||
# - On failure: shows warning with common causes instead of aborting
|
||||
# - Logs full output to active log file
|
||||
# - Returns 0 even on failure so the caller can continue
|
||||
# - Typical cause: enterprise repos returning 401 Unauthorized
|
||||
#
|
||||
# Usage:
|
||||
# apt_update_safe # Warn on failure, continue without aborting
|
||||
# ------------------------------------------------------------------------------
|
||||
apt_update_safe() {
|
||||
local logfile
|
||||
logfile="$(get_active_logfile)"
|
||||
|
||||
local _restore_errexit=false
|
||||
[[ "$-" == *e* ]] && _restore_errexit=true
|
||||
|
||||
set +Eeuo pipefail
|
||||
trap - ERR
|
||||
|
||||
apt-get update >>"$logfile" 2>&1
|
||||
local rc=$?
|
||||
|
||||
if $_restore_errexit; then
|
||||
set -Eeuo pipefail
|
||||
trap 'error_handler' ERR
|
||||
fi
|
||||
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
msg_warn "apt-get update exited with code ${rc} — some repositories may have failed."
|
||||
|
||||
# Check log for common 401/403 enterprise repo issues
|
||||
if grep -qiE '401\s*Unauthorized|403\s*Forbidden|enterprise\.proxmox\.com' "$logfile" 2>/dev/null; then
|
||||
echo -e "${TAB}${INFO} ${YWB}Hint: Proxmox enterprise repository returned an auth error.${CL}"
|
||||
echo -e "${TAB} If you don't have a subscription, you can disable the enterprise"
|
||||
echo -e "${TAB} repo and use the no-subscription repo instead."
|
||||
fi
|
||||
|
||||
echo -e "${TAB}${INFO} ${YWB}Continuing despite partial update failure — packages may still be installable.${CL}"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# spinner()
|
||||
#
|
||||
|
||||
@@ -233,7 +233,7 @@ fi
|
||||
EOF
|
||||
chmod +x /usr/local/bin/apt-proxy-detect.sh
|
||||
fi
|
||||
$STD apt-get update
|
||||
apt_update_safe
|
||||
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade
|
||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||
msg_ok "Updated Container OS"
|
||||
|
||||
Reference in New Issue
Block a user