Quick context: I use Windows 10 pro, and have recently swapped to use WSL2 rather than run Ubuntu under VirtualBox. However I do use Vargant with Hyper-V for some development.
I’ve discovered that if I have a the WSL2 files mounted say as U: and I execute any vagrant command
vagrant version this fails with
C:/HashiCorp/Vagrant/embedded/gems/2.2.14/gems/vagrant-.2.14/plugins/hosts/suse/host.rb:20:in `initialize': Cannot translate name. @ rb_sysopen - /etc/os-release (Errno::ELOOP)
On investigation I’ve discovered this is because in the plugins/hosts, examples such as suse/hosts.rb check for the existance of /opt/os-releases, and then try and open it.
Remember though that this a WSL2 mounted filesystem - so if you walk up the directory tree to the root, and then look for
os-releases then this exists… but it the path of
/opt/os-releases can’t really be opened.
I’ve tried a change to surrond the code with being…rescue statements and return false if an error occurs.
Everything is then good - and the correct (Windows) is recognised.
I’m happy to submit a PR for this if the community would welcome it.