packer, vagrant, vmware_workstation, centos and networks not working

23 views
Skip to first unread message

Ian Koenig

unread,
Jun 13, 2017, 6:10:19 PM6/13/17
to Vagrant
Hi Vagrant World,  (x-posted to Packer list too)

I'm building a simple centos 7.3.1611 image in packer for use by VMware Workstation/Fusion in a vagrant environment.   Is there any best practices I can follow to get this to work more consistently?

What's happening is the first vagrant up I do, the network configuration fails on me.  If I vagrant halt and vagrant up it works.  In the first vagrant up I get the error of 
--- 
==> service: Setting hostname...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

# Update sysconfig
sed -i 's/\(HOSTNAME=\).*/\1service/' /etc/sysconfig/network

# Update DNS
sed -i 's/\(DHCP_HOSTNAME=\).*/\1"service"/' /etc/sysconfig/network-scripts/ifcfg-*

[... stuff deleted ...]
---


Yet when I use the atlas version of centos/7, it works just fine.   My packer script is fairly simple with a basic kickstart file, one script to setup the vagrant.sh.  My vagrantfile is very simple.  

Why does the centos/7 image work and my packer based centos ISO image not work?  

Thanks
ian
vagrant.sh
sshd.sh
centos7-ks.cfg
test.json
Vagrantfile

Ian Koenig

unread,
Jun 16, 2017, 10:17:59 AM6/16/17
to Vagrant
Resolution for the public:

bentos does a good job cleaning this up.  The solution in my case was as part of the cleanup steps on top of the more commonly done cleaning of udev and network-scripts folder, do an "rm -rf /var/lib/NetworkManager".  
Reply all
Reply to author
Forward
0 new messages