From 68b993050c8318155ce3da4c9d9657b14fa95a9f Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Tue, 1 Apr 2025 23:55:58 -0500 Subject: [PATCH] [pkgselectprocess] Fix usage of checkpackage-backend If checkpackage-backend does not exist in the target system, likely due to the use of stacked squashfses, ensure it temporarily exists so it can be used in the install process. This fixes installation of the Virtual Machine Manager when selected on the Customize menu (LP: #2104243). --- .../pkgselectprocess/PackageSelectProcess.cpp | 33 ++++++++++++++----- debian/changelog | 5 +++ 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/common/modules/pkgselectprocess/PackageSelectProcess.cpp b/common/modules/pkgselectprocess/PackageSelectProcess.cpp index 407e773..090ecb9 100644 --- a/common/modules/pkgselectprocess/PackageSelectProcess.cpp +++ b/common/modules/pkgselectprocess/PackageSelectProcess.cpp @@ -6,6 +6,7 @@ #include #include #include +#include CALAMARES_PLUGIN_FACTORY_DEFINITION(PackageSelectProcessFactory, registerPlugin();) @@ -359,15 +360,31 @@ Calamares::JobResult PackageSelectProcess::exec() qDebug() << "Progress range: installStart:" << installStart << "installEnd:" << installEnd; if (!debPackages.isEmpty()) { - const QString packageList = debPackages.join(" "); - const QString installCommand = QString("DEBIAN_FRONTEND=noninteractive apt-get -y install $(/usr/libexec/checkpackage-backend %1);").arg(packageList); + const QString checkpackage_path = "/usr/libexec/checkpackage-backend"; + const QString chroot_checkpackage_path = rootMountPoint + checkpackage_path; - Calamares::JobResult installResult = runAptCommand(installCommand, - rootMountPoint, - installStart, - installEnd, - true); - if (!installResult) return std::move(installResult); + // checkpackage-backend needs to be explicitly copied to the chroot + // and removed later for systems with stacked squashfses, or the + // install command will fail. LP: #2104243 + QFile* cpbe = new QFile(chroot_checkpackage_path); + if (!cpbe->exists()) { + QFile* parent_cpbe = new QFile(checkpackage_path); + if (!parent_cpbe->copy(chroot_checkpackage_path)) { + return Calamares::JobResult::error(tr("Internal Error"), + tr("Permission denied when copying checkpackage-backend, are you running Calamares correctly?")); + } + + const QString packageList = debPackages.join(" "); + const QString installCommand = QString("DEBIAN_FRONTEND=noninteractive apt-get -y install $(/usr/libexec/checkpackage-backend %1);").arg(packageList); + + Calamares::JobResult installResult = runAptCommand(installCommand, + rootMountPoint, + installStart, + installEnd, + true); + if (!cpbe->remove()) qDebug() << "Warning: failed to clean up /usr/libexec/checkpackage-backend"; + if (!installResult) return std::move(installResult); + } } else qDebug() << "No packages to install."; diff --git a/debian/changelog b/debian/changelog index 1cd2ea5..93640c0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,11 @@ calamares-settings-ubuntu (1:25.04.24) UNRELEASED; urgency=medium * Bump Standards-Version to 4.7.2, no changes needed. + * [pkgselectprocess] If checkpackage-backend does not exist in the target + system, likely due to the use of stacked squashfses, ensure it temporarily + exists so it can be used in the install process. This fixes installation + of the Virtual Machine Manager when selected on the Customize menu + (LP: #2104243). -- Simon Quigley Wed, 09 Apr 2025 01:55:07 -0500