Skip to content

VirtualBox VM Essentials

InfiniteQE edited this page Apr 15, 2021 · 3 revisions

The VirtualBox VM requires several upgrades and maintenance tasks.

  1. The provided VM image is an older Linux version which does not have headers available via apt-get

  2. The VirtualBox Guest Additions are very helpful, they allow window resizing, shared clipboard between HostOS and VM, shared folders, and allows the correct time in the VM.

  3. The Guest Additions require the Linux Headers.

  4. The VM image get very bloated, shrinking it can reclaim 100GB+ of space

Upgrade your Linux dist

The mynodebtc VirtualBox .OVA is running an old unsupported Linux Kernel.

The VBox VM image is using an older Linux kernel 4.19.0-6-amd64

The only way to update the linux-headers is to first

sudo apt-get update

sudo apt-get dist-upgrade

Note this step wipes /etc/fstab such that the /dev/sda1 becomes read only (which breaks mynodebtc) !!

The best course of action would be to make a backup of /etc/fstab before dist-upgrade

However if you have already broken your mynodebtc with a readonly VM OS partition, you can fix it with the following steps

From the terminal, sudo mount -n -o remount,rw -t ext4 /dev/sda1 /

This will load the mynodebtc GUI login screen, you will need to Right click > Terminal emulator

sudo cat /etc/fstab

If your UUID is not there, you need to either restore the fstab backup you made before sudo apt-get dist-upgrade or manually add the UUID back

sudo blkid /dev/sda1

Note the UUID and add it to /etc/fstab

sudo nano /etc/fstab

UUID=type-your-uuid-with-dashes-here / ext4 errors=remount-ro 0 1

^X Save

sudo reboot now

Everything will work correctly, time is now in sync, you can install the linux-headers, then install the VBoxLinuxAdditions

Installation instructions for Linux kernel headers and VirtualBox Guest Additions :

I am running the OracleVM version on a NUC i7. I placed the VM files on a 1TB SSD and it has been working perfectly.

I downloaded and installed on the Host Machine : Oracle VM VirtualBox Extension Pack, in addition to VirtualBox.

On the host NUC I had to disable secure boot in BIOS and setup networking as NAT in VirtualBox. (Networking and other changes require a VM reboot)

Then in mynodebtc VirtualBox VM I needed to install Kernel headers :

sudo apt-get install linux-headers-$(uname -r)

Note : See my wiki post on upgrading your Linux dist if the linux-headers install fails !

To mount the guest additions virtual CD image, it is in the VirtualBox pull down menu

cd /mnt/hdd

mkdir share

sudo mount -t iso9660 -o ro /dev/cdrom /mnt/hdd/share

cd share

sudo ./VBoxLinuxAdditions.run

Then follow the instructions, you need to have already installed the Linux Headers before running this.

Note: Each time $ sudo apt-get update && sudo apt-get upgrade updates the VM linux kernel, on the next reboot you will need to repeat

$ sudo apt-get install linux-headers-$(uname -r)

And then, re-install on the VM the Guest Additions CD ISO

Instructions for shrinking the VM image size on the HostOS :

I've successfully compacted my disk2.vdi saving over 130GB. Virtualbox doesn't auto defragment or compress, so even Tor IBD, without using the quicksync torrent, wastes alot of space.

The steps to compact the VirtualBox .VDI are as listed here https://askubuntu.com/questions/1092812/zerofree-on-ubuntu-18-04

  1. Boot the mynodebtc VM in VirtualBox

  2. Esc > Advanced > Recovery mode (if you see the username/password login screen you've made a mistake)

  3. Drop to the root shell

  4. sudo apt install zerofree

  5. df -T You'll see /dev/sda1 / and temp files.
    sda1 is the small disk1 whereas the 1TB hdd partition is /dev/sdb1 which isn't listed.

  6. zerofree -v /dev/sdb1 This will take 15+ mins

  7. halt

  8. Shutdown the VM (and then I closed VirtualBox app).

  9. Open a Terminal shell window in the host OS

  10. VBoxManage modifymedium "path_to_/disk2.VDI" --compact

If everything has gone correctly your disk2.vdi is well over 100GB smaller. You can also shrink disk1.vdi, but in order to run zerofree -v /dev/sda1 on the 16GB boot partition you'll need to stop all services writing to the disk and remount it as read-only after booting the VM in Esc > Advanced > Recovery mode

Misc

And in order to prevent the VM from going to sleep, I keep the VM window open/in front.