From 30b3e5497bafc93ae4a2f789b531a38eeac0a9a2 Mon Sep 17 00:00:00 2001 From: FrankiePustorino <79408426+FrankiePustorino@users.noreply.github.com> Date: Mon, 4 May 2026 22:37:23 +0200 Subject: [PATCH 1/2] SKIP_PPA_LAUNCHPAD due to launchpad extended DDOS attack Key Changes Made: Added global flag: SKIP_PPA_LAUNCHPAD=0 at the top of the script New function: APT_UPDATE_WITH_SKIP() - Handles apt update with optional skipping of ppa.launchpad.net Creates a temporary apt configuration to skip ppa.launchpad.net Filters out error messages related to the skipped repository Provides clear user feedback about what's happening Updated MAINTENANCE() function: Now calls APT_UPDATE_WITH_SKIP instead of direct apt update New command-line option: --skip-ppa-launchpad Can be combined with other options (or used alone) Added to help text with clear explanation Updated SHOW_HELP(): Includes documentation for the new flag # Normal maintenance (apt update includes all repos) sudo ucaresystem-core # Skip ppa.launchpad.net during apt update sudo ucaresystem-core --skip-ppa-launchpad # Skip ppa.launchpad.net and then reboot sudo ucaresystem-core --skip-ppa-launchpad -r # Skip ppa.launchpad.net with debug sudo ucaresystem-core --skip-ppa-launchpad -x --- src/ucaresystem-core | 87 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 14 deletions(-) diff --git a/src/ucaresystem-core b/src/ucaresystem-core index 2882825..1f72d8a 100755 --- a/src/ucaresystem-core +++ b/src/ucaresystem-core @@ -21,6 +21,9 @@ set -e SECONDS=0 ## Script starts here +# Global flag for skipping ppa.launchpad +SKIP_PPA_LAUNCHPAD=0 + # Color Variables GREEN="\e[32m" CYAN="\e[36m" @@ -320,6 +323,65 @@ function PREUPDATE_PREFLIGHT { return 0 } +# Function to perform apt update with optional PPA skipping +function APT_UPDATE_WITH_SKIP { + echo -e "${GREEN}▸ Updating package lists ${ENDCOLOR}" + echo + + if [ "$SKIP_PPA_LAUNCHPAD" -eq 1 ]; then + echo -e "${YELLOW}⚠ Skipping ppa.launchpad.net repositories due to --skip-ppa-launchpad flag${ENDCOLOR}" + echo -e "${YELLOW} (Useful when Launchpad is under attack or experiencing issues)${ENDCOLOR}" + echo + + # Create a temporary apt configuration that disables ppa.launchpad sources + local temp_apt_conf=$(mktemp) + + # Write apt configuration to skip failing PPAs + cat > "$temp_apt_conf" << 'EOF' +# Temporary apt configuration to skip ppa.launchpad.net +Acquire::http::Timeout "10"; +Acquire::https::Timeout "10"; +Acquire::http::Pipeline-Depth "0"; +Acquire::Retries "3"; +# Disable specific hosts +Acquire::http::No-Cache "ppa.launchpad.net"; +Acquire::https::No-Cache "ppa.launchpad.net"; +# Skip these hosts entirely +Acquire::http::No-Store "ppa.launchpad.net"; +Acquire::https::No-Store "ppa.launchpad.net"; +EOF + + # Run apt update with the temporary configuration + sudo apt -o Dir::Etc::SourceList=/etc/apt/sources.list \ + -o Dir::Etc::SourceParts=/etc/apt/sources.list.d \ + -c "$temp_apt_conf" update 2>&1 | \ + grep -v "ppa.launchpad.net" | \ + grep -v "Failed to fetch" | \ + grep -v "Unable to connect to" | \ + while IFS= read -r line; do + printf '%-*s\r' "$(tput cols)" "$line" + done + + # Clean up temporary config + rm -f "$temp_apt_conf" + + echo + echo -e "${YELLOW}⚠ Note: ppa.launchpad.net repositories were skipped${ENDCOLOR}" + echo -e "${YELLOW} You can restore them by removing the --skip-ppa-launchpad flag${ENDCOLOR}" + else + # Normal apt update + sudo apt update 2> >(grep -v "^WARNING" >&2) | + while IFS= read -r line; do + printf '%-*s\r' "$(tput cols)" "$line" + done + fi + + echo + echo -e "${CYAN}✓ Finished updating package lists ${ENDCOLOR}" + sleep 1 + echo +} + # Function to handle kernel cleanup function CLEANUP_OLD_KERNELS { local keep_count=${1:-2} # Default to keeping 2 kernels if not specified @@ -400,20 +462,9 @@ function MAINTENANCE { echo fi fi - ## Updates package lists - echo -e "${GREEN}▸ Updating package lists ${ENDCOLOR}" - echo - # Update package lists and filter out warnings - sudo apt update 2> >(grep -v "^WARNING" >&2) | - # Print each line with padding to fit the terminal width - while IFS= read -r line; do - printf '%-*s\r' "$(tput cols)" "$line" - done - echo - echo - echo -e "${CYAN}✓ Finished updating package lists ${ENDCOLOR}" - sleep 1 - echo + + ## Updates package lists (using enhanced function) + APT_UPDATE_WITH_SKIP ## Updates packages and libraries echo -e "${GREEN}▸ Installing system package upgrades...${ENDCOLOR}" @@ -911,6 +962,10 @@ function SHOW_HELP { -x --debug Enable debug mode (shell tracing) + --skip-ppa-launchpad + Skip ppa.launchpad.net repositories during apt update + (Useful when Launchpad is under attack or experiencing issues) + -u --upgrade Upgrade to the next Ubuntu release. Note: If you use a regular release it will upgrade to the next one. If you are on a LTS version, it will upgrade ONLY to @@ -1008,6 +1063,10 @@ while [ "$1" != "" ]; do shift continue ;; + --skip-ppa-launchpad ) SKIP_PPA_LAUNCHPAD=1 + shift + continue + ;; -u | --upgrade ) ENABLE_DEBUG && WELCOME_SCREEN && PREUPDATE_PREFLIGHT && MAINTENANCE && UPGRADE_TO_NEXT_RELEASE exit ;; From 2948eff4b7e588a653685eb1c52d0f39051a93db Mon Sep 17 00:00:00 2001 From: FrankiePustorino <79408426+FrankiePustorino@users.noreply.github.com> Date: Mon, 4 May 2026 22:49:35 +0200 Subject: [PATCH 2/2] Emergency change due to ppa.launchpad issue global outage Key Changes Made: Fixed the incomplete function - All functions are now properly closed with } Improved APT_UPDATE_WITH_SKIP function - Now uses a safer approach: Temporarily moves PPA files containing "launchpad" to a backup directory Runs apt update without those PPAs Restores the PPAs after the update completes This ensures Launchpad PPAs are only skipped temporarily Added proper error handling - The script now properly handles cases where PPA files might not exist # Normal maintenance (includes all PPAs) sudo ucaresystem-core # Skip Launchpad PPAs (useful during attacks/outages) sudo ucaresystem-core --skip-ppa-launchpad # Skip Launchpad PPAs and then reboot sudo ucaresystem-core --skip-ppa-launchpad -r # Combine with debug mode sudo ucaresystem-core --skip-ppa-launchpad -x --- src/ucaresystem-core | 76 +++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/src/ucaresystem-core b/src/ucaresystem-core index 1f72d8a..64dad83 100755 --- a/src/ucaresystem-core +++ b/src/ucaresystem-core @@ -333,41 +333,54 @@ function APT_UPDATE_WITH_SKIP { echo -e "${YELLOW} (Useful when Launchpad is under attack or experiencing issues)${ENDCOLOR}" echo - # Create a temporary apt configuration that disables ppa.launchpad sources - local temp_apt_conf=$(mktemp) + # Run apt update but exclude ppa.launchpad.net by temporarily moving .list files + local temp_dir=$(mktemp -d) - # Write apt configuration to skip failing PPAs - cat > "$temp_apt_conf" << 'EOF' -# Temporary apt configuration to skip ppa.launchpad.net -Acquire::http::Timeout "10"; -Acquire::https::Timeout "10"; -Acquire::http::Pipeline-Depth "0"; -Acquire::Retries "3"; -# Disable specific hosts -Acquire::http::No-Cache "ppa.launchpad.net"; -Acquire::https::No-Cache "ppa.launchpad.net"; -# Skip these hosts entirely -Acquire::http::No-Store "ppa.launchpad.net"; -Acquire::https::No-Store "ppa.launchpad.net"; -EOF + # Find and move PPA files that contain launchpad + echo -e "${YELLOW}▸ Temporarily disabling Launchpad PPAs...${ENDCOLOR}" + find /etc/apt/sources.list.d/ -name "*launchpad*" -type f 2>/dev/null | while read ppa_file; do + if [ -f "$ppa_file" ]; then + sudo mv "$ppa_file" "$temp_dir/" 2>/dev/null && echo " • Disabled: $(basename "$ppa_file")" + fi + done + + # Also check sources.list for launchpad entries (less common but possible) + if grep -q "launchpad" /etc/apt/sources.list 2>/dev/null; then + sudo cp /etc/apt/sources.list "$temp_dir/sources.list.backup" + sudo sed -i '/launchpad/d' /etc/apt/sources.list + echo " • Disabled launchpad entries in sources.list" + fi - # Run apt update with the temporary configuration - sudo apt -o Dir::Etc::SourceList=/etc/apt/sources.list \ - -o Dir::Etc::SourceParts=/etc/apt/sources.list.d \ - -c "$temp_apt_conf" update 2>&1 | \ - grep -v "ppa.launchpad.net" | \ - grep -v "Failed to fetch" | \ - grep -v "Unable to connect to" | \ - while IFS= read -r line; do - printf '%-*s\r' "$(tput cols)" "$line" - done + echo + echo -e "${YELLOW}▸ Running apt update with Launchpad PPAs disabled...${ENDCOLOR}" - # Clean up temporary config - rm -f "$temp_apt_conf" + # Run apt update + sudo apt update 2> >(grep -v "^WARNING" >&2) | + while IFS= read -r line; do + printf '%-*s\r' "$(tput cols)" "$line" + done echo - echo -e "${YELLOW}⚠ Note: ppa.launchpad.net repositories were skipped${ENDCOLOR}" - echo -e "${YELLOW} You can restore them by removing the --skip-ppa-launchpad flag${ENDCOLOR}" + echo -e "${YELLOW}▸ Restoring disabled Launchpad PPAs...${ENDCOLOR}" + + # Restore moved PPA files + if [ -d "$temp_dir" ] && [ -n "$(ls -A "$temp_dir" 2>/dev/null)" ]; then + sudo mv "$temp_dir"/* /etc/apt/sources.list.d/ 2>/dev/null + echo " • Restored all Launchpad PPAs" + fi + + # Restore sources.list if modified + if [ -f "$temp_dir/sources.list.backup" ]; then + sudo mv "$temp_dir/sources.list.backup" /etc/apt/sources.list + echo " • Restored sources.list" + fi + + # Clean up temp directory + rm -rf "$temp_dir" + + echo + echo -e "${YELLOW}⚠ Note: ppa.launchpad.net repositories were temporarily skipped${ENDCOLOR}" + echo -e "${YELLOW} They have been restored and will be used in future runs${ENDCOLOR}" else # Normal apt update sudo apt update 2> >(grep -v "^WARNING" >&2) | @@ -692,8 +705,7 @@ function UPGRADE_EOL_TO_NEXT { if [ ! -f /etc/os-release ]; then echo -e "${RED}✗ Cannot detect distribution${ENDCOLOR}" return 1 - fi - + fi # shellcheck disable=SC1091 . /etc/os-release