Bug 1569485

Summary: virt-install adds "method=" boot parameter, which debian-installer copies to bootloader configuration
Product: [Community] Virtualization Tools Reporter: Raphaël Halimi <raphael.halimi>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED UPSTREAM QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, crobinso, gscrivan, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-23 19:24:22 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:
Attachments:
Description Flags
Patch to remove "method=..." if the guest is identified as Debian none

Description Raphaël Halimi 2018-04-19 11:34:58 UTC
Created attachment 1424017 [details]
Patch to remove "method=..." if the guest is identified as Debian

Hi, reporting upstream a bug I filed in the Debian BTS, for tracking purposes. Mostly copy/paste.

Description of problem:

I'm trying to fully automatically install virtual machines by means of a
preseed file. I set "--location" to the desired URL and add some
parameters to "--extra-args" to ask debian-installer to run an automated
installation, tell it where to fetch the preseed file, and add some
parameters that I want copied to the installed system's boot
configuration (for example "elevator=noop").

This works almost perfectly, but there one slight problem: for a reason
I don't understand, virt-install adds "method=<contents of --location
option>" to the kernel parameters (qemu's "-append" option), *after* the
contents of "--extra-args".

As stated in its documentation, debian-installer will copy most kernel
parameters found after "--" or "---" to the installed system's boot
configuration (eg. in /etc/default/grub), filtering the ones it thinks
are destined to itself; so if the "--extra-args" option contains "--" or
"---", the "method=..." argument ends up being copied in
/etc/default/grub, which of course is not desired. Obviously,
debian-installer filter doesn't catch it.

Now, I'm not sure what would be the correct fix for this. I see two
possibilities:

- the conservative (and simple) one: modify virt-install to add
"method=..." *before* the contents of "--extra-args", so that if the
latter contains "--" or "---", "method=..." will be positioned before
those, and won't be copied to the installed system's boot configuration.

- the risky one: modify virt-install to not add "method=..." at all;
after re-reading debian-installer's documentation, I didn't see this
parameter mentioned anywhere. Come to think of it, this shouldn't be
needed: virt-install already fetches the kernel and initrd, and passes
them to the VM, so I can't see why debian-installer should need to know
how they were fetched.

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

How reproducible:
Always

Steps to Reproduce:
1. Install a Debian guest with virt-install, using --location and --extra-args containing "--" or "---" (example: --extra-args "auto=true url=tftp://autoserver priority=critical --- quiet elevator=noop console=ttyS0,115200n8")
2. Log on new guest
3. Read contents of /etc/default/grub

Actual results:
/etc/default/grub contains a useless kernel parameter "method=...", because virt-install appended it to the contents of --extra-args.

Expected results:
virt-install shouldn't add this parameter, which is completely unneeded, or at least, it should prepend it to --extra-args, not append it, so that if the value of --extra-args contains "--" or "---", debian-installer won't copy it to the bootloader's configuration.

Additional info:
I attached a simple patch, which implements the second solution (remove "method=" altogether if the distribution is detected as "Debian"). It should be tested with other guest distributions though. I believe it should also check if self.name is equal to "Ubuntu", but I'm not sure of what modifications Ubuntu made to debian-installer, and thus, if ubuntu-installer needs (or support) "method=" or not.

Regards,

-- 
Raphaël Halimi

Comment 1 Cole Robinson 2018-04-23 19:24:22 UTC
Thanks for the patch! However this bug is actually fixed upstream already with some recent rework I did to the code in this area. So I'll close this bug as UPSTREAM, but you might want to ask debian to include your patch into their repos, my work will be hard to backport