Vagrant 2.1.5
Debian
RHEL8 beta 1
standard vagrantfile trying to set hostname via:
config.vm.hostname = "foo"
set hostname
set hostname fails with:
==> default: 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=\).*/\1rhel8/' /etc/sysconfig/network
# Update DNS
sed -i 's/\(DHCP_HOSTNAME=\).*/\1"rhel8"/' /etc/sysconfig/network-scripts/ifcfg-*
# Set the hostname - use hostnamectl if available
echo 'rhel8' > /etc/hostname
if command -v hostnamectl; then
hostnamectl set-hostname --static 'rhel8'
hostnamectl set-hostname --transient 'rhel8'
else
hostname -F /etc/hostname
fi
# Prepend ourselves to /etc/hosts
grep -w 'rhel8' /etc/hosts || {
sed -i'' '1i 127.0.0.1\trhel8\trhel8' /etc/hosts
}
# Restart network
service network restart
Stdout from the command:
/bin/hostnamectl
127.0.0.1 rhel8.localdomain
Stderr from the command:
Redirecting to /bin/systemctl restart network.service
Failed to restart network.service: Unit network.service not found.
rhel8 is using NetworkManager by default, the network.service file has been moved to a legacy package and will only be available if the package network-scripts is installed:
dnf install network-scripts
[..]
network-scripts-10.00.1-1.el8.x86_64
Complete!
[root@setmeup vagrant]# service network restart
Restarting network (via systemctl): [ OK ]
Hi @abbbi - This worked fine for me for both the roboxes and generic box on the latest version of Vagrant:
brian@localghost:vagrant-sandbox % be vagrant up rhel ±[●][master]
Bringing machine 'rhel' up with 'virtualbox' provider...
==> rhel: Box 'roboxes/rhel8' could not be found. Attempting to find and install...
rhel: Box Provider: virtualbox
rhel: Box Version: >= 0
==> rhel: Loading metadata for box 'roboxes/rhel8'
rhel: URL: https://vagrantcloud.com/roboxes/rhel8
==> rhel: Adding box 'roboxes/rhel8' (v1.8.50) for provider: virtualbox
rhel: Downloading: https://vagrantcloud.com/roboxes/boxes/rhel8/versions/1.8.50/providers/virtualbox.box
rhel: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
==> rhel: Successfully added box 'roboxes/rhel8' (v1.8.50) for 'virtualbox'!
==> rhel: Importing base box 'roboxes/rhel8'...
==> rhel: Matching MAC address for NAT networking...
==> rhel: Checking if box 'roboxes/rhel8' is up to date...
==> rhel: Setting the name of the VM: vagrant-sandbox_rhel_1544640181286_89044
==> rhel: Fixed port collision for 22 => 2222. Now on port 2200.
==> rhel: Clearing any previously set network interfaces...
==> rhel: Preparing network interfaces based on configuration...
rhel: Adapter 1: nat
==> rhel: Forwarding ports...
rhel: 22 (guest) => 2200 (host) (adapter 1)
==> rhel: Running 'pre-boot' VM customizations...
==> rhel: Booting VM...
==> rhel: Waiting for machine to boot. This may take a few minutes...
rhel: SSH address: 127.0.0.1:2200
rhel: SSH username: vagrant
rhel: SSH auth method: private key
rhel:
rhel: Vagrant insecure key detected. Vagrant will automatically replace
rhel: this with a newly generated keypair for better security.
rhel:
rhel: Inserting generated public key within guest...
rhel: Removing insecure key from the guest if it's present...
rhel: Key inserted! Disconnecting and reconnecting using new SSH key...
==> rhel: Machine booted and ready!
==> rhel: Checking for guest additions in VM...
rhel: No guest additions were detected on the base box for this VM! Guest
rhel: additions are required for forwarded ports, shared folders, host only
rhel: networking, and more. If SSH fails on this machine, please install
rhel: the guest additions and repackage the box to continue.
rhel:
rhel: This is not an error message; everything may continue to work properly,
rhel: in which case you may ignore this message.
==> rhel: Setting hostname...
brian@localghost:vagrant-sandbox % be vagrant ssh -c "hostname -f" rhel ±[●][master]
redhat
Connection to 127.0.0.1 closed.
config.vm.define "rhel" do |r|
#r.vm.box = "generic/rhel8"
r.vm.box = "roboxes/rhel8"
r.vm.hostname = "redhat"
r.vm.provider :virtualbox
end
Please upgrade to the latest version of Vagrant and try again! If you're still having trouble feel free to comment on this issue and we can re-open it. And if you do, please provide us with the full debug log so that we can see what's going on. Thanks!
hi,
yes, indeed the most recent version seems to have fixed this :)
thanks.
@abbbi - awesome, glad to hear it! :taco: :tada:
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
hi,
yes, indeed the most recent version seems to have fixed this :)
thanks.