Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 120252 - Scripted (kickstart) installation fails
Scripted (kickstart) installation fails
Product: Red Hat Raw Hide
Classification: Retired
Component: anaconda (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeremy Katz
Depends On:
Blocks: FC2Blocker FC3Target 166250
  Show dependency treegraph
Reported: 2004-04-07 07:20 EDT by Benny Amorsen
Modified: 2007-04-18 13:05 EDT (History)
0 users

See Also:
Fixed In Version: rhel4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-03 13:00:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Kickstart file that causes the problem (1.72 KB, text/plain)
2004-04-08 05:22 EDT, Benny Amorsen
no flags Details
Ugly workaround patch (602 bytes, patch)
2004-05-07 07:54 EDT, Benny Amorsen
no flags Details | Diff
patch to fix undefined 'script' variable in readKickstart (473 bytes, patch)
2006-02-01 12:55 EST, Michael Rice
no flags Details | Diff

  None (edit)
Description Benny Amorsen 2004-04-07 07:20:12 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6)
Gecko/20040312 Epiphany/1.1.12

Description of problem:
When doing an install with kickstart and a %post-script, the following
error appears (copied by hand):

Traceback (most recent call last):
  File "/usr/bin/anaconda", line 1090, in ?
  File "/usr/lib/anaconda/kickstart.py", line 1318, in setInstallData
    self.readKickstart(id, self.file)
  File "/usr/lib/anaconda/kickstart.py", line 698, in readKickstart
    where = self.readKickstart(id, args[1], where = where)
  File "/usr/lib/anaconda/kickstart.py", line 758, in readKickstart
    script = script + n
UnboundLocalError: local variable 'script' referenced before assignment
install exited abnormally

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Build installable CD with buildinstall
2. Add kickstart script to it (with %post section)
3. Boot the CD

Additional info:

It is not clear to me where the variable "script" is supposed to be
assigned, so I can't fix the bug myself.
Comment 1 Jeremy Katz 2004-04-07 21:45:44 EDT
Can you save the complete dump and attach it?  I can't reproduce this
here (I do lots of kickstarts with a %post that always gets run).  Any
odd kernel messages on tty4?
Comment 2 Benny Amorsen 2004-04-08 05:22:26 EDT
Created attachment 99231 [details]
Kickstart file that causes the problem

Here is the kickstart file that causes the problem. The traceback I posted
earlier is all I get as far as I can tell.
Comment 3 Benny Amorsen 2004-04-08 05:24:29 EDT
Heh, off to change the default root password now... Duh.
Comment 4 Jeremy Katz 2004-05-06 17:50:20 EDT
Is this reproducible with newer trees?
Comment 5 Benny Amorsen 2004-05-07 07:53:54 EDT
The problem persists with anaconda-9.92-8. I haven't tried anything
later. I have an ugly workaround patch.
Comment 6 Benny Amorsen 2004-05-07 07:54:51 EDT
Created attachment 100072 [details]
Ugly workaround patch
Comment 7 Need Real Name 2004-06-03 19:09:45 EDT
I am seeing this bug also.  My commonality with this kickstart script
is that I'm using %includes (much more frequently in my case however)
in %post, as well as all other sections.  I will be happy to attach my
ks.cfg if you desire.
Comment 8 Jeremy Katz 2004-10-04 16:31:13 EDT
Finally reproduced.  Fixed in CVS.
Comment 9 Michael Rice 2006-02-01 12:54:31 EST
I had this problem in 3ES U4 with a kickstart config with both %include and
%post scripts.  Remove either and it didn't generate the error noted above.

The fix is VERY similar to Benny's, but I pulled the code from a 4ES U2 anaconda
where the readKickstart method is very similar.  

Patch attached.

To use this loopback mount your stage2.img file somewhere, copy all the files to
a working directory.  Patch $workingdir/usr/lib/anaconda/kickstart.py with the
attached patch.  mkcramfs $workingdir /tmp/stage2-patched.img

copy the /tmp/stage2-patched.img to your kickstart base directory (e.g.
Comment 10 Michael Rice 2006-02-01 12:55:31 EST
Created attachment 123980 [details]
patch to fix undefined 'script' variable in readKickstart

Read the posting where this is attached for more information on how to apply

Note You need to log in before you can comment on or make changes to this bug.