1

I want to start a VirtualBox VM in headless mode and view the network boot process in the terminal via a serial console (e.g. using screen or minicom). How do I accomplish this?

Additional context follows.


I have a VirtualBox VM which I'm using to experiment with PXE network booting. The VM is named pxeclient and is running Debian.

I followed the instructions described in the following blog posts to configure a serial port for the VM:

Here is a brief description of what I did to configure the serial console.

First I attached a UART serial port to the VM:

touch "/dev/pxeclient-uart-port"
vboxmanage modifyvm "client" --uart1 "0x3F8" '4'
vboxmanage modifyvm "client" --uartmode1 server "/dev/pxeclient-uart-port"

Then I modified the grub configuration file on the VM (via the GUI interface):

cat <<HEREDOC > /etc/default/grub
# NOTE: Enable Virtual Serial Console for VirtualBox
GRUB_DEFAULT=0
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=$(lsb_release -i -s 2> /deb/null || echo Debian)
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="console=ttyS0 console=tty0 ignore_loglevel"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=0 --word=0 --word=8 --parity=no --stop=1"
HEREDOC

I then used the minicom program to connect to the VM console:

minicom -D unix#/dev/pxeclient-uart-port

Everything so far seems to work as expected. I'm able to attach to the console successfully and after starting the VM (in headless mode) I'm able to watch the boot process via the terminal.

Then I change the boot order on the VM in order to perform a network boot with PXE:

vboxmanage modifyvm 'pxeclient' --boot1 'net' --boot2 'none' --boot3 'none' --boot4 'none'

But when I start the VM I don't see any output written to the terminal. If I restart the VM with a GUI interface than I'm able to watch the PXE boot process in the GUI window, but the same output isn't displayed via the serial console.

I prefer to run all of my VMs in headless mode. Is there some additional configuration that I need to perform in order to be able to monitor the network boot process via the serial console?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.