scripts/pvics: Fix virt-resize permission error

Although the script is to be run with root privileges virt-resize starts
as user qemu under the hood which depending on image location may cause
permission errors. To fix this use `LIBGUESTFS_BACKEND=direct`.

Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Finn Callies <fcallies@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Finn Callies
2026-06-22 07:47:14 +02:00
committed by Jan Höppner
parent 6689e25865
commit dc42460d82

View File

@@ -1329,7 +1329,7 @@ encrypt() {
# Increase partition size by 32MiB as well, but not the file system, as the LUKS2 encryption is around the filesystem
image_resized="${TEMP_DIR}/resized.qcow2"
execute cp "${image}" "${image_resized}"
execute virt-resize --expand "/dev/vda${ROOT_PARTNUM}" --no-expand-content "${image}" "${image_resized}"
execute env -S LIBGUESTFS_BACKEND=direct virt-resize --expand "/dev/vda${ROOT_PARTNUM}" --no-expand-content "${image}" "${image_resized}"
# Remove smaller image, as we already made a copy
execute rm -f "${image}"
image="${image_resized}"