The Linux Page

Installing macOS (Catalina) in a VirtualBox VM on Ubuntu 18.04

How to run a virtual macintosh under Linux...

I just got my copy of Catalina and Majove. It comes really cheap these days. You can get a copy ready to install on a USB thunk drive.

The drive I've got is a 16Gb which is enough to fit the newer version (as of Dec 2019), Catalina which requires about 8Gb and the previous version, Majove, which is about 6.5Gb.

I can't just boot the USB, though, since I want to install the OS on a VM. Well... from the interface, it is clearly marked that it is possible to give a VM direct access to a USB port. I tried that and majored (again) in getting my X-Windows locked up. I had to reboot by connecting to my server from another computer. (I needed to reboot, though... I had several Linux updates that required a reboot anyway, after a couple of weeks...)

So my first step was to extract the drives and put them in a "fake ISO" file. (At least I think that's not really an ISO, but it should be close enough.) I've done so using dd and I know it worked because Majove started to boot as expected, although it gets stuck really quickly. Oh well... I'll consentrate on Catalina anyway since it's the modern version.

sudo dd if=/dev/sdg2 of=iso/macos-catalina.iso

IMPORTANT: You will need to determine the source on your computer. It could be any /dev/sd... file. In my case, it was #2 because there are three partitions. A first one, which is 200Mb, a second one with Catalina, and a third one with Majove. When inserting your USB thumb drive, it should auto-mount the file system. If so, you'll get something like /media/<your name>/<name of partition>. What you can do to determine the device is use df:

$ df /media/<your name>/<name of partition>
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sdg2        8565260 8005644    559616  94% /media/alexis/Install macOS Catalina

As we can see, the Filesystem column shows us the exact device name.

Note: The sudo is required to directly read the device. Feel free to change the ownership of the resulting file if you'd like read/write permissions. However, I would suggest you keep it as root:root that way you won't hurt the file.

$ chown alexis:alexis iso/macos-catalina.iso  # not recommended

After that, I started setting up a VM, but so far I was not able to do much. With Catalina, it boots to a black screen and that's it. With Majove, we see a few logs from the boot process, but it dies really quickly. More soon, I hope.

My next attempt is going to be using the newer version of VirtualBox, especially because it looks like it may have fixes for macOS specifically. They have a PPA with version 6.x at this location:

deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib

To install, edit a file like so:

$ sudo vim /etc/apt/lists/virtualbox.list

Then copy the line above that starts with "deb ..."

To add the signature for the new entry:

$ sudo su -c 'wget -q -O- https://download.virtualbox.org/virtualbox/debian/oracle_vbox_2016.asc | apt-key add -'

You can check the folder by following the link:

https://download.virtualbox.org/virtualbox/debian/

Now you are ready to update and upgrade. However, make sure you stop all your VMs if you have any running and close the GUI too. That way you are sure to get the new module properly installed.

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get autoremove --purge
$ sudo /sbin/vboxconfig

The autoremove is very important because it is likely that the DKMS was not properly updated and that means the virtualbox modules would not have been recompiled for your current kernel version.

The /sbin/vboxconfig is robably not required. It makes sure that the correct modules are loaded.

Once the upgrade is over, restart your VMs. You can verify that you have the newer version using the command line VBoxManager.

If you have the stock version for 18.04, it should say 5.2.34 and an Ubuntu revision (here we're at 133883):

$ VBoxManage --version
5.2.34_Ubuntur133883

After the upgrade to version 6.x I see:

$ VBoxManage --version
6.1.0r135406

Furthering my research, I found this forum on VirtualBox:

https://forums.virtualbox.org/viewtopic.php?f=7&t=92649

where they clearly say that VirtualBox will not offer much to run macOS unless you are running on an Apple computer (which kind of defies the usefulness of that OS if you ask me). Oh well...

That being said, it could very well be that we can pretend that we have a Mac computer using tweaks to the disk as specified in this script:

https://github.com/hkdb/VBoxMacSetup


See also:

https://techsviewer.com/how-to-download-macos-installer-in-virtual-machine/

https://techsviewer.com