Bug 1624068 - Vagrant with Rawhide Fedora Cloud Failed to restart network.service: Unit network.service not found.
Summary: Vagrant with Rawhide Fedora Cloud Failed to restart network.service: Unit net...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: vagrant
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pavel Valena
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-30 20:13 UTC by Joe Doss
Modified: 2018-11-09 09:06 UTC (History)
9 users (show)

Fixed In Version: vagrant-2.1.5-2.fc30 vagrant-2.1.2-3.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-24 18:31:19 UTC


Attachments (Terms of Use)
Vagrantfile (425 bytes, text/plain)
2018-08-30 20:13 UTC, Joe Doss
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1647788 None CLOSED unable to vagrant up fedora/29-cloud-base 2019-10-08 11:03:48 UTC

Internal Links: 1647788

Description Joe Doss 2018-08-30 20:13:27 UTC
Created attachment 1479893 [details]
Vagrantfile

Description of problem:

Rawhide removes the network.service unit file and switches over to NetworkManager.service. (see https://bugzilla.redhat.com/show_bug.cgi?id=1596062#c1) This change causes Vagrant to fail with:

Failed to restart network.service: Unit network.service not found.

Vagrant needs to have logic added upstream to this file https://github.com/hashicorp/vagrant/blob/85acf0cac724ef4bfda593a66e0c17f7e4110da0/plugins/guests/redhat/cap/change_host_name.rb#L32 where it will check to see if NetworkManager is installed and controlling the network interfaces and chooses to restart network.service or NetworkManager.service when setting the hostname via SSH.

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

2.1.2

How reproducible:

Always

Steps to Reproduce:
1.vagrant box add https://kojipkgs.fedoraproject.org/compose/rawhide/latest-Fedora-Rawhide/compose/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-Rawhide-20180827.n.0.x86_64.vagrant-libvirt.box --name Fedora-Cloud-Base-Vagrant-Rawhide-20180827
2. Create a Vagrantfile from attached Vagrantfile
3. vagrant up

Actual results:

==> rawhide: 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=\).*/\1rawhide.kennasec.com/' /etc/sysconfig/network

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

# Set the hostname - use hostnamectl if available
echo 'rawhide.kennasec.com' > /etc/hostname
if command -v hostnamectl; then
  hostnamectl set-hostname --static 'rawhide.kennasec.com'
  hostnamectl set-hostname --transient 'rawhide.kennasec.com'
else
  hostname -F /etc/hostname
fi

# Prepend ourselves to /etc/hosts
grep -w 'rawhide.kennasec.com' /etc/hosts || {
  sed -i'' '1i 127.0.0.1\trawhide.kennasec.com\trawhide' /etc/hosts
}

# Restart network
service network restart


Stdout from the command:

/usr/bin/hostnamectl


Stderr from the command:

Redirecting to /bin/systemctl restart network.service
Failed to restart network.service: Unit network.service not found.

Expected results:

No error.

Additional info:

This Cloud SIG issue has more details on this problem. https://pagure.io/cloud-sig/issue/291#comment-528948

Comment 1 Joe Doss 2018-09-17 18:48:44 UTC
Upstream PR submitted to fix this issue: https://github.com/hashicorp/vagrant/pull/10214

Comment 2 Joe Doss 2018-09-21 15:14:26 UTC
Hashicorp took PR 10214 and refactored it into a better solution:

https://github.com/hashicorp/vagrant/pull/10223

Comment 3 Dusty Mabe 2018-09-26 02:11:58 UTC
that PR has been merged now - can we backport the patch to vagrant in f29/f28 ?

Comment 4 Pavel Valena 2018-10-03 13:44:06 UTC
Patch pushed into Rawhide.

You can also check my COPR repository with Rawhide Vagrant:
  https://copr.fedorainfracloud.org/coprs/pvalena/vagrant/

> that PR has been merged now - can we backport the patch to vagrant in f29/f28 ?

Yes, I will backport it now.

