Compare commits

..
Author SHA1 Message Date
MickLesk 19233948aa update-apps: name the failure when the container leaves no .errinfo
Updates that fail before the engine's error handler (the update helper,
a script fetch, an explicit exit) left no .errinfo, so the report and
telemetry said only 'exit code: 1'. The container's output is now teed
to a temp file and its last error line is appended.
2026-12-05 13:53:51 +01:00
5 changed files with 43 additions and 54 deletions

No files matched your search

-14
View File
@@ -590,20 +590,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
</details>
## 2026-12-05
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes
- UniFi OS Server VM: download the installer on first boot [@MickLesk](https://github.com/MickLesk) ([#19312](https://github.com/community-scripts/ProxmoxVE/pull/19312))
- MySQL: set up the repository with the current signing key [@austinpilz](https://github.com/austinpilz) ([#19305](https://github.com/community-scripts/ProxmoxVE/pull/19305))
- #### 🔧 Refactor
- BunkerWeb: fetch the installer from the release assets [@MickLesk](https://github.com/MickLesk) ([#19310](https://github.com/community-scripts/ProxmoxVE/pull/19310))
- Alpine VM: find the cloud image under its 3.25 name [@MickLesk](https://github.com/MickLesk) ([#19311](https://github.com/community-scripts/ProxmoxVE/pull/19311))
## 2026-12-04
### 🚀 Updated Scripts
+2 -5
View File
@@ -20,12 +20,9 @@ $STD apt install -y \
msg_ok "Installed Dependencies"
RELEASE=$(get_latest_github_release "bunkerity/bunkerweb")
INSTALLER_URL="https://github.com/bunkerity/bunkerweb/releases/download/v${RELEASE}/install-bunkerweb.sh"
confirm_external_installer "install-bunkerweb.sh" "$INSTALLER_URL"
confirm_external_installer "install-bunkerweb.sh" "https://github.com/bunkerity/bunkerweb/raw/v${RELEASE}/misc/install-bunkerweb.sh"
msg_info "Installing BunkerWeb (Patience)"
curl -fsSL -o install-bunkerweb.sh "$INSTALLER_URL"
curl -fsSL -o install-bunkerweb.sh.sha256 "${INSTALLER_URL}.sha256"
$STD sha256sum -c install-bunkerweb.sh.sha256
curl -fsSL -o install-bunkerweb.sh "https://github.com/bunkerity/bunkerweb/raw/v${RELEASE}/misc/install-bunkerweb.sh"
chmod +x install-bunkerweb.sh
$STD ./install-bunkerweb.sh --yes
$STD apt-mark unhold bunkerweb nginx
+15 -6
View File
@@ -625,19 +625,28 @@ for container in $CHOICE; do
# don't fail without a TTY — works for all shells incl. ash (no export -f)
SETUP_CMD="mkdir -p /tmp/.nc; printf '#!/bin/sh\n:\n' > /tmp/.nc/clear; chmod +x /tmp/.nc/clear; export PATH=/tmp/.nc:\$PATH; export TERM=dumb; "
case "$os" in
alpine) pct exec "$container" -- ash -c "${SETUP_CMD}${UPDATE_CMD}" ;;
archlinux) pct exec "$container" -- bash -c "${SETUP_CMD}${UPDATE_CMD}" ;;
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "${SETUP_CMD}${UPDATE_CMD}" ;;
ubuntu | debian | devuan) pct exec "$container" -- bash -c "${SETUP_CMD}${UPDATE_CMD}" ;;
opensuse) pct exec "$container" -- bash -c "${SETUP_CMD}${UPDATE_CMD}" ;;
alpine) update_shell=ash ;;
archlinux | fedora | rocky | centos | alma | ubuntu | debian | devuan | opensuse) update_shell=bash ;;
*) update_shell="" ;;
esac
exit_code=$?
update_out=$(mktemp)
exit_code=0
if [[ -n "$update_shell" ]]; then
pct exec "$container" -- "$update_shell" -c "${SETUP_CMD}${UPDATE_CMD}" 2>&1 | tee "$update_out"
exit_code=${PIPESTATUS[0]}
fi
# The engine in the container leaves what failed in an .errinfo file; without it
# the report says only "exit code: 1".
update_detail=""
if [ $exit_code -ne 0 ]; then
update_detail=$(pct exec "$container" -- sh -c 'f=$(find /root /tmp -maxdepth 1 -name "*.errinfo" -newer /tmp/.cs-update-start 2>/dev/null | head -n1); [ -n "$f" ] || exit 0; m=$(sed -n "s/^MESSAGE=//p" "$f" | head -n1); [ -n "$m" ] || m=$(sed -n "s/^COMMAND=//p" "$f" | head -n1); printf "%s" "$m" | head -c 200' 2>/dev/null || true)
# Failures before the engine's error handler (the helper, a script fetch, an
# explicit exit) leave no .errinfo; the last error line printed says what broke.
if [[ -z "$update_detail" ]]; then
update_detail=$(sed -e 's/\x1b\[[0-9;?]*[a-zA-Z]//g' "$update_out" | tr '\r' '\n' | grep -E '✖|✘|\[ERROR\]|^E: |[Ee]rror' | tail -n1 | sed 's/^[[:space:]]*//' | head -c 200)
fi
fi
rm -f "$update_out"
#5) if build resources are different than run resources, then:
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
+4 -5
View File
@@ -97,19 +97,18 @@ fi
msg_info "Retrieving the URL for the Alpine cloud image"
# Up to 3.24 Alpine published a bios and a uefi variant side by side; this
# script boots through OVMF, so the bios image would never start. From 3.25
# there is one image (no generic_ prefix) that boots both ways.
# Alpine publishes a bios and a uefi variant side by side. This script boots
# through OVMF, so picking the bios image would produce a VM that never starts.
# The release number and the -r revision both live in the filename, so the
# directory has to be listed rather than guessed.
CLOUD_DIR="https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/cloud"
FILE=$(curl -fsSL "${CLOUD_DIR}/" 2>/dev/null | grep -oP 'href="\K(generic_)?alpine-[0-9.]+-x86_64-(uefi-)?cloudinit-r[0-9]+\.qcow2(?=")' | sort -V | tail -1)
FILE=$(curl -fsSL "${CLOUD_DIR}/" 2>/dev/null | grep -oP 'href="\Kgeneric_alpine-[0-9.]+-x86_64-uefi-cloudinit-r[0-9]+\.qcow2(?=")' | sort -V | tail -1)
if [[ -z "$FILE" ]]; then
msg_error "Could not determine the current Alpine cloud image"
exit 1
fi
ALPINE_VERSION=$(echo "$FILE" | grep -oP 'alpine-\K[0-9.]+')
ALPINE_VERSION=$(echo "$FILE" | grep -oP 'generic_alpine-\K[0-9.]+')
msg_ok "Alpine ${CL}${BL}${ALPINE_VERSION}${CL} ${GN}(${FILE})"
URL="${CLOUD_DIR}/${FILE}"
+22 -24
View File
@@ -249,8 +249,14 @@ cp -f "$CACHE_FILE" "$FILE"
# Resize the imported disk with vm_resize_disk; Cloud-Init grows the actual root
# filesystem before the first-boot installer runs, without another offline copy.
# --- Download UniFi OS installer on the host ---
msg_info "Downloading UniFi OS Server ${UOS_VERSION} installer"
curl -fsSL "${UOS_URL}" -o "unifi-os-server.bin"
chmod +x "unifi-os-server.bin"
msg_ok "Downloaded UniFi OS Server installer"
# --- Pre-install packages and setup first-boot installer ---
msg_info "Customizing disk image (installing packages, first-boot installer)"
msg_info "Customizing disk image (installing packages, staging installer)"
# Create the first-boot installer script
FIRSTBOOT_SCRIPT="$TEMP_DIR/unifi-os-firstboot.sh"
@@ -326,25 +332,16 @@ if [ ! -f /swapfile ]; then
echo "[$(date)] Swap file created"
fi
# The installer (~800 MB) does not fit the cloud image's root filesystem
# before Cloud-Init has grown it, so it is fetched here
echo "[$(date)] Downloading UniFi OS Server installer..."
for attempt in {1..3}; do
if curl -fsSL --retry 3 -o /opt/unifi-os-server.bin "$(cat /opt/unifi-os-server.url)"; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "[$(date)] Installer download failed after 3 attempts"
exit 1
fi
echo "[$(date)] Installer download failed (attempt $attempt/3), retrying in 10s..."
sleep 10
done
chmod +x /opt/unifi-os-server.bin
cd /opt
./unifi-os-server.bin <<<'y'
rm -f /opt/unifi-os-server.bin /opt/unifi-os-server.url
echo "[$(date)] UniFi OS Server installed successfully"
# Run UniFi OS installer
if [ -f /opt/unifi-os-server.bin ]; then
cd /opt
./unifi-os-server.bin <<<'y'
rm -f /opt/unifi-os-server.bin
echo "[$(date)] UniFi OS Server installed successfully"
else
echo "[$(date)] ERROR: /opt/unifi-os-server.bin not found"
exit 1
fi
echo "[$(date)] First-boot setup complete"
FBEOF
@@ -352,17 +349,18 @@ FBEOF
vm_prepare_cloud_image "$FILE" "$HN"
vm_customize "UniFi OS installer" "$FILE" \
--write "/opt/unifi-os-server.url:${UOS_URL}" \
--upload "unifi-os-server.bin:/opt/unifi-os-server.bin" \
--chmod 0755:/opt/unifi-os-server.bin \
--run-command "systemctl enable ssh" || exit 1
vm_firstboot_unit "$FILE" "unifi-os-firstboot" "$FIRSTBOOT_SCRIPT" \
--description "UniFi OS Server First Boot Installer" \
--after qemu-guest-agent.service \
--requires-path /opt/unifi-os-server.url \
--requires-path /opt/unifi-os-server.bin \
--cloud-init yes || exit 1
rm -f "$FIRSTBOOT_SCRIPT"
msg_ok "Disk image customized (UniFi OS ${UOS_VERSION} installs on first boot)"
rm -f "$FIRSTBOOT_SCRIPT" "unifi-os-server.bin"
msg_ok "Disk image customized (UniFi OS ${UOS_VERSION} staged for first-boot install)"
vm_claim_vmid
msg_info "Creating UniFi OS VM"