You are not logged in.

#1 2020-07-25 23:53:10

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

VirtualBox VM Command Line

Hello fellow Arch users,

I am trying to run a virtual machine on my Arch Linux install (both running Arch), and am having trouble accessing the terminal of the VM. 

So far, I have created the virtual machine, created the virtual hard disk, and mounted the Arch Linux iso (the vm is Arch Linux inside of Arch Linux).  The VM starts up fine, but I can't figure out how to access the terminal of the VM from the terminal of the host.

The guest is running in headless mode, started using:

vboxmanage startvm test --type headless

The vm is listed as active by Virtual Box, but I don't know how to enter that environment.

I also tried using:

vboxheadless --startvm test

Which gives me access to the VM's output, but does not appear to accept input.  (There is no output, so this is just a blank screen, I am assuming it is output because that is what the Virtual Box manual tells me).

My first thought was to SSH into the VM.  The output for

ip link

was

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether c4:34:6b:05:59:cc brd ff:ff:ff:ff:ff:ff
3: wlo1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether 3e:8c:71:4f:68:3b brd ff:ff:ff:ff:ff:ff

so I created a virtual network adapter using

VBoxManage modifyvm OracleLinux6Test --nic1 bridged --bridgeadapter1 eno0

The IP does not show up on my router's list of connected devices, so either I did this incorrectly or it isn't supposed to work - I really don't know.


Either way, is there a command that I can use from the host machine to access the guest machine?  I can't complete the guest's Arch install without access to its terminal. 

Many thanks!

Last edited by eric.meehan (2020-07-25 23:57:28)

Offline

#2 2020-07-26 00:02:16

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

Re: VirtualBox VM Command Line

Here are some additional details about the VM, collected using:

vboxmanage showvminfo test
Name:                        test
Groups:                      /
Guest OS:                    Other/Unknown
UUID:                        e59a64ca-b41e-4906-9294-33efc56f7e7f
Config file:                 /home/eric/.config/VirtualBox/vm/test/test.vbox
Snapshot folder:             /home/eric/.config/VirtualBox/vm/test/Snapshots
Log folder:                  /home/eric/.config/VirtualBox/vm/test/Logs
Hardware UUID:               e59a64ca-b41e-4906-9294-33efc56f7e7f
Memory size                  128MB
Page Fusion:                 disabled
VRAM size:                   8MB
CPU exec cap:                100%
HPET:                        disabled
CPUProfile:                  host
Chipset:                     piix3
Firmware:                    BIOS
Number of CPUs:              1
PAE:                         enabled
Long Mode:                   enabled
Triple Fault Reset:          disabled
APIC:                        enabled
X2APIC:                      disabled
Nested VT-x/AMD-V:           disabled
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:                        enabled
IOAPIC:                      enabled
BIOS APIC mode:              APIC
Time offset:                 0ms
RTC:                         local time
Hardware Virtualization:     enabled
Nested Paging:               enabled
Large Pages:                 disabled
VT-x VPID:                   enabled
VT-x Unrestricted Exec.:     enabled
Paravirt. Provider:          Default
Effective Paravirt. Prov.:   None
State:                       running (since 2020-07-25T18:36:09.197000000)
Graphics Controller:         VBoxVGA
Monitor count:               1
3D Acceleration:             disabled
2D Video Acceleration:       disabled
Teleporter Enabled:          disabled
Teleporter Port:             0
Teleporter Address:          
Teleporter Password:         
Tracing Enabled:             disabled
Allow Tracing to Access VM:  disabled
Tracing Configuration:       
Autostart Enabled:           disabled
Autostart Delay:             0
Default Frontend:            
VM process priority:         default
Storage Controller Name (0):            IDE Controller
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA Controller
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      30
Storage Controller Bootable (1):        on
IDE Controller (0, 0): /home/eric/archlinux.iso (UUID: 204d20fb-7a09-4f60-b27c-d9d242b48d04)
SATA Controller (0, 0): /home/eric/vm/test/test.vdi (UUID: 78e0492f-6e38-4360-b7c6-65ab897dcda4)
NIC 1:                       MAC: 080027B3ED54, Attachment: Bridged Interface 'eno1', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2:                       disabled
NIC 3:                       disabled
NIC 4:                       disabled
NIC 5:                       disabled
NIC 6:                       disabled
NIC 7:                       disabled
NIC 8:                       disabled
Pointing Device:             PS/2 Mouse
Keyboard Device:             PS/2 Keyboard
UART 1:                      disabled
UART 2:                      disabled
UART 3:                      disabled
UART 4:                      disabled
LPT 1:                       disabled
LPT 2:                       disabled
Audio:                       enabled (Driver: ALSA, Controller: AC97, Codec: STAC9700)
Audio playback:              disabled
Audio capture:               disabled
Clipboard Mode:              disabled
Drag and drop Mode:          disabled
Session name:                headless
Video mode:                  640x480x24 at 0,0 enabled
VRDE:                        disabled
OHCI USB:                    disabled
EHCI USB:                    disabled
xHCI USB:                    disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:<none>