Comment 5 Joe Doss 2018-10-08 18:00:41 UTC
This fix in vagrant-2.1.5-1.fc30.noarch doesn't seem to be working correctly. 

https://kojipkgs.fedoraproject.org//packages/vagrant/2.1.5/1.fc30/noarch/vagrant-2.1.5-1.fc30.noarch.rpm

Traceback (most recent call last):
	67: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
	66: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/machine.rb:194:in `action'
	65: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/machine.rb:194:in `call'
	64: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/environment.rb:614:in `lock'
	63: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/machine.rb:208:in `block in action'
	62: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/machine.rb:239:in `action_raw'
	61: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/runner.rb:66:in `run'
	60: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/util/busy.rb:19:in `busy'
	59: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/runner.rb:66:in `block in run'
	58: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builder.rb:116:in `call'
	57: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	56: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
	55: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	54: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/box_check_outdated.rb:82:in `call'
	53: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	52: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/call.rb:53:in `call'
	51: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/runner.rb:66:in `run'
	50: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/util/busy.rb:19:in `busy'
	49: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/runner.rb:66:in `block in run'
	48: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builder.rb:116:in `call'
	47: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	46: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
	45: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	44: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/set_name_of_domain.rb:35:in `call'
	43: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	42: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/handle_storage_pool.rb:52:in `call'
	41: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	40: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
	39: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	38: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/handle_box_image.rb:113:in `call'
	37: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	36: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_domain_volume.rb:82:in `call'
	35: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	34: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_domain.rb:317:in `call'
	33: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	32: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/provision.rb:80:in `call'
	31: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	30: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-omnibus-1.5.0/lib/vagrant-omnibus/action/install_chef.rb:38:in `call'
	29: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	28: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/prepare_nfs_valid_ids.rb:12:in `call'
	27: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	26: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
	25: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	24: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
	23: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	22: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
	21: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	20: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/prepare_nfs_settings.rb:18:in `call'
	19: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	18: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/share_folders.rb:20:in `call'
	17: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	16: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_networks.rb:84:in `call'
	15: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	14: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/create_network_interfaces.rb:182:in `call'
	13: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	12: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/set_boot_order.rb:78:in `call'
	11: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	10: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/start_domain.rb:302:in `call'
	 9: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	 8: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/wait_till_up.rb:77:in `call'
	 7: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	 6: from /home/jdoss/.vagrant.d/gems/2.5.1/gems/vagrant-libvirt-0.0.43/lib/vagrant-libvirt/action/forward_ports.rb:29:in `call'
	 5: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call'
	 4: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/action/builtin/set_hostname.rb:21:in `call'
	 3: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/guest.rb:43:in `capability'
	 2: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/capability_host.rb:111:in `capability'
	 1: from /usr/share/vagrant/gems/gems/vagrant-2.1.5/lib/vagrant/capability_host.rb:111:in `call'
/usr/share/vagrant/gems/gems/vagrant-2.1.5/plugins/guests/redhat/cap/change_host_name.rb:25:in `change_host_name': undefined method `hostnamectl?' for VagrantPlugins::GuestRedHat::Cap::ChangeHostName:Class (NoMethodError)

https://github.com/hashicorp/vagrant/issues/10272

Comment 6 Joe Doss 2018-10-08 18:19:16 UTC
I just pulled vagrant from master and it works fine. I don't think this patch got backported in full.

$ ~/vagrant-upstream/exec/vagrant --version
Vagrant 2.1.6.dev


$ ~/vagrant-upstream/exec/vagrant up f29

Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

