windows - Vagrant with Virtualbox on WSL unable to access Windows environment
问题描述
I have successfully followed steps on vagrant website to setup vagrant on WSL with VirtualBox including setting the windows path and all. but as soon as I try to run
sudo vagrant something up
it throws the following error
Vagrant failed to initialize at a very early stage:
Vagrant is unable to use the VirtualBox provider from the Windows Subsystem for Linux without access to the Windows environment. Enabling this access must be done with caution and an understanding of the implications. For more information on enabling Windows access and using VirtualBox from the Windows Subsystem for Linux, please refer to the Vagrant documentation:
Host OS
Edition: Windows 10 Home Single Language Version: 20H2 OS Build: 19042.870
Ubuntu WSL Description: Ubuntu 20.04 LTS
解决方案
This is caused when VAGRANT_WSL_ENABLE_WINDOWS_ACCESS
environment variable is not set.
- First Export Environment Variables
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
export PATH="${PATH}:/mnt/c/Program Files/Oracle/VirtualBox"
- Run Vagrant using following commands
vagrant up something
if you want to run it as sudo
sudo -E vagrant up something
"E" flag preserves the environment variables while using sudo. if this flag is not used the exported environment variables will not be avalaible.
推荐阅读
- xamarin - 如何在代码隐藏中创建 Xamarin 工具提示
- apache-spark - Spark createDataFrame(df.rdd, df.schema) vs checkPoint 打破血统
- python - 如何检查函数的返回值是否分配给Python中的任何内容
- sql - 如何将 UTF-8 .txt 文件从 SSIS 导出到 Azure Blob 目标?
- python-3.x - 在python中访问相对路径
- python-3.x - python列表中的无限循环问题
- hadoop - HADOOP 3.1.2 Namenode 未启动
- javascript - 赛普拉斯测试在使用调用()文本方法时抛出无法识别的表达式
- c++ - 如何在 C++ 中打印非 ascii-char
- python - 这些 conda 包解析警告是什么意思,可以安全地忽略它们吗?