I have yet to figure out what the actual difference between a dumb lil blog post and a normal page is? it seems arbitrary.
Requirements
At least ubuntu 22.10
Installing
Vagrant supports VirtualBox 7.x from version 2.3.0. This version is not present in Ubuntu 22.04 repos. So either install 22.10 or figure something out.
Setting it up and fixing the broken stuff
You wanna install the virtualbox WSL2 plugin: vagrant plugin install virtualbox_WSL2
Now we need to tell Vagrant to use the VBox installation on the Windows Host. Slap this into your bashrc or something:
export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox" export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
Now it will work, but it will prompt you for a password. The default password for a vagrant box is "vagrant" by the way.
But we want to fix that cause it's annoying. The issue lies within the file permissions of the mounted Windows / NTFS drive.
The solution is to change those file permissions, by putting something like this into /etc/wsl.conf:
# Enable extra metadata options by default [automount] enabled = true root = /mnt/ options = "metadata,umask=77,fmask=11" mountFsTab = false
And now you could work! Unless you are on a laptop.
The firewall rules that allow the Vagrant Box to talk to WSL are for some reason automatically installed to the network device.
That means if you set this all up on Ethernet, but then switch to WiFi, it will no longer work.
Something like that anyways, I haven't looked too much into it.
Anyways if you want to fix it, open up a elevated powershell and put the following:
New-NetFirewallRule -Name WSLVagrantSSH -DisplayName "Allow WSL2 Vagrant SSH" -Direction Inbound -LocalPort 2222 -Protocol TCP -Action Allow