7

I have a virtualbox headless VM running on CentOS 7. I can show the console of the VM by opening up the virtualbox manager, right clicking the machine and choose "Show". Is there a way to do this (pop up the head of the headless client) without opening up the gui manager, i.e., from the command line? I've tried most likely commands for vboxmanage but get errors or the wrong result.

9
  • 2
    Would ssh into the VM give you the same access, or do you require the console for some other reason?
    – jc__
    May 12, 2017 at 14:00
  • I require the console. It's a windows-10 instance and I need to access the desktop apps.
    – ChrisDR
    May 12, 2017 at 14:35
  • 2
    If you wanted to keep it 'headless' you could enable the remote display and access it from any VNC viewer. Or not start in headless mode at all.
    – jc__
    May 12, 2017 at 15:06
  • 2
    Make that RDP viewer not VNC.
    – jc__
    May 12, 2017 at 15:15
  • 1
    @ChrisDR : (1) You just partially shot yourself in the foot.  You say that the question “could apply to any client”, reinforcing the ambiguity regarding scope. (2) If your host PC is running CentOS, that (at least potentially) makes the question on-topic at U&L — but you should edit your question to mention that, and not hide it here in the comments. (3) I’d suggest that you be patient for another day or two, and see whether anybody posts an answer. If you get no response, click on “flag”, “in need of moderator intervention”, and explain that you want your question moved to Super User. May 15, 2017 at 4:02

2 Answers 2

2

So far, no answers. After more research it looks like VirtualBox does not provide this functionality. Best that it seems I can do is to use a remote desktop. For my CentOS, the most convenient app is rdesktop. You need to have the extension pack installed. Then enable remote desktop protocol for the client. Once the VM is running you can then use rdesktop to access the client console. If rdesktop is started immediately after the VM, you do get access to the boot sequence. Thus:

$ vboxmanage modifyvm "archive" --vrde on
$ vboxmanage startvm "archive" --type headless ; rdesktop localhost 
0

If I'm not mistaken, you can do this with a serial port, but it's complicated.

First of all, you need to add a serial port to the VM. The serial port needs to be put in "Host Pipe" mode, so you can connect it to your host file system, where you'll monitor the console.

COM1="0x3F8 4"   # magic values for COM1
VBoxManage modifyvm <UUID> \
    --uart1 $COM1 \
    --uartmode1 server /tmp/serial-console

There are some other options you can use, but with this, VirtualBox should create /tmp/serial-console when the machine is started. If you don't need to get fancy here, you can also use "file" instead of "server" to just dump the console to a regular file. But if you want, you can connect that file path with a pseudo-terminal (PTY) using socat.

SOCK=/tmp/serial-console
socat UNIX-CONNECT:$SOCK PTY,link=$SOCK-pty

Finally, you can connect to the PTY using screen

screen $SOCK-pty

On Linux, you'll probably need to enable to serial console. The process for this depends on your distro. You can check the link below to see if that might help, but it's targeted at Debian.

https://gist.github.com/snb/284940/11e6354f170be602c9c2f67b59d489ed49ebd143

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .