"Vagrant::Errors::MachineGuestNotReady"
Error encountered
Virtual machine does not boot due to an error with guest communications.
Debug output
https://gist.github.com/gmaubach/2938628918668a05ca06b8c9b1ca274a
Expected behavior
Machine should boot normally.
Actual behavior
Boot process is interrupted.
Reproduction information
Vagrant version
Vagrant 2.3.4
Host operating system
Operating System: Debian GNU/Linux 12 (bookworm) Debian Version: 12.5 Kernel: Linux 6.1.0-20-amd64
Guest operating system
Vagrantbox: debian/bookworm64
Steps to reproduce
Just run "vagrant up --provision --debug"
Vagrantfile
I do not know which part causes the error. Thus complete Vagrantfile is provided.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/bookworm64"
# -- CONSTANTS
## -- Identification
MACHINE_NAME = "db-sqlite3"
SERVICE_NAME = "sqlite3"
SERVICE_VERSION = "3.40.1"
## -- Networking
PHYSICAL_NETWORK_INTERFACE = "enp6s0"
PRIVATE_IP = "192.168.56.14"
PUBLIC_IP = "10.111.90.14"
FORWARDED_PORT_HOST = 5000
FORWARDED_PORT_GUEST = 5000
## -- Data
SYNCED_FOLDER_HOST = "."
SYNCED_FOLDER_GUEST = "/vagrant"
SYNCED_FOLDER_TYPE = "virtualbox" # "virtualbox" | "nfs"
SYNCED_FOLDER_OWNER = "vagrant"
SYNCED_FOLDER_GROUP = "vagrant"
SYNCED_FOLDER_DIR_PERMISSIONS = "755"
SYNCED_FOLDER_FILE_PERMISSIONS = "755"
DATA_FOLDER_HOST = File.expand_path("./base")
DATA_FOLDER_GUEST = "/database"
DATA_FOLDER_TYPE = "virtualbox" # "virtualbox" | "nfs"
DATA_FOLDER_OWNER = "vagrant"
DATA_FOLDER_GROUP = "vagrant"
DATA_FOLDER_DIR_PERMISSIONS = "775"
DATA_FOLDER_FILE_PERMISSIONS = "775"
# Globally disable the default synced folder.
config.vm.synced_folder ".", "/vagrant", disabled: true
# Set provider virtualbox to use GUI, for two reasons:
config.vm.provider "virtualbox" do |v|
v.name = MACHINE_NAME
v.cpus = 2
v.memory = 4096
end
# Virtual Machine headline, e.g. ansible_controller
config.vm.define MACHINE_NAME.to_sym, primary: true do |machine|
machine.vm.hostname = MACHINE_NAME
# Security Management
machine.ssh.insert_key = false
machine.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "$HOME/.ssh/id_rsa"
machine.vm.provision "shell", inline: <<-SHELL
chmod 600 /home/vagrant/.ssh/id_rsa
SHELL
# Networking
machine.vm.network "private_network", ip: PRIVATE_IP
machine.vm.network "public_network",
bridge: PHYSICAL_NETWORK_INTERFACE,
ip: PUBLIC_IP,
netmask: "255.255.0.0"
machine.vm.network "forwarded_port", guest: FORWARDED_PORT_GUEST, host: FORWARDED_PORT_HOST
# Syncing directories
machine.vm.synced_folder SYNCED_FOLDER_HOST, SYNCED_FOLDER_GUEST,
type: SYNCED_FOLDER_TYPE,
owner: SYNCED_FOLDER_OWNER,
group: SYNCED_FOLDER_GROUP,
mount_options: ["dmode=#{SYNCED_FOLDER_DIR_PERMISSIONS},fmode=#{SYNCED_FOLDER_FILE_PERMISSIONS}"]
machine.vm.synced_folder DATA_FOLDER_HOST, DATA_FOLDER_GUEST,
type: DATA_FOLDER_TYPE,
owner: DATA_FOLDER_OWNER,
group: DATA_FOLDER_GROUP,
mount_options: ["dmode=#{DATA_FOLDER_DIR_PERMISSIONS},fmode=#{DATA_FOLDER_FILE_PERMISSIONS}"]
# Provisioning
machine.vm.provision "shell", inline: <<-SHELL
# Without package list update no installations are possible
apt-get update # && apt-get upgrade
apt-get install -y avahi-daemon coreutils nfs-common tree vim
SHELL
# Provisioning script to install and configure SQLite3
machine.vm.provision "shell", inline: <<-SHELL
# Update and install SQLite3
apt-get install -y sqlite3
# Ensure the database directory is available and has correct permissions
mkdir -p /database
chown -R vagrant:vagrant /database
chmod -R 775 /database
# Test SQLite database
sqlite3 /database/test.db "CREATE TABLE example (id INTEGER PRIMARY KEY, value TEXT NOT NULL);"
SHELL
# Finish
machine.vm.boot_timeout = 360
machine.vm.post_up_message = "App = #{MACHINE_NAME} | Private IP = #{PRIVATE_IP} | Public IP = DHCP (#{PUBLIC_IP} re-assigned) | Service = #{SERVICE_NAME} (#{SERVICE_VERSION}) | Port Forwarding = #{FORWARDED_PORT_HOST}:#{FORWARDED_PORT_GUEST}"
end
end
Note: This bug report is filed upon request of Vagrant reporting when running "vagrant up --provision".
Some problem with VirtualBox:
VBoxManage unregistervm "db-sqlite3" --delete VBoxManage: error: Cannot unregister the machine 'db-sqlite3' while it is locked VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports VBoxManage: error: Context: "Unregister(fDeleteAll ? CleanupMode_DetachAllReturnHardDisksAndVMRemovable :CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 233 of file VBoxManageMisc.cpp
vagrant halt ==> db-sqlite3: Attempting graceful shutdown of VM... db-sqlite3: Guest communication could not be established! This is usually because db-sqlite3: SSH is not running, the authentication information was changed, db-sqlite3: or some other networking issue. Vagrant will force halt, if db-sqlite3: capable. ==> db-sqlite3: Forcing shutdown of VM...
Issue solved.
Closing as self reported resolved.