dotless-de / vagrant-vbguest

A Vagrant plugin to keep your VirtualBox Guest Additions up to date
MIT License
2.88k stars 206 forks source link

VBoxGuestAdditions config.vbguest.iso_path wrong by default #434

Closed ilya-indigo closed 9 months ago

ilya-indigo commented 1 year ago

A few months ago, vagrant stopped updating VBoxGuestAdditions with a very obscure and absurd error and stopped executing other commands. vagrant up

......................................................................................
[default] GuestAdditions versions on your host (7.0.10) and guest (7.0.8) do not match
......................................................................................
Unmounting Virtualbox Guest Additions ISO from: /mnt
umount: /mnt: not mounted
==> default: Checking for guest additions in VM...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

umount /mnt

Stdout from the command:

Stderr from the command:

umount: /mnt: not mounted

It took me a very long time to figure out what was wrong. It used to update itself perfectly fine, and then suddenly stopped. It turned out to be this plugin and the incorrect default value of the option config.vbguest.iso_path. Vagrantconfig.yaml

if Vagrant.has_plugin?("vagrant-vbguest")
    config.vbguest.iso_path = "https://download.virtualbox.org/virtualbox/%{version}/VBoxGuestAdditions_%{version}.iso"
end

After setting it to the correct value, everything worked as before.

..................................................................
[default] GuestAdditions 7.0.10 running --- OK
..................................................................

I understand that it should be set to this default value!

openSUSE Tumbleweed https://build.opensuse.org/package/show/Virtualization:vagrant/vagrant-vbguest vagrant-vbguest: 0.31.0 vagrant: 2.3.7 ruby: 3.2.2 VirtualBox: 7.0.10 Guest: CentOS 6.10

fnordfish commented 1 year ago

"https://download.virtualbox.org/virtualbox/%{version}/VBoxGuestAdditions_%{version}.iso" is already the default path for downloading. Your config.vbguest.iso_path = "..." forces vagrant-vbguest to always download from that URL, instead of using the local IOS file (if it exists). This are the files checked on linux hosts:

Maybe one of these files exist on your host and is corrupted, resulting in a mount failure.

ilya-indigo commented 1 year ago

I carefully checked not on any of these paths and other possible paths there is no iso file. Moreover I didn't find a package in the repositories that provides it. https://build.opensuse.org/package/show/Virtualization/virtualbox

It looks more like vagrant-vbguest just tries to mount a non-existent file in one of these paths without checking if it exists, and gives a very unclear error, which makes it unclear which file it tried to mount or if it tried to mount at all (unmounting error, but not mounting error).

Maybe it's also because when doing a path search, it executes umount when it doesn't need to, i.e. without checking if something has been mounted to /mnt.

If you think about it, why would a virtualbox package need to provide a file with a size of more than 50 MB, which is not needed by everyone, and if it is needed, it is needed only once when updating virtualbox. It is much more correct to load it when it is needed and then delete it.

fnordfish commented 1 year ago

Well, no idea what distro package maintainers do. But the official download (https://www.virtualbox.org/wiki/Linux_Downloads) includes the ISO - as it did since over a decade.

ilya-indigo commented 1 year ago

If I were virtulbox's mentainer, I would also remove the 51 MB file from the main package, which is not always needed by everyone, and supply it as a separate optional package.

But that doesn't cancel the problem I reported, caused by unnecessarily executing the umount /mnt command without checking if something is mounted in /mnt.

fnordfish commented 1 year ago

I'm not going to discuss decisions of other software or package maintainers.

If there's no of the local files, vbguest will default to download from the internet. Since the URL pattern hard-coded in vbguest is the same you configured, there should be no difference. However, since you obviously seeing a difference, there must be something else going on.

If you could provide a debug log (https://developer.hashicorp.com/vagrant/docs/other/debugging) we might find out the root cause.

ilya-indigo commented 1 year ago

Okay, I'll get it to you later.

dvhirst commented 1 year ago

I have a very different configuration, and am seeing this same issue.

Configuration:
Host: Windows 10 Pro (22H2 19045.3324), AMD Phenom(tm) II X4 965 Processor 3.41 GHz, 16 GB RAM Provider: VirtualBox 7.0.10 Vagrant: 2.3.7

Console shows (2023 09 06; 13:06:23):

E:\Vagrant Boxes\stg1.chambermusicamici>vagrant destroy --force
==> default: Destroying VM and associated drives...

E:\Vagrant Boxes\stg1.chambermusicamici>vagrant plugin list
vagrant-vbguest (0.31.0, global)

E:\Vagrant Boxes\stg1.chambermusicamici>set VAGRANT_LOG=debug

E:\Vagrant Boxes\stg1.chambermusicamici>vagrant up 2>&1 | Tee ".\vagrant.log"

I have pasted the resulting vagrant.log file into a Gist: "https://gist.github.com/dvhirst/0290a083e982272ca7c75e03373742b1s"

Meanwhile, I'll explore the work-around described above. Hopefully, it will allow me to move forward, pending a resolution of the issue.

2023 09 06; 15:03: I reran the process with the suggested update to the ISO location in the Vagrantfile. No joy, the same error sequence showed up, again. I'm stymied for now.

Thanks for taking a look. If you need additional information, please contact me at: mailto:dvhirst@aol.com.

DVH

ilya-indigo commented 1 year ago

Made debugging with iso_path definition and default.

https://gist.github.com/ilya-indigo/5ac3a472efd3089de6ee239aafc630c9

From default debugging I did not emphasize anything new for me. Without any attempt to even determine if I have the image on the host, immediately calling sudo umount /mnt.

 INFO interface: info: Unmounting Virtualbox Guest Additions ISO from: /mnt
Unmounting Virtualbox Guest Additions ISO from: /mnt
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: umount /mnt (sudo=true)
DEBUG ssh: stderr: 41e57d38-b4f7-4e46-9c38-13873d338b86-vagrant-ssh
DEBUG ssh: stderr: umount: /mnt: not mounted
 INFO interface: info: umount: /mnt: not mounted
dvhirst commented 1 year ago

OK, I see that the error comes up. What can be done about it? I don't see a fix or a work-around. Is one to come out soon? Also, if I look at the VM specs in VirtualBox, there is no optical drive defined for the instance, so how can umount work? Finally, I don't see the .iso file anywhere in the .vagrant folder, so of course access fails.

ilya-indigo commented 1 year ago

What can be done about it?

Vagrantconfig.yaml

if Vagrant.has_plugin?("vagrant-vbguest")
    config.vbguest.iso_path = "https://download.virtualbox.org/virtualbox/%{version}/VBoxGuestAdditions_%{version}.iso"
end
fnordfish commented 1 year ago

with regards to #432 can you try to downgrade VirtualBox to 7.0.6 and see if there's any difference?

ilya-indigo commented 1 year ago

with regards to #432 can you try to downgrade VirtualBox to 7.0.6 and see if there's any difference?

On openSUSE Tumbleweed as well as on any other rolling distribution where the latest stable kernel is regularly updated as well as all modules to it, including virtualbox this is not possible.

dvhirst commented 1 year ago

Yes, a downgrade for VirtualBox to 7.0.6 may make sense. I'll give that a try and report back here. I tried the if statement in my most recent Vagrantfile, it made no difference. Thanks.

dvhirst commented 1 year ago

Trying VirtualBox 7.0.6 shows other problems. I've run out of time for now. Will check back in a couple of weeks and see what has happened.