hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.28k stars 4.43k forks source link

The guest's platform ("linux") is currently not supported, will try generic Linux method #13134

Closed mloskot closed 1 year ago

mloskot commented 1 year ago

https://developer.hashicorp.com/vagrant/docs/vagrantfile/machine_settings#config-vm-guest says:

This defaults to :linux, and Vagrant will auto-detect the proper distro.

but if I add the explicit guest declaration for an Ubuntu-based box (see complete Vagrantfile below):

config.vm.guest = :linux

then vagrant up is failing with

...
The guest's platform ("linux") is currently not supported, will try generic Linux method...
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
Installing Virtualbox Guest Additions 7.0.8 - guest version is 6.1.38
...

I guess, no user ever is so explicit declaring guest for Linux machine, hence there seem to be no reports about it.

Vagrantfile

Vagrant.configure("2") do |config|
  config.vagrant.plugins = ["vagrant-vbguest"]

  config.vm.box = "roboxes/ubuntu2004"
  config.vm.guest = :linux   # XXX: remove this line to make vagrant up succeed

  # Workaround for https://github.com/dotless-de/vagrant-vbguest/issues/425#issuecomment-1515225030
  config.vbguest.installer_hooks[:before_install] = [
    "apt-get update",
    "apt-get -y install libxt6 libxmu6 bzip2 tar"
  ]
  config.vbguest.installer_hooks[:after_install] = [
    "VBoxClient --version"
  ]
  config.vbguest.installer_options = { allow_kernel_upgrade: true }

  config.vm.provider :virtualbox do |vb|
    vb.gui = false
    vb.customize ["modifyvm", :id, "--ostype", 'Ubuntu20_LTS_64']
    vb.customize ["modifyvm", :id, "--ioapic", "on"]
    vb.customize ['modifyvm', :id, '--graphicscontroller', 'vmsvga']
    vb.customize ["modifyvm", :id, "--accelerate3d", "off"]
    vb.customize ["modifyvm", :id, "--accelerate2dvideo", "off"]
    vb.customize ['modifyvm', :id, '--clipboard', 'disabled']
    vb.customize ['modifyvm', :id, '--draganddrop', 'disabled']
    vb.customize ['modifyvm', :id, '--vrde', 'off']
  end
end

Environment

chrisroberts commented 1 year ago

Hi there,

By default Vagrant will attempt to auto-detect the guest platform. The "linux" guest is the generic guest which all other linux type guests inherit. In the example you have provided, since the guest you are running is ubuntu, the guest should be set to ubuntu (config.vm.guest = :ubuntu).

The linux guest implementation provides some basic capabilities that are common on among linux guests. The debian guest inherits capabilities from the linux guest and adds/modifies capabilities that are specific to debian. The ubuntu guest then inherits capabilities from the ubuntu guest and adds/modifies capabilities that are specific to ubuntu.

Hope that clears things up. Cheers!

mloskot commented 1 year ago

@chrisroberts Thank you for the clarification. It makes perfect sense now.

By the way, it looks like there is nothing to find on that in the docs and learn about allowed values for config.vm.guest image