Hello again. I am having some issues with the hyper-v builder. I am 
currently trying to use the hyper-v builder to better automate image 
creation for the company I work for. I don't have a version of windows 
capable of hyper-v so I have a vmware machine that is. The builder itself 
seems to work as I can run a basic build and it will have me manually go 
through the install. The issue arises when I include a kickstart file to 
automatically do the install. When I do this, a college and I have come to 
the conclusion that the boot fails and the dracut emergency shell is 
invoked. He and I thought this may be because of missing hyper-v drivers. 
We took steps to include them via dracut, but it doesn 't seem to fix the 
issue. I'll attach a copy of the json and kickstart file. Is there any 
advice you can give?

ks.cfg:
# CentOS 7.x kickstart file - centos7.ks
#
# For more information on kickstart syntax and commands, refer to the
# CentOS Installation Guide:
# 
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html
#
# 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 stuffz
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
pushd /etc/dracut.conf.d/
echo 'add_drivers+="hv_vmbus hyperv_fb hid_hyperv hv_storvsc 
hyperv_keyboard hv_netvsc hv_balloon hv_utils"'
popd
dracut -f
%end

hyper-v1.json:
not sure if the username and password are right, but it never gets to 
timeout on ssh anyway
{
"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": 
"38d5d51d9d100fd73df031ffd6bd8b1297ce24660dc8c13a3b8b4534a4bd291c",
"iso_checksum_type": "sha256",
"ssh_username": "root",
"ssh_password": "toor",
"ssh_timeout": "10000s",
"generation": "1",
"ram_size": "2048",
"shutdown_command": "echo 'toor' | sudo -S shutdown -P now"
}],
"variables": {
"kickstart": "ks.cfg",
"http_directory": "C:/Users/User/Desktop/kickstart/centos7"
}
}

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/97c45073-334e-4206-bf69-539129e29684%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to