Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Printing from Virtualbox

August 09, 2023 — Gregg Szumowski

If you want to set up your system so that you can access your Linux host’s printer from a Windows VirtualBox client then:

On Your Linux Host

  1. Install your printer driver. Get your printer working on your host first.
  2. Install CUPS if it is not already installed.
  3. Add your printer to CUPS at http://localhost:631/admin.
  4. Set your virtual machine’s Network to Bridged Adapter (eth0) in Settings and connect the cable as necessary (Advanced menu).
  5. Startup VirtualBox.
  6. In a terminal, enter ifconfig to list your current network settings and copy down your host’s (eth0) address or you can optionally access this address using Network Manager.

On You Windows Client

  1. Add a new Network printer in “Printers and Faxes” from the Control Panel
  2. Enter the URL address of your host’s printer, i.e., http://192.168.0.2:631/printers/Your_printer's_name. You need the :631 after your host’s address as this is the port that CUPS listens to. The Your_printer’s_name is the name of the printer you added to CUPS.

If you can’t establish a connection then check your firewall settings.

Tags: cli, virtualbox, printing, motd

Export VirtualBox VDI using CLI

June 14, 2023 — Gregg Szumowski

Sometimes you may want to move a virtual machine in VirtualBox from one server to another. Once way of doing that is to export it from the command line.

  1. Locate the virtual machine that you want to export (I’ll use the name UbuntuServer for the one to be exported and name the new one UbuntuServerNew), and then
  2. Run the export command as follows:

$ vboxmanage export UbuntuServer -o UbuntuServerNew.ova

Tags: cli, virtualization, virtualbox, motd

How to convert VirtualBox VDI to KVM qcow2

May 10, 2023 — Gregg Szumowski

It is easy to convert a VirtualBox VDI image to a KVM qcow2 file. You have to use the RAW file format as an intermediate.

Make sure the VirtualBox machine is shutdown.

  1. Convert the VDI to a raw disk image.
    Note: VDIs are compressed and raw images are not, so you will need to leave enough disk space for entire uncompressed disk.

    $ VBoxManage clonehd --format RAW vm.vdi vm.img

  2. Then on your KVM host:
    $ qemu-img convert -f raw vm.img -O qcow2 vm.qcow2

Tags: virtualization, virtualbox, kvm, qcow2, motd