bash 使用 cygwin 访问 VirtualBox VM

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6022093/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 00:00:40  来源:igfitidea点击:

VirtualBox VM access with cygwin

bashwindows-7cygwinvirtualbox

提问by Matthias

I cannot access my virtual machines from the cygwin console. (Windows 7, UAC is disabled)

我无法从 cygwin 控制台访问我的虚拟机。(Windows 7,UAC 被禁用)

Matthias@laptop0x4d53 /cygdrive/c/Program Files/Oracle/VirtualBox
$ ./VBoxManage list vms

The Windows console, however, has access to my virtual machines.

但是,Windows 控制台可以访问我的虚拟机。

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list vms
"GlassFish" {68874e4d-817a-4315-9ea2-38726964ac32}
"Tomcat" {2e22a7c0-9950-4593-8eda-778d404476c7}
"LAMP" {36aa6968-df52-49b5-be52-1f59c50f1527}

Maybe it's a problem with the user's rights. How can I access my VMs from cygwin also?

可能是用户权限的问题。我怎样才能从 cygwin 访问我的虚拟机?

采纳答案by GmonC

Did you try the official forums? There are some solutions exporting some variables on ~/.bashrcand starting VB in headless mode (this is a recent post, from 2011). There's even an ugly hack about exporting a bunch of environment variables using bat files instead.

你试过官方论坛吗?有一些解决方案会在 ~/.bashrc 上导出一些变量并以无头模式启动 VB(这是 2011 年的最新帖子)。甚至还有一个关于使用 bat 文件导出一堆环境变量的丑陋技巧。

#export VBOX_USER_HOME='/cygdrive/c/Documents\ and\ Settings/SomeNameHere/.VirtualBox/'
export VBOX_USER_HOME='C:\Documents and Settings\SomeNameHere\.VirtualBox\'

...or HOWTO - virtualbox as a service on Windows (cygrunsrv.exe). This is reported to be working on Cygwin 1.7b.

...或HOWTO - virtualbox 作为 Windows 上的服务 (cygrunsrv.exe)。据报道,这适用于 Cygwin 1.7b。

$ cygrunsrv --list
vboxd-myvm

回答by shellter

This answer is in the spirit of 'consider this possibility' ;-)

这个答案本着“考虑这种可能性”的精神;-)

How 'married' are you to cygwin as your unix tool on windows? My experience with cygwin is that is very slow but it's strength is that it comes with a wide range of linux-like tools AND probably has the largest user-support community.

您与 cygwin 作为 Windows 上的 unix 工具有多“结婚”?我使用 cygwin 的经验是它非常慢,但它的优势在于它带有广泛的类似 linux 的工具,并且可能拥有最大的用户支持社区。

There are at least 2 alternatives to cygwin that I use and can recommend AND with a quick test DID return the list of my active vms_s. They are UWIN and MinGW.

我使用的 cygwin 至少有 2 种替代方案,可以推荐并通过快速测试 DID 返回我的活动 vms_s 列表。他们是 UWIN 和 MinGW。

Read my writeup about ksh and UWIN here Regarding 'for' loop in KornShell(2 nd msg)

在这里阅读我关于 ksh 和 UWIN 的文章关于KornShell 中的 “for”循环(第二个消息)

ALSO check out the MinGWenvironment. I have installed MinGW primarily to have access to gcc (outside of cygwin) and it has a fair number of linux-like tools.

还请查看MinGW环境。我安装 MinGW 主要是为了访问 gcc(在 cygwin 之外),它有相当多的类似 linux 的工具。

I hope this helps.

我希望这有帮助。

回答by KarlAtCisco

Easy to fix - you need to use Windows path syntax in your .bashrc

易于修复 - 您需要在 .bashrc 中使用 Windows 路径语法

This - VBOX_USER_HOME='C:\Documents and Settings\user.VirtualBox'

这 - VBOX_USER_HOME='C:\Documents and Settings\user.VirtualBox'

Instead of this - VBOX_USER_HOME=/cygdrive/c/users/user/.VirtualBox

而不是这个 - VBOX_USER_HOME=/cygdrive/c/users/user/.VirtualBox