My Project
When Apple removed the Software Update Server from macOS Server 5.7.1 (on macOS 10.15.7 “Catalina”) their recommendation was to use an open source replacement: NetSUS . I eventually settled on the prebuilt appliance which imports and runs on VirtualBox which was once one of my favourite virtualisation solutions for desktop and server. Oracle have decided to have a cull on supported guest operating systems which has the potential to make VirtualBox next to useless in future releases; the only official fully supported Linux guests are now Oracle Linux, and Red Hat Enterprise Linux which is morally stolen to make Oracle Linux given that Oracle don’t seem to offer anything back whilst profiting from their lightly modified copy of Red Hat’s system. My NetSUSLP appliance runs on Ubuntu 18.04 which used to be very well supported on VirtualBox. I decided to get rid of VirtualBox and make use of QEMU-KVM-libvirt which is available through Red Hat Enterprise Linux and derivatives.
Install Visualisation Host and Verify CPU Compatibility
Make sure that no VirtualBox VMs are running throughout the remainder of the setup.
dnf group install "Virtualization Host"
virt-host-validate
Creating a Network Bridge
KVM is effectively a type 1 (bare metal) hypervisor as it is running at kernel level in contrast to VirtualBox which is a type 2 running on the host Linux system; this is why KVM can outperform VirtualBox, however the type 2 can provide a layer of protection for the host system which can be desirable in some testing cases and running unmaintained legacy operating systems. Making network interfaces is done on Linux directly through Network Manager, so bridged networking giving virtual servers separate routable IP addresses on the local network, is done by mastering a connection with a bridge; this does not affect the host systems ability to connect to the network. In the example below I have an aggregated interface from 4 Ethernet ports and I will bridge over this:
nmcli connection add type bridge con-name bridge0 ifname bridge0 # create the bridge
nmcli device status # verify that the bridge has been added
nmcli connection modify team0 master bridge0 # makes bridge0 the master of team0
nmcli device status # verify the link between bridge0 and team0
nmcli connection up team0 # activates the bridge0 and team0 connection
VirtualBox’s Final Job
Now that KVM and networking is ready and verified if is time to convert the .vmdk disk images into the RAW format so that qemu-img
can convert these into .qcow2; although possible to convert from VMware .vmdk images there is a slight difference with VirtualBox disk images which is why we need to convert to RAW first.
We need a storage location large enough to temporarily hold the uncompressed copy of our disk image. Also note that Red Hat Enterprise Linux automatically separates /home from the / filesystem where the QEMU images will reside so check space requirements before proceeding.
VBoxManage clonemedium 49b8d921-e050-4919-b3c9-20083a321f17 /media/RDX/NetSUSLP.img disk --format RAW
qemu-img convert -f raw -O qcow2 /media/RDX/VMs/NetSUSLP.img /var/lib/libvirt/images/NetSUSLP.qcow2
Setup the New libvirt Machine
If you are at your server with a graphical desktop, or using X11 forwarding the following virt-install
command will create then start the virtual machine then open virt-viewer
allowing you to see and interact with the virtual machines display. An alternative is to enable Cockpit allowing you to see and interact with the virtual machine through a browser, and if you are using Red Hat Enterprise Linux 9 or later there is no reason not to just create the virtual machine through the browser; Red Hat Enterprise Linux 8 uses the SPICE desktop viewer now deprecated from Red Hat Enterprise Linux 9.
virt-install --name NetSUSLP --memory 2048 --vcpus 2 --os-variant ubuntu18.04 --import --disk /var/lib/libvirt/images/NetSUSLP.qcow2 --graphics vnc
As you can see I’ve used the simplest command to setup my Ubuntu 18.04 virtual machine with graphics set to vnc even though there is no GUI installed; Ubuntu uses a frame buffer preventing the raw console mode from working and cannot start successfully if the video mode is not available. Red Hat have deprecated the SPICE viewer in Enterprise Linux 9 and as such recommend using the command line as above so that virtual machines will continue to work after upgrading the host operating system from Enterprise Linux 8.
Virtual Machine settings can be modified by editing its XML file located in /etc/libvirt/qemu/NetSUSLP.xml
, or some settings can be changed in the Cockpit web interface.
Reconnecting Virtual Machine to the Network
In the examples above my virtual appliance uses and upgraded Ubuntu 16.04 installation without Network Manager which meant that the machine did not automatically connect to my network. To change to the new virtual interface I used a command inside the virtual machine to find out the network adaptors device name then edited the /etc/network/interfaces
file and changed the old device to now reference the new interface then rebooted the virtual machine:
sudo ip address
sudo vim /etc/network/interfaces
The file now looks like the following with the changed interface device highlighted:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto enp1s0
iface enp1s0 inet dhcp
A Successful Migration and Final Steps
With the KVM setup now working it is time to remove VirtualBox which will not work anyway with KVM active. The packages below in the dnf
command include all version of VirtualBox and dependencies which were installed to support VirtualBox, however be sure that you are not using any of these dependencies for any other purpose on your host if you plan on removing them:
service vboxautostart stop
systemctl disable vboxautostart-service.service
rm -r /etc/vbox # next 2 commands remove autostart configuration
rm /etc/default/vbox
dnf remove VirtualBox-* kernel-devel dkms gcc make perl elfutils-libelf-devel
groupdel vboxusers
You should now remove the VirtualBox repo information which may be stored in /etc/yum.repos.d
, or write into a section of /etc/dnf/dnf.conf
Do dnf update
to make sure you’ve successfully gotten rid of the Oracle repository then enjoy your Oracle free linux system, unless you’ve setup KVM on Oracle Linux.