VRDE Connection:             not active
Clients so far:              0

Capturing:                   not active
Capture audio:               not active
Capture screens:             0
Capture file:                /home/eric/.config/VirtualBox/vm/test/test.webm
Capture dimensions:          1024x768
Capture rate:                512kbps
Capture FPS:                 25kbps
Capture options:             

Guest:

Configured memory balloon size: 0MB
OS type:                     Other
Additions run level:         0

Guest Facilities:

No active facilities.

Offline

#3 2020-07-26 07:44:36

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: VirtualBox VM Command Line

Groups:                      /

Just curious about this. I have a feeling you have to be root to issue this command.
I'm not sure if it will work but perhaps adding yourself to group vboxusers?

Offline

#4 2020-07-26 20:51:10

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

Re: VirtualBox VM Command Line

d_fajardo wrote:
Groups:                      /

Just curious about this. I have a feeling you have to be root to issue this command.
I'm not sure if it will work but perhaps adding yourself to group vboxusers?

What would I do after that?  I still can't ssh into the VM or use a Remote Desktop to view it.

Offline

#5 2020-07-26 21:55:15

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: VirtualBox VM Command Line

Unless you are very experienced with using VirtualBox, I recommend against trying to get a guest installation started on headless. Run X on the host and boot the VM "normally" so you get the actual console to launch the Arch ISO. You also don't have IPv4 on the host, which probably adds another layer of complexity.

Offline

#6 2020-07-26 22:20:26

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

Re: VirtualBox VM Command Line

twelveeighty wrote:

Unless you are very experienced with using VirtualBox, I recommend against trying to get a guest installation started on headless. Run X on the host and boot the VM "normally" so you get the actual console to launch the Arch ISO. You also don't have IPv4 on the host, which probably adds another layer of complexity.

Would it be possible to create the VM on a separate machine and then import it into the Arch server?  Would there be compatibility problems I would end up having to deal with?

Offline

#7 2020-07-26 23:01:54

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: VirtualBox VM Command Line

Would it be possible to create the VM on a separate machine and then import it into the Arch server?

