KickStart and ejecting a DVD

General support questions
Post Reply
bthomson
Posts: 2
Joined: 2018/09/18 16:07:50

KickStart and ejecting a DVD

Post by bthomson » 2018/09/19 13:05:15

This question is directly related to this thread:
viewtopic.php?t=61663
But since that thread is marked solved I figured it's better to start a new thread.

I'm in the process of porting a CentOS 6 system to CentOS 7, and I'm looking for someone with more kickstart experience to help me figure out an issue.

In the referenced thread, in order to eject the DVD at the end of the kickstart script they recommended "reboot --eject". However, this is not sufficient for my use. On many machines the DVD is sucked back in when the machine reboots, and the installation process repeats.

In our CentOS 6 system the ks.cfg used the plain "reboot" command. But in the %post section we ejected the DVD and prompted the user to "Press enter to continue" as follows:

Code: Select all

	%post

	eject
	exec < /dev/tty3 > /dev/tty3 2>&1
	chvt 3
	continue="no"
	clear
	echo 'Remove DVD and press Enter to reboot'
	read KEY
	chvt 1

	%end
This gave the user time to remove the DVD, and then press enter. At which point kickstart resumed and rebooted the machine.

However in CentOS 7 this fails. The DVD does eject, but upon completing the %post section and returning to terminal 1 it looks like anaconda has crashed. Either I get a "Pane is Dead" error, or the system simply hangs with no error.

I tried to replace "reboot" with "poweroff". The problem then is that the user now has to remove the DVD from a powered down machine before restarting. (with a paper clip?) ... Not very user friendly!

I've tried different formatting of this post block ... like :

Code: Select all

	exec < /dev/tty3 > /dev/tty3
	chvt 3
	(
		eject
		exec < /dev/tty3 > /dev/tty3 2>&1
		chvt 3
		continue="no"
		clear
		echo 'Remove DVD and press Enter to reboot'
		read KEY
		chvt 1
	) 2>&1
	exit 0
I've tried putting the eject in an external script, althought the user prompt was not working ...
I tried closing stderr and stdout with "exec 2<&-" and "exec 1<&-".

Everything I tried fails in the same way.

So, my question:

Is there something mal-formated with my %post section above? I'm a bit confused as this used to work reliably in CentOS 6. Any pointers would be greatly appreciated.

Please note that I'm very much a noob in this area, so please speak slowly and use small words for me ... ;-)

TIA!
- Bob

The following is my test ks.cfg:

Code: Select all

	install
	text
	cdrom
	lang en_US.UTF-8
	keyboard us
	timezone UTC
	auth --enableshadow --passalgo=sha512
	selinux --enforcing
	eula --agreed
	firstboot --disable

	zerombr
	clearpart --all --initlabel
	part /boot --fstype=ext4 --size=500    --ondisk=sda
	part /     --fstype=ext4 --size=10000  --ondisk=sda
	part swap  --fstype=swap --size=1000   --ondisk=sda
	bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"

	rootpw my_root_password
	user --name my_user --password my_user_password --plaintext

	network --onboot no

	#reboot --eject
	poweroff

	%packages

	@core

	## I removed most of the packages just to make testing faster ##

	%end


	%post --nochroot

	## copy in product specific files ##
	mkdir -p /mnt/sysimage/install_tmp/Product
	cp -R /run/install/repo/product/* /mnt/sysimage/install_tmp/Product
	cp /tmp/*log /mnt/sysimage/install_tmp

	%end


	%post

	LOG=/tmp/postlog
	echo "====   Post Installation log   ==== " > $LOG

	## a bunch of product specific configuration removed ##

	eject
	exec < /dev/tty3 > /dev/tty3 2>&1
	chvt 3
	continue="no"
	clear
	echo 'Remove DVD and press Enter to reboot'
	read KEY
	chvt 1

	%end

Also, If it matters:
uname -rmi
3.10.0-862.el7.x86_64 x86_64 x86_64

rpm -qa \*-release\*
centos-release-7-5.1804.el7.centos.x86_64

cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

bthomson
Posts: 2
Joined: 2018/09/18 16:07:50

Re: KickStart and ejecting a DVD

Post by bthomson » 2018/09/19 15:30:27

One further observation.

I removed the "eject" command from the %post section and kept the "reboot --eject", When I got the "press enter to continue" prompt, I pressed enter but did not remove the DVD ... and everything worked fine (other than having to grab the DVD quick before the tray closes).

I then tried it again, but upon getting the "press enter to continue" prompt I did manually eject and remove the DVD ... this time after pressing enter I got the "Pane is dead" error again !?

It's behaving like the DVD has to be present when I complete the %post section, before the system reboots.

Also, if I force a reboot aftre "Pane is dead" the system does come up normally. So the installation does seem to have suceeded.

Thanks again
- Bob

Post Reply