From dd7a659f227d2ab4d1904fc4e481e4062210b4ff Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:26:23 +0100 Subject: [PATCH] homebrew: skip service accounts when picking the user, survive a failed apt update (#18424) The user was the first passwd entry with a UID from 1000 up. On a Proxmox host with Ceph that is ceph (UID 64045, shell nologin), and su - ceph fails with "This account is currently not available". Accounts without a login shell are skipped now. apt update on a host with the enterprise repository and no subscription exits 100 on the 401. apt_update_safe retries, says why and carries on, as the other scripts already do since #17462. --- tools/addon/homebrew.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/addon/homebrew.sh b/tools/addon/homebrew.sh index e4e4e5fa0..b1cae8a11 100644 --- a/tools/addon/homebrew.sh +++ b/tools/addon/homebrew.sh @@ -42,7 +42,7 @@ require_debian_like function uninstall() { msg_info "Uninstalling Homebrew" - BREW_USER=$(awk -F: '$3 >= 1000 && $3 < 65534 { print $1; exit }' /etc/passwd) + BREW_USER=$(awk -F: '$3 >= 1000 && $3 < 65534 && $7 !~ /(nologin|false)$/ { print $1; exit }' /etc/passwd) if [[ -n "$BREW_USER" ]]; then BREW_USER_HOME=$(getent passwd "$BREW_USER" | cut -d: -f6) for rc_file in "$BREW_USER_HOME/.bashrc" "$BREW_USER_HOME/.profile"; do @@ -64,7 +64,7 @@ function uninstall() { # ============================================================================== function install() { msg_info "Detecting Non-Root User" - BREW_USER=$(awk -F: '$3 >= 1000 && $3 < 65534 { print $1; exit }' /etc/passwd) + BREW_USER=$(awk -F: '$3 >= 1000 && $3 < 65534 && $7 !~ /(nologin|false)$/ { print $1; exit }' /etc/passwd) if [[ -z "$BREW_USER" ]]; then msg_warn "No non-root user found (uid >= 1000). Homebrew cannot run as root." read -r -p "${TAB}Create a 'brew' user automatically? (y/N): " create_user_prompt @@ -81,7 +81,7 @@ function install() { msg_ok "Detected User: $BREW_USER" msg_info "Installing Dependencies" - $STD apt update + apt_update_safe $STD apt install -y build-essential git file procps msg_ok "Installed Dependencies"