Virtualbox has a function to clone virtual machine but the cloned machine will always a different uuid from the original one and could be an issue importing it (something I've experienced before). The workaround is to make note of the original machine uuid, - i.e. vboxmanage showvminfo <uuid> - and then after cloning you can change the cloned machine uuid as the original one something like vboxmanage modifyvm "clone machine" --hardwareuuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Offline

#8 2020-07-27 00:04:32

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

Re: VirtualBox VM Command Line

d_fajardo wrote:

Would it be possible to create the VM on a separate machine and then import it into the Arch server?

Virtualbox has a function to clone virtual machine but the cloned machine will always a different uuid from the original one and could be an issue importing it (something I've experienced before). The workaround is to make note of the original machine uuid, - i.e. vboxmanage showvminfo <uuid> - and then after cloning you can change the cloned machine uuid as the original one something like vboxmanage modifyvm "clone machine" --hardwareuuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

I do appreciate the suggestion, but I wold rather actually solve the problem if possible.  I am suspicious of the network card since it reads 0 upload and 0 download:

NIC 1:                       MAC: 080027B3ED54, Attachment: Bridged Interface 'eno1', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none

Offline

#9 2020-07-27 20:06:10

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: VirtualBox VM Command Line

eric.meehan wrote:

I do appreciate the suggestion, but I wold rather actually solve the problem if possible.  I am suspicious of the network card since it reads 0 upload and 0 download:

The problem is that you are running the Live-ISO completely blind. How do you know if the guest has initialized its virtual network card? If the guest's card is not connected, you would also see 0 upload and 0 download. What is the "default" option on the Live ISO? Maybe there isn't one and it just sits there waiting for input...?

Last edited by twelveeighty (2020-07-27 20:07:13)

Offline

#10 2020-07-27 23:18:30

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

Re: VirtualBox VM Command Line

twelveeighty wrote:
eric.meehan wrote:

I do appreciate the suggestion, but I wold rather actually solve the problem if possible.  I am suspicious of the network card since it reads 0 upload and 0 download:

The problem is that you are running the Live-ISO completely blind. How do you know if the guest has initialized its virtual network card? If the guest's card is not connected, you would also see 0 upload and 0 download. What is the "default" option on the Live ISO? Maybe there isn't one and it just sits there waiting for input...?

I don't know what the default option is for the Live ISO, but it is just the Arch Linux ISO, so it should be able to connect automatically.  In fact, I am becoming more confident that this is the problem - I created a different VM on my Windows PC using the exact same settings as a test, and my router recognized the VM and gave it a unique IP immediately.  This does not happen when the VM is in the Arch host. 

With the instructions given on the wiki and the VirtualBox documentation, I am relatively certain I am setting up the bridged connection correctly.  Could it be that something in the host system is blocking it?

Offline

#11 2020-07-28 15:03:32

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: VirtualBox VM Command Line

eric.meehan wrote:

I don't know what the default option is for the Live ISO

Well - since you didn't want to check for yourself, I did a quick check and there isn't a default option and it's waiting for input to boot up the OS. That's why there's no network.

Offline

#12 2020-07-28 19:31:26

eric.meehan
Member
Registered: 2020-01-01
Posts: 52

Re: VirtualBox VM Command Line

twelveeighty wrote:
eric.meehan wrote:

I don't know what the default option is for the Live ISO

Well - since you didn't want to check for yourself, I did a quick check and there isn't a default option and it's waiting for input to boot up the OS. That's why there's no network.

Well that makes sense, but it doesn't seem to indicate a method for solving the problem. 

I've been trying a different approach by creating the VM in Libvirt:

virt-install --name test --memory 1024 --vcpus=2,maxvcpus=4 --cpu host --cdrom /var/lib/libvirt/isos/archlinux.iso --disk size=2,format=qcow2 --network network=default --virt-type kvm --graphics vnc,listen=0.0.0.0 --noautoconsole

I then use TigerVNC to start a VNC server on the host

vncserver

And create an SSH tunnel from my Mac to access the server:

ssh 192.168.0.100 -L 5900:localhost:5900

And then use the Screen Sharing app to access the guest machine.  This feels closer (and is in the end a more efficient method of running VMs), but still has a similar problem.  The screen sharing app connects to the server, but just displays a grayed out screen.

Offline

#13 2020-07-29 21:04:43

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: VirtualBox VM Command Line

eric.meehan wrote:

Well that makes sense, but it doesn't seem to indicate a method for solving the problem.

I already gave you a solution to the problem in post #5. You are using exotic ways to launch the VM but the guest does not boot unless you hit the "Enter" key. There is literally zero point in trying to "connect" to it, since it's not booted up. Use a regular (non-headless) install and then cut a VM template from that. Or patch the ISO script to have it autostart and roll your own Live CD.

Offline

#14 2020-08-03 18:45:32

giovannotti69
Member
Registered: 2017-02-02
Posts: 5

Re: VirtualBox VM Command Line

Hi Eric
In the VM properties you might see the following parameter:
VRDE:                        disabled

This parameter and the VRDE port allows you connect to the VM's virtual console.
You can adjust those parameters either by the graphical VBox console or by the following commands:

$ VBoxManage modifyvm VM-name --vrde on

and

$ VBoxManage modifyvm VM-name --vrdeport XXXXX

Where XXXXX is the desired port you can connect

Now, after modifying those parameters and having started the VM, from the outside you can connect to you HOST machine at the port you specified before, just like

$ rdesktop 192.168.0.10:15001 (i.e. 192.168.0.10 is you host machine's IP and 15001 the port you specified), or using the remote desktop connection of Windows: 192.168.0.10:15001

So you can connect to your VM's console


Please bare in mind to have the RDP port enabled in your firewall configuration

Best Regards!

Last edited by giovannotti69 (2020-08-03 18:54:29)

Offline

#15 2020-08-03 18:48:03

giovannotti69
Member
Registered: 2017-02-02
Posts: 5

Re: VirtualBox VM Command Line

Hi Eric

Forgot to menction that the first command you wrote is normally the one when working with "headless" VM's:

vboxmanage startvm test --type headless

Best Regards

Last edited by giovannotti69 (2020-08-03 18:48:29)

Offline

Board footer

Powered by FluxBB