Mistaken Platform on Windows (PR suggestion)


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 opt 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.


First of all: I am impressed about all your efforts for solving the problem :open_mouth:

However from my personal point of view I think that the github repository is the better place for talking about code changes. So I would recommend to read the contributing guidelines here: vagrant/CONTRIBUTING.md at main · hashicorp/vagrant · GitHub to get the fix into vagrant.

Thank you; the contributing guidelines mentioned this forum as a place to open discussion but as you say this is a defect fix so going github directly is probably better. :slight_smile:

the contributing guidelines mentioned this forum as a place to open discussion

I haven’t been aware of that :see_no_evil:. Maybe I should read the documents before posting a link to them.

I have the same problem on WSL with 2.2.19 - was a fix ever submitted? If not, can you kindly share the work-around?
I’m using Ubuntu.

many thanks

Please ignore my post above. I resolved the issue by updating and reinstalling the plugins. :wink: