Bug 1418500

Summary: livemedia-creator fails when using %include to specify partitioning
Product: Red Hat Enterprise Linux 7 Reporter: jcastran
Component: loraxAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: bcl, cww, decandia, jcastran, jstodola, pbokoc, sbueno
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lorax-19.6.95-1 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of:
: 1488423 (view as bug list) Environment:
Last Closed: 2018-04-10 17:38:04 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:
Bug Depends On:    
Bug Blocks: 1420851, 1478303    
Attachments:
Description Flags
Anaconda Logs from failed livemedia-creator 01783248 none

Description jcastran 2017-02-02 00:45:20 UTC
Created attachment 1246931 [details]
Anaconda Logs from failed livemedia-creator 01783248

Description of problem:
when using a kickstart that has the following:
   %pre
   echo "part / --fstype=ext4 --size=4000" > /tmp/partition
   echo "part swap --size=1000" >> /tmp/partition
   %end

Then instead of defining the partitioning in the kickstart, you would use:
   %include /tmp/partition

Which for a normal installation, replaces the %include with the contents of the file specified.

What we found is that instead, the installation fails because there were "No Disks Selected" "Not enough space for installation" (This works if you don't use %pre and %include)


Looking in the shell (virsh console) we can see that the /tmp/partition file does get created. I was able to add the kernel line "text" to stop the installation from dying immediately upon error (defaults to cmdline)

Command:
livemedia-creator --make-disk --ks=rhel7-minimal.ks --iso=rhel-server-7.3-x86_64-boot.iso --image-name=reproducer.img --ram=10240 --tmp=/var/tmp/



Version-Release number of selected component (if applicable):
lorax-19.6.78-1.el7.x86_64



How reproducible:
Everytime

Steps to Reproduce:
1. Create a file with %pre that contains kickstart commands (See above)
2. Replace the partitioning with %include /tmp/filename
3. Run the livemedia-creator command
Command:
   livemedia-creator --make-disk --ks=rhel7-minimal.ks --iso=rhel-server-7.3-x86_64-boot.iso --image-name=reproducer.img --ram=10240 --tmp=/var/tmp/



Actual results:
livemedia-creator fails with:
   Install failed: virt_install failed

Looking at console view of install you can see
   Installation Destination
   (No Disks Selected)
   
   The installation was stopped due to incomplete spokes detected while running in non-interactive cmdline mode. Edit your kickstart file and retry installation.

   The following mandatory spokes are not completed:
   Installation Destination



Expected results:
livemedia-creator creates an img file

Additional info:

Comment 2 Brian Lane 2017-02-02 16:48:21 UTC
%include doesn't work with livemedia-creator, you need a flattened kickstart.

https://rhinstaller.github.io/lorax/livemedia-creator.html#kickstarts

lmc is used to create live iso's and disk images and while it does use Anaconda for the installation it really isn't designed to support advanced partitioning, especially the %pre + %include trick.

Comment 3 Red Hat Bugzilla Rules Engine 2017-02-02 16:48:25 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

Comment 4 decandia 2017-02-02 19:31:06 UTC
Brian,

I understand your point, but would you be willing to update the docs to be more specific about the fact that you *must* flatten the kickstart file?  The example is a bit like 'hey this is a simple thing I tried', it's not exactly clear that you must flatten the file because %include syntax is not supported.

-Mike

Comment 5 jcastran 2017-02-02 19:36:24 UTC
Hello,

I am reopening this bug. Customer has requested if we can update the documentation to clearly state this (or if it's already stated, where?)

Thanks,
John Castranio
Red Hat

Comment 11 Jan Stodola 2017-12-05 11:30:40 UTC
This is now documented in /usr/share/doc/lorax-$VERSION/README.livemedia-creator:

...
livemedia-creator parses the 'part /' entry to determine how big a disk image
needs to be created. This means that the common kickstart technique of using
%pre to generate a partition scheme for use with %include will not work. There
needs to be a 'part /' entry in the main part of the kickstart.

Only one kickstart file is supported, so if your kickstart is built from a
number of %include commands it needs to be flattened into a single file with
ksflatten first.

Verified with lorax-19.6.101-1.el7.

Comment 14 errata-xmlrpc 2018-04-10 17:38:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0947