【问题标题】:Vagrant VM is running but not showing in VirtualBoxVagrant VM 正在运行但未在 VirtualBox 中显示
【发布时间】:2016-11-02 10:20:42
【问题描述】:

我已经安装了 Jenkins(2.74 版)并安装了 vagrant 插件。创建了一个创建 vagrantfile 并执行 vagrant box add 命令的作业

vagrant box add test solaris.box

并执行vagrant up 命令,VM 在 jenkins 作业中成功运行。

但虚拟机没有显示在 VirtualBox Manager 中。

在命令提示符下,VBoxManage.exe list vms 命令也没有列出正在运行的 VM 名称。

流浪者版本:1.7.4 VirtualBox 版本:5.0.12

命令提示符输出:

D:\>vagrant global-status
id       name    provider   state   directory
------------------------------------------------------------------------
ee544e4  default virtualbox running D:/nBOL_VMS/nbolapp
67df2d1  default virtualbox running D:/nBOL_VMS/nbolapptest
206a5c8  default virtualbox running D:/nBOL_VMS/Jenkins-slave


VBoxManage.exe list runningvms

当我执行VBoxManage.exe list runningvms 时,我的命令提示符输出显示为空。

Jenkins 输出:

Vagrant global Status : 
id       name    provider   state   directory                           
------------------------------------------------------------------------
ee544e4  default virtualbox running D:/nBOL_VMS/nbolapp                 
67df2d1  default virtualbox running D:/nBOL_VMS/nbolapptest             
206a5c8  default virtualbox running D:/nBOL_VMS/Jenkins-slave

VBoxManage list runningvms
"nbolapptest" {bc04dd64-c868-4304-a3b7-eff6d66f862e}
"Jenkins-slave" {c73ead23-ecd7-499d-b5b9-2d52c3b49d7e}
"nbolapp" {4c762312-013e-4ae7-9649-8239abe0f92d}

