Packer Hyper-v wrong boot order

21 views
Skip to first unread message

Morgan Andrew Davis

unread,
Feb 13, 2019, 9:38:56 AM2/13/19
to Packer
Hello There. I am currently attempting to automate the running of packer's hyper-v builder for work. I am using a ks.cfg file to do this, and will post the contents of it here. For some reason, when I run packer along with the ks file, the vm that is created for some reason doesn't have cd, which corresponds to the iso, as the first in the boot order. This causes the boot to fail every time. For some reason though, it doesn't fail if I don't use the ks file. Below is the ks.cfg file and the contents of my json file. Does anyone see what might be causing the boot order to change?

Sincerely,
Morgan Davis

ks.cfg:
# CentOS 7.x kickstart file - centos7.ks
#
# For more information on kickstart syntax and commands, refer to the
# CentOS Installation Guide:
#
# For testing, you can fire up a local http server temporarily.
# cd to the directory where this ks.cfg file resides and run the following:
#    $ python -m SimpleHTTPServer
# You don't have to restart the server every time you make changes.  Python
# will reload the file from disk every time.  As long as you save your changes
# they will be reflected in the next HTTP download.  Then to test with
# a PXE boot server, enter the following on the PXE boot prompt:
#    > linux text ks=http://<your_ip>:8000/ks.cfg

# Required settings
lang en_US.UTF-8
keyboard us
rootpw atomicorp
authconfig --enableshadow --enablemd5
timezone UTC

# Optional settings
install
cdrom
#user --name=vagrant --plaintext --password vagrant
unsupported_hardware
network --device eth0 --bootproto=dhcp
firewall --disabled
selinux --disabled
# The biosdevname and ifnames options ensure we get "eth0" as our interface
# even in environments like virtualbox that emulate a real NW card
bootloader --location=mbr --append="no_timer_check console=tty0 console=ttyS0,115200 net.ifnames=0 biosdevname=0"
text
skipx
zerombr
clearpart --all --initlabel
autopart
firstboot --disabled
reboot

%packages --nobase --ignoremissing --excludedocs
# vagrant needs this to copy initial files via scp
openssh-clients
# Prerequisites for installing VMware Tools or VirtualBox guest additions.
# Put in kickstart to ensure first version installed is from install disk,
# not latest from a mirror.
kernel-headers
kernel-devel
gcc
make
perl
curl
wget
bzip2
dkms
patch
net-tools
selinux-policy-devel
# Core selinux dependencies installed on 7.x, no need to specify
# Other stuff
sudo
nfs-utils
-fprintd-pam
-intltool

# Microcode updates cannot work in a VM
-microcode_ctl
# unnecessary firmware
-aic94xx-firmware
-alsa-firmware
-alsa-tools-firmware
-atmel-firmware
-b43-openfwwf
-bfa-firmware
-ipw*-firmware
-irqbalance
-ivtv-firmware
-iwl*-firmware
-kernel-firmware
-libertas-usb8388-firmware
-ql*-firmware
-rt61pci-firmware
-rt73usb-firmware
-xorg-x11-drv-ati-firmware
-zd1211-firmware
# Don't build rescue initramfs
-dracut-config-rescue
# no firewalld
-firewalld
-firewalld-filesystem
%end

%post
# configure vagrant user in sudoers
#echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
#chmod 0440 /etc/sudoers.d/vagrant
#cp /etc/sudoers /etc/sudoers.orig
sed -i "s/^\(.*requiretty\)$/#\1/" /etc/sudoers
# keep proxy settings through sudo
echo 'Defaults env_keep += "HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY NO_PROXY"' >> /etc/sudoers
%end

hyper-v1.json:
{
    "builders": [{
            "type": "hyperv-iso",
            "boot_command": [
                   "<up><wait><tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort}}/{{ user `kickstart` }}<enter>"
            ],
            "iso_url": "C:/Users/User/Downloads/CentOS-7-x86_64-Minimal-1810.iso",
            "iso_checksum": "<not goona write this cause I know it is right.",
            "iso_checksum_type": "sha256",
            "ssh_username":  "root",
            "ssh_password":  "toor",
            "ssh_timeout": "10000s",
            "generation": "1",
            "shutdown_command": "echo 'toor' | sudo -s shutdown -P now"
    }],
    "variables": {
            "kickstart": "ks.cfg",
            "http_directory": "C:/Users/User/Desktop/kickstart/centos7"
    }
}

Megan Marsh

unread,
Feb 13, 2019, 2:24:09 PM2/13/19
to packe...@googlegroups.com
Is this a regression in v. 1.3.4?  If so, https://github.com/hashicorp/packer/pull/7147 could be to blame -- otherwise, I'm not sure what's going on.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/ea813011-0807-498c-a31c-629d8ea6182a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Morgan Andrew Davis

unread,
Feb 13, 2019, 3:02:18 PM2/13/19
to Packer
I am indeed using 1.3.4. So someone had this issue before? Is there a way for me to specify the boot order? If there is, I couldn't find it at: https://www.packer.io/docs/builders/hyperv-iso.html.

Megan Marsh

unread,
Feb 13, 2019, 4:11:55 PM2/13/19
to packe...@googlegroups.com
There isn't but maybe there should be. If you downgrade to 1.3.3 do you still have this issue?  in v1.3.4 we made a change to boot order in hyperv which we thought wouldn't affect people but we were clearly wrong. I will revert this change if it turns out that it caused the problem you're seeing.
Reply all
Reply to author
Forward
0 new messages