Bringing machine 'f29' up with 'libvirt' provider...
==> f29: Checking if box 'fedora/beta-29-cloud-base' is up to date...
==> f29: Creating image (snapshot of base box volume).
==> f29: Creating domain with the following settings...
==> f29:  -- Name:              vagrant-upstream_f29
==> f29:  -- Domain type:       kvm
==> f29:  -- Cpus:              2
==> f29: 
==> f29:  -- Feature:           acpi
==> f29:  -- Feature:           apic
==> f29:  -- Feature:           pae
==> f29:  -- Memory:            2048M
==> f29:  -- Management MAC:    
==> f29:  -- Loader:            
==> f29:  -- Base box:          fedora/beta-29-cloud-base
==> f29:  -- Storage pool:      default
==> f29:  -- Image:             /home/images/vagrant-upstream_f29.img (41G)
==> f29:  -- Volume Cache:      default
==> f29:  -- Kernel:            
==> f29:  -- Initrd:            
==> f29:  -- Graphics Type:     vnc
==> f29:  -- Graphics Port:     -1
==> f29:  -- Graphics IP:       127.0.0.1
==> f29:  -- Graphics Password: Not defined
==> f29:  -- Video Type:        cirrus
==> f29:  -- Video VRAM:        9216
==> f29:  -- Sound Type:  
==> f29:  -- Keymap:            en-us
==> f29:  -- TPM Path:          
==> f29:  -- INPUT:             type=mouse, bus=ps2
==> f29: Creating shared folders metadata...
==> f29: Starting domain.
==> f29: Waiting for domain to get an IP address...
==> f29: Waiting for SSH to become available...
    f29: 
    f29: Vagrant insecure key detected. Vagrant will automatically replace
    f29: this with a newly generated keypair for better security.
    f29: 
    f29: Inserting generated public key within guest...
    f29: Removing insecure key from the guest if it's present...
    f29: Key inserted! Disconnecting and reconnecting using new SSH key...
==> f29: Setting hostname...
==> f29: Configuring and enabling network interfaces...
    f29: SSH address: 192.168.121.87:22
    f29: SSH username: vagrant
    f29: SSH auth method: private key
==> f29: Rsyncing folder: ~/vagrant-upstream/ => /vagrant

$ ~/vagrant-upstream/exec/vagrant ssh f29
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.


$ ~/vagrant-upstream/exec/vagrant ssh f29
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

Last login: Mon Oct  8 18:13:17 2018 from 192.168.121.1
[vagrant@f29 ~]$ hostname
f29.example.com

Comment 7 Pavel Valena 2018-10-16 07:52:47 UTC
You're right, build fixing this comming right up (available in my COPR now).

Comment 8 Joe Doss 2018-10-23 17:49:35 UTC
Any ETA on that build Pavel? Vagrant 2.2.0 just got released, so maybe bumping to that version is a better path here than backporting the patches. 2.2.0 should have everything we need to close this bug out.

Comment 9 Pavel Valena 2018-10-24 08:04:14 UTC
Hello Joe,

I'm blocked by pending rubygem-childprocess* update.

Otherwise it's ready and tested to be pushed to rawhide.

I'll backport to older Fedoras without delay.

Regards,
Pavel

* https://src.fedoraproject.org/rpms/rubygem-childprocess/pull-request/1

Comment 10 Pavel Valena 2018-10-24 08:05:19 UTC
Note: rebasing would take additional time in comparison with already prepared 
and tested build.

Comment 11 Dusty Mabe 2018-10-24 13:22:21 UTC
(In reply to Pavel Valena from comment #10)
> Note: rebasing would take additional time in comparison with already
> prepared 
> and tested build.

yes that is true. 

Pavel, can we just get the "bugfix" version of pre 2.2.0 into f29/f28 ?

Comment 12 Pavel Valena 2018-10-24 18:31:19 UTC
(In reply to Dusty Mabe from comment #11)

Rawhide rebased, building updates for other Fedoras now.

Comment 13 Fedora Update System 2018-10-30 10:00:26 UTC
vagrant-2.1.2-3.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-461d1a4e14

Comment 14 Fedora Update System 2018-10-31 18:51:47 UTC
vagrant-2.1.2-3.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-461d1a4e14

Comment 15 Fedora Update System 2018-11-03 00:01:29 UTC
vagrant-2.1.2-3.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.