Bug 916346

Summary: system-config-kickstart --generate is broken
Product: [Fedora] Fedora Reporter: Claudio <cmaxtrindade>
Component: system-config-kickstartAssignee: Chris Lumens <clumens>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 19CC: clumens, cmaxtrindade
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: system-config-kickstart-2.9.1-2.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-24 20:26:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Claudio 2013-02-27 21:32:13 UTC
Description of problem:
system-config-kickstart --generate gives error.

Version-Release number of selected component (if applicable):
system-config-kickstart-2.9.0-1.fc18.noarch.rpm

How reproducible:
sudo system-config-kickstart --generate ks.cfg
  
Actual results:

  File "/bin/system-config-kickstart", line 67, in <module>
    useCliMode(opts.generate)
  File "/bin/system-config-kickstart", line 41, in useCliMode
    profileSystem = profileSystem.ProfileSystem(ksHandler)
  File "/usr/share/system-config-kickstart/profileSystem.py", line 39, in __init__
    self.getTimezone()
  File "/usr/share/system-config-kickstart/profileSystem.py", line 59, in getTimezone
    lines = open('/etc/sysconfig/clock', 'r').readlines()
IOError: [Errno 2] No such file or directory: '/etc/sysconfig/clock'

After making a symbolic:

sudo cp -s /usr/share/zoneinfo/myContinent/myCity /etc/sysconfig/clock
I got past that error but then got:

  File "/bin/system-config-kickstart", line 67, in <module>
    useCliMode(opts.generate)
  File "/bin/system-config-kickstart", line 41, in useCliMode
    profileSystem = profileSystem.ProfileSystem(ksHandler)
  File "/usr/share/system-config-kickstart/profileSystem.py", line 39, in __init__
    self.getTimezone()
  File "/usr/share/system-config-kickstart/profileSystem.py", line 65, in getTimezone
    zone = string.replace(zone, '"', "")
UnboundLocalError: local variable 'zone' referenced before assignment

In /usr/share/system-config-kickstart/profileSystem.py I changed:

        zone = string.replace(zone, '"', "")
        zone = string.replace(zone, "'", "")
        zone = string.strip(zone)

        self.ks.timezone(timezone=zone, isUtc=False)

For:

        zone = string.replace(line, '"', "")
        zone1 = string.replace(zone, "'", "")
        zone2 = string.strip(zone1)

        self.ks.timezone(timezone=zone2, isUtc=False)

I then got the kickstart file perfectly.

Please correct this error.

Comment 1 Chris Lumens 2013-02-28 13:48:42 UTC
Does the resulting kickstart file even come close to resembling your system?

Comment 2 Claudio 2013-02-28 18:11:11 UTC
Well, the header comes like this:

#version=DEVEL (incorrect)
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'# Use CDROM installation media (wrong keyboard & need a new line)
cdrom
# Root password
(omitted lines on purpose)
# System timezone
timezone WET0WEST,M3.5.0/1,M10.5.0 (probably wrong, it's Lisbon)
# System language
lang en_US
# SELinux configuration
selinux --enforcing

# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --linux

%packages
(seems to have all my packages listed)

Comment 3 Claudio 2013-02-28 23:37:21 UTC
To get the correct timezone I modified /usr/share/system-config-kickstart/profileSystem.py again:

Instead of:
        zone = string.replace(zone, '"', "")
        zone = string.replace(zone, "'", "")
        zone = string.strip(zone)

I have:
        zone = os.path.realpath('/etc/localtime')
        zone = string.replace(zone, "/usr/share/zoneinfo/", "")

As per same result as with F16. Some other lines before are not necessary. Maybe I should check the old file. I hope kickstart files are still useful in F18.

Comment 4 Fedora Update System 2013-05-09 18:12:29 UTC
system-config-kickstart-2.9.1-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/system-config-kickstart-2.9.1-1.fc19

Comment 5 Claudio 2013-05-10 14:55:33 UTC
Thanks. I will try it out when I can.

When custom installing F18 I found 2 problems:
1) Installation fails with just one transaction error,
2) The boot partition is left almost empty and is only recoverable through another installation on the side which detects the first.

Comment 6 Fedora Update System 2013-05-10 15:33:52 UTC
Package system-config-kickstart-2.9.1-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing system-config-kickstart-2.9.1-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7862/system-config-kickstart-2.9.1-1.fc19
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-05-15 16:44:19 UTC
Package system-config-kickstart-2.9.1-2.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing system-config-kickstart-2.9.1-2.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7862/system-config-kickstart-2.9.1-2.fc19
then log in and leave karma (feedback).

Comment 8 Claudio 2013-06-02 13:11:59 UTC
Testing system-config-kickstart-2.9.1-2.fc19 I always get default 'us' keyboard:
Looking around for the problem I found these 2 solutions:

Solution in "/usr/share/system-config-kickstart/profileSystem.py":

def getKeyboard(self):
    kbd = keyboard.Keyboard()        # unmodified
    line = open('/etc/vconsole.conf', 'r').readline()
    tag, kbd1 = string.split(line, '=')
    kbd1 = string.replace(kbd1, '"', "")
    kbd1 = string.replace(kbd1, "\n", "")
    kbd.set(kbd1)
    self.ks.keyboard(keyboard=kbd.get())  # unmodified

Solution in "/usr/lib/python2.7/site-packages/system_config_keyboard/keyboard.py":

def read(self):
    try:
        line = open('/etc/vconsole.conf', 'r').readline()   # modified
    except:
        return
    self.config = []
    (name, value) = line.rstrip("\n").split ('=')
    self.config.append ([line, name, value.strip ('"'), 0])
    self.beenset = 1
    return value.strip('"')   # added

Then "/usr/share/system-config-kickstart/profileSystem.py" becomes:

def getKeyboard(self):
    kbd = keyboard.Keyboard()
    kbd.set(kbd.read())			    # modified
    self.ks.keyboard(keyboard=kbd.get())

Either way I cannot get rid of the single quotes around the keyboard type.

Comment 9 Fedora Update System 2013-06-29 18:37:10 UTC
system-config-kickstart-2.9.1-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Claudio 2013-10-24 20:23:18 UTC
Going forward with system-config-kickstart-2.9.1-2.fc19. After a burnt computer I managed to test the kickstart file. I cannot get a bootable system with the kickstart instalation. Even after selecting "Do not install boot loader" I got the other working F19 system, on the side, destroyed. It could be the fault of mkisofs command. The result is that the important files are not written to grub2, so it's unbootable.

Comment 11 Chris Lumens 2013-10-24 20:26:39 UTC
system-config-kickstart --generate doesn't do much about the bootloader config, and it's not at all clear to me (given the lack of info here such as log files or the kickstart file in question) that this is system-config-kickstart's problem.  It could be anaconda.  Please open a new bug for your new problem.