From 5ff70d500028e850227a71d02fa176a9ea829901 Mon Sep 17 00:00:00 2001 From: nabeya11 Date: Mon, 27 Jul 2026 14:53:36 +0900 Subject: [PATCH 1/2] Generate ignoredisk/clearpart in %pre from disks present on the machine Anaconda raises KickstartParseError when a disk listed in "ignoredisk --only-use" or "clearpart --drives" does not exist, so a single DISK_DEVS value could not cover machines with different disk layouts. Build the two commands in %pre from the DISK_DEVS entries that actually exist and pull them in via %include, making DISK_DEVS a list of candidate disks. Co-Authored-By: Claude Fable 5 --- README.md | 2 +- ks.tpl.cfg | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8d54f78..6c92fe4 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ Directory | Files | Note ### Generate installer ISO ```shell -export DISK_DEVS=sda,sdb # System has /dev/sda and /dev/sdb +export DISK_DEVS=sda,sdb # Disks usable by the installer; ones not present on the machine are skipped export MAIN_DISK=sda # Install OS to /dev/sda export PARTSIZE_DOCKER=8192 # 8G export PARTSIZE_LOG=2048 # 2G diff --git a/ks.tpl.cfg b/ks.tpl.cfg index ee5ef6e..ad1c3fd 100644 --- a/ks.tpl.cfg +++ b/ks.tpl.cfg @@ -7,7 +7,8 @@ cmdline reboot # Run the Setup Agent on first boot firstboot --disable -ignoredisk --only-use=@@DISK_DEVS@@ +# ignoredisk/clearpart with the disks existing on this machine, generated in %pre +%include /tmp/ks.diskdevs.cfg # Keyboard layouts keyboard --vckeymap=us --xlayouts='jp' # System language @@ -25,8 +26,6 @@ group --name=docker %include /tmp/ks.media.cfg -# Partition clearing information -clearpart --all --initlabel --drives=@@DISK_DEVS@@ # Create partitions part /boot/efi --fstype="efi" --ondisk=@@MAIN_DISK@@ --size=200 --fsoptions="umask=0077,shortname=winnt" part / --fstype="ext4" --ondisk=@@MAIN_DISK@@ --size=2048 --mkfsoptions="-U 64eb4db5-3385-46a5-a3d5-c48197a53555" @@ -59,6 +58,22 @@ else echo "url --url http://172.16.250.1/iso" > /tmp/ks.media.cfg fi +# Pick only the disks that exist on this machine +diskdevs= +for dev in $(echo @@DISK_DEVS@@ | tr "," " ") +do + if [ -b /dev/${dev} ] + then + diskdevs="${diskdevs:+${diskdevs},}${dev}" + else + echo "disk ${dev} not found, skipped" + fi +done +cat > /tmp/ks.diskdevs.cfg < Date: Wed, 29 Jul 2026 17:17:17 +0900 Subject: [PATCH 2/2] Log when no disks in DISK_DEVS are found and quote device path Co-Authored-By: Claude Fable 5 --- ks.tpl.cfg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ks.tpl.cfg b/ks.tpl.cfg index ad1c3fd..48048d3 100644 --- a/ks.tpl.cfg +++ b/ks.tpl.cfg @@ -62,13 +62,17 @@ fi diskdevs= for dev in $(echo @@DISK_DEVS@@ | tr "," " ") do - if [ -b /dev/${dev} ] + if [ -b "/dev/${dev}" ] then diskdevs="${diskdevs:+${diskdevs},}${dev}" else echo "disk ${dev} not found, skipped" fi done +if [ -z "${diskdevs}" ] +then + echo "no disks in DISK_DEVS (@@DISK_DEVS@@) found" +fi cat > /tmp/ks.diskdevs.cfg <