diff --git a/install/install.py b/install/install.py index 3df2263bc..384aeb76f 100644 --- a/install/install.py +++ b/install/install.py @@ -353,7 +353,7 @@ class preFlightsChecks: # These packages from MariaDB 12.1 can conflict with MariaDB 10.11 self.stdOut("Removing conflicting MariaDB compat packages...", 1) try: - # Remove MariaDB-server-compat packages that conflict with MariaDB 10.11 + subprocess.run("rpm -e --nodeps MariaDB-server-compat-12.1.2-1.el9.noarch 2>/dev/null; true", shell=True, timeout=30) subprocess.run("dnf remove -y 'MariaDB-server-compat*' 2>/dev/null || true", shell=True, timeout=60) r = subprocess.run("rpm -qa 2>/dev/null | grep -i MariaDB-server-compat", shell=True, capture_output=True, text=True, timeout=30) for line in (r.stdout or "").strip().splitlines(): @@ -1815,6 +1815,7 @@ module cyberpanel_ols { # These packages from MariaDB 12.1 can conflict with MariaDB 10.11 self.stdOut("Removing conflicting MariaDB compat packages...", 1) try: + subprocess.run("rpm -e --nodeps MariaDB-server-compat-12.1.2-1.el9.noarch 2>/dev/null; true", shell=True, timeout=30) subprocess.run("dnf remove -y 'MariaDB-server-compat*' 2>/dev/null || true", shell=True, timeout=60) r = subprocess.run("rpm -qa 2>/dev/null | grep -i MariaDB-server-compat", shell=True, capture_output=True, text=True, timeout=30) for line in (r.stdout or "").strip().splitlines(): @@ -6441,6 +6442,7 @@ def main(): # This package conflicts with MariaDB 10.11 and must be removed early preFlightsChecks.stdOut("Removing conflicting MariaDB-server-compat packages...", 1) try: + subprocess.run("rpm -e --nodeps MariaDB-server-compat-12.1.2-1.el9.noarch 2>/dev/null; true", shell=True, timeout=30) subprocess.run("dnf remove -y 'MariaDB-server-compat*' 2>/dev/null || true", shell=True, timeout=60) r = subprocess.run("rpm -qa 2>/dev/null | grep -i MariaDB-server-compat", shell=True, capture_output=True, text=True, timeout=30) for line in (r.stdout or "").strip().splitlines(): diff --git a/install/install_utils.py b/install/install_utils.py index 5976ad0e4..5549550fc 100644 --- a/install/install_utils.py +++ b/install/install_utils.py @@ -556,6 +556,11 @@ def call(command, distro, bracket, message, log=0, do_exit=0, code=os.EX_OK, she os._exit(code) return False + # CRITICAL: Use shell=True for commands with shell metacharacters + # Avoids "No matching repo to modify: 2>/dev/null, true, ||" when shlex.split splits them + if not shell and any(x in command for x in (' || ', ' 2>/dev', ' 2>', ' | ', '; true', '|| true')): + shell = True + # CRITICAL: For mysql/mariadb commands, always use shell=True and full binary path # This fixes "No such file or directory: 'mysql'" when run via shlex.split if not shell and ('mysql' in command or 'mariadb' in command): diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 5052e0c48..9a1ff2353 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -4299,6 +4299,19 @@ echo $oConfig->Save() ? 'Done' : 'Error'; Upgrade.stdOut("Applying AlmaLinux 9 MariaDB fixes...", 1) try: + # CRITICAL: Remove MariaDB-server-compat* before any MariaDB install (conflicts with 10.11) + Upgrade.stdOut("Removing conflicting MariaDB-server-compat packages...", 1) + try: + subprocess.run("rpm -e --nodeps MariaDB-server-compat-12.1.2-1.el9.noarch 2>/dev/null; true", shell=True, timeout=30) + subprocess.run("dnf remove -y 'MariaDB-server-compat*' 2>/dev/null || true", shell=True, timeout=60) + r = subprocess.run("rpm -qa 2>/dev/null | grep -i MariaDB-server-compat", shell=True, capture_output=True, text=True, timeout=30) + for line in (r.stdout or "").strip().splitlines(): + pkg = (line.strip().split() or [""])[0] + if pkg and "MariaDB-server-compat" in pkg: + subprocess.run(["rpm", "-e", "--nodeps", pkg], timeout=30) + except Exception as e: + Upgrade.stdOut("Warning: compat cleanup: " + str(e), 0) + # Disable problematic MariaDB MaxScale repository Upgrade.stdOut("Disabling problematic MariaDB MaxScale repository...", 1) command = "dnf config-manager --disable mariadb-maxscale 2>/dev/null || true" @@ -4320,9 +4333,9 @@ echo $oConfig->Save() ? 'Done' : 'Error'; command = "dnf clean all" subprocess.run(command, shell=True, capture_output=True) - # Install MariaDB from official repository + # Install MariaDB 10.11 from official repository (avoid 12.1 compat conflicts) Upgrade.stdOut("Setting up official MariaDB repository...", 1) - command = "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='12.1'" + command = "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='10.11'" result = subprocess.run(command, shell=True, capture_output=True, text=True) if result.returncode != 0: Upgrade.stdOut(f"Warning: MariaDB repo setup failed: {result.stderr}", 0)