[PATCH 2/2] Allow cdrom-swapping when doing "inst.ks=cdrom[:...]"
wwoods at redhat.com
Thu Sep 25 21:06:25 UTC 2014
Apparently this is a thing: some people do installs in secure
environments where they have no network and aren't allowed to use USB
devices; all they can use is optical media. So they have the install
disc, and another cdrom that contains their kickstart.
So: the user boots the install DVD with "inst.ks=cdrom[:/path/ks.cfg]",
and once udev notices the disc we run both fetch-kickstart-disk and
Normally, anaconda-diskroot would mount the installer DVD here, but we
need to be able to eject it, so anaconda-diskroot instead ignores it and
Meanwhile, fetch-kickstart-disk tries to grab the kickstart and fails
(because we're looking at the install DVD!), so it asks the user to
insert the CDROM containing the kickstart.
So: when the user ejects the DVD and inserts their kickstart CD,
fetch-kickstart-disk will fetch the kickstart and ask for the install
Finally, the user re-inserts the DVD, anaconda-diskroot mounts it, and
off we go!
¹I'm assuming the ordering is undefined. It might be predictable in
reality but it's probably better if we don't rely on that.
dracut/anaconda-diskroot | 11 +++++++++++
dracut/fetch-kickstart-disk | 15 +++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dracut/anaconda-diskroot b/dracut/anaconda-diskroot
index 2df6248..36fd49e 100755
@@ -35,6 +35,17 @@ path="$2" # optional, could be empty
[ -e "/dev/root" ] && exit 1 # we already have a root device!
+# If we're waiting for a cdrom kickstart, the user might need to swap discs.
+# So if this is a CDROM drive, make a note of it, but don't mount it (yet).
+# Once we get the kickstart either the udev trigger or disk-reinsertion will
+# retrigger this script, and we'll mount the disk as normal.
+if str_starts "$kickstart" "cdrom" && [ ! -e /tmp/ks.cfg.done ]; then
+ if dev_is_cdrom "$dev"; then
+ > /tmp/anaconda-on-cdrom
+ exit 0
info "anaconda using disk root at $dev"
mount $dev $repodir || warn "Couldn't mount $dev"
anaconda_live_root_dir $repodir $path
diff --git a/dracut/fetch-kickstart-disk b/dracut/fetch-kickstart-disk
index d9ead33..37a1050 100755
@@ -14,16 +14,27 @@ info "anaconda: fetching kickstart from $dev:$path"
if [ -n "$mnt" ]; then
- cp $mnt$path /tmp/ks.cfg
+ cp $mnt$path /tmp/ks.cfg 2>&1
tmpmnt="$(mkuniqdir /run/install tmpmnt)"
if mount -o ro $dev $tmpmnt; then
- cp $tmpmnt/$path /tmp/ks.cfg
+ cp $tmpmnt/$path /tmp/ks.cfg 2>&1
+# if we're waiting for a cdrom kickstart, tell the user so they can swap discs
+if str_starts "$kickstart" "cdrom"; then
+ if [ ! -f /tmp/ks.cfg ]; then
+ tell_user "Please insert CDROM containing '$path'..."
+ exit 0
+ elif [ -f /tmp/anaconda-on-cdrom ]; then
+ tell_user "Kickstart loaded. Please re-insert installation media."
if [ -f /tmp/ks.cfg ]; then
More information about the anaconda-patches