VBoxManage showvminfo bc04dd64-c868-4304-a3b7-eff6d66f862e
Name:            nbolapptest
Groups:          /
Guest OS:        Oracle Solaris 11 (64-bit)
UUID:            bc04dd64-c868-4304-a3b7-eff6d66f862e
Config file:     C:\Users\sbsa\VirtualBox VMs\nbolapptest\nbolapptest.vbox
Snapshot folder: C:\Users\sbsa\VirtualBox VMs\nbolapptest\Snapshots
Log folder:      C:\Users\sbsa\VirtualBox VMs\nbolapptest\Logs
Hardware UUID:   bc04dd64-c868-4304-a3b7-eff6d66f862e
Memory size:     8192MB
Page Fusion:     off
VRAM size:       12MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  2
PAE:             off
Long Mode:       on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
Time offset:     0ms
RTC:             UTC
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     on
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Default
State:           running (since 2016-11-07T11:40:20.291000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration: 
Autostart Enabled: off
Autostart Delay: 0
Default Frontend: 
Storage Controller Name (0):            SATA
Storage Controller Type (0):            IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  30
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
SATA (0, 0): C:\Users\sbsa\VirtualBox VMs\nbolapptest\box-disk1.vmdk (UUID: 03b32e37-f77c-456c-a4e9-fe6753d87761)
SATA (1, 0): Empty
NIC 1:           MAC: 080027015DD9, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
NIC 1 Rule(1):   name = tcp1521, protocol = tcp, host ip = , host port = 1521, guest ip = , guest port = 1521
NIC 1 Rule(2):   name = tcp6000, protocol = tcp, host ip = , host port = 6000, guest ip = , guest port = 6000
NIC 1 Rule(3):   name = tcp8080, protocol = tcp, host ip = , host port = 2200, guest ip = , guest port = 8080
NIC 1 Rule(4):   name = tcp9043, protocol = tcp, host ip = , host port = 9043, guest ip = , guest port = 9043
NIC 1 Rule(5):   name = tcp9060, protocol = tcp, host ip = , host port = 9060, guest ip = , guest port = 9060
NIC 1 Rule(6):   name = tcp9443, protocol = tcp, host ip = , host port = 9443, guest ip = , guest port = 9443
NIC 2:           MAC: 0800272C9857, Attachment: Bridged Interface 'Intel(R) Ethernet Connection (2) I219-LM', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           enabled (Driver: DSOUND, Controller: AC97, Codec: STAC9700)
Clipboard Mode:  disabled
Drag and drop Mode: disabled
Session name:    headless
Video mode:      1024x768x32 at 0,0 enabled
VRDE:            disabled
USB:             enabled
EHCI:            disabled
XHCI:            disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:  

Name: 'vagrant', Host path: 'D:/nBOL_VMS/nbolapptest' (machine mapping), writable

VRDE Connection:    not active
Clients so far:     0

Video capturing:    not active
Capture screens:    0
Capture file:       C:\Users\sbsa\VirtualBox VMs\nbolapptest\nbolapptest.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25

Guest:

Configured memory balloon size:      0 MB
OS type:                             Solaris_64
Additions run level:                 2
Additions version:                   4.3.18 r96516


Guest Facilities:

Facility "VirtualBox Base Driver": active/running (last update: 2016/11/07 11:41:19 UTC)
Facility "VirtualBox System Service": active/running (last update: 2016/11/07 11:41:47 UTC)
Facility "Seamless Mode": not active (last update: 2016/11/07 11:41:19 UTC)
Facility "Graphics Mode": not active (last update: 2016/11/07 11:41:19 UTC)

通过 jenkins 作业执行上述命令时,它会显示所有详细信息。 会有什么问题。

【问题讨论】:

  • 可能是因为 Jenkins 以不同的用户身份运行?
  • Jenkins 仅以管理员身份运行。而且我们只使用管理员帐户
  • 您的系统上是否有可能运行另一个虚拟机?启动你的虚拟机并检查为虚拟框运行的进程以检查它来自哪里
  • 场景是,我们在终端中使用 vagrant 命令手动启动了一个虚拟机,并显示在 VirtualBox Manager 中。然后在不同位置的詹金斯的帮助下,我们尝试启动另一个虚拟机,但虚拟机没有显示在 VirtualBox Manager 中。我们检查了任务管理器,发现virtualbox进程正在运行,对应于通过jenkins启动的VM。但它没有显示在 VirtualBox 管理器中。
  • 现在我已经从 VirtualBox GUI 中手动删除了 VM。然后触发 jenkins 作业来创建虚拟环境。现在它显示在 VirtualBox GUI 中但显示错误状态

标签: jenkins vagrant virtualbox


【解决方案1】:

(对于 Windows)尝试以管理员身份运行虚拟机,看看现在是否可以看到正在运行的虚拟机。

【讨论】:

    【解决方案2】:

    以 root 身份运行虚拟框:

    sudo virtualbox

    【讨论】:

      【解决方案3】:

      在 Windows 10 中,仅当 cmd(Vagrant 的启动位置)和 VirtualBox Manager 均以普通用户身份启动或两者均以管理员身份启动时,VirtualBox 管理器中才会显示 Vagrant Box。如果你从cmd 以管理员身份启动 Vagrant,VirtualBox Manager 以普通用户身份启动 Vagrant Box 将不会显示在VirtualBox Manager 中。

      【讨论】:

        【解决方案4】:

        如果您更改启动 VM 服务的凭据并为用户配置用于启动 VirtualBox Manager 的管理权限,它将正常工作。

        【讨论】:

          【解决方案5】:

          我在 Windows 10 中通过运行我以管理员身份运行 Vagrant 命令的 Powershell 窗口解决了这个问题。一旦我这样做了,即使它不是以管理员身份启动的,VirtualBox 也会开始显示正确的状态。

          【讨论】:

            【解决方案6】:

            你必须以 su 用户# 权限或 sudo virtualbox 启动 virtualbox 或以 root 身份登录 ubuntu 并且它会工作我第一次遇到同样的问题,但它是这样修复的

            【讨论】:

              【解决方案7】:

              我正在使用 Ubuntu 20.04.1 LTS。 我也遇到了同样的错误,无法看到我的虚拟机是使用 vagrant 创建的。

              $ sudo virtualbox

              这个命令对我有用

              原因:- 因为当我使用 vagrant 创建虚拟机时,我是以 root 用户身份登录的。

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 2014-11-11
                • 1970-01-01
                • 2017-03-11
                相关资源
                最近更新 更多