blog

Ubuntu VM setup using UTM

I have a love-hate relationship with UTM 🥲. It’s a great tool compared to its counterparts but setting up has been a pain. I’ll document the steps I took to set up a Ubuntu virtual machine using UTM on my M1 Mac.


Steps

1. Once you have UTM installed, select ➕ Create a new virtual machine and Virtualize.

The difference between Virtualize and Emulate is that Virtualize is far faster because it uses the hardware virtualization capabilities of the host machine.


2. Download the ubuntu image from this jammy website 🐙.

I’m not sure why the official website has some bugs. Install the arm64 image.

Although the executable we wanna run is xmd64, we need to install the arm64 image because our host mac is arm64, and virtualizing means we are running the guest OS on the host OS.

So to run the executable, we would need to install Box64 later.


3. Begin installing the VM.

The configs aren’t that important for now but it’s pretty slow (so a lil annoying).


4. Once you restart the reboot 👾, go to Edit VM and literally DELETE the USB in the settings.

(this was a known bug and I was stuck for a while). If you don’t do this, it’ll just be a blank screen ;-;


5. Run sudo apt kubuntu-desktop to install the gui 💻 and then reboot.

another known bug


6. File sharing 📁

Go to the settings in UTM and change the Sharing to SpiceWebDAV.

Install SpiceWebDAV on your guest ubuntu by running sudo apt install spice-webdavd.

Within your host mac, go System Settings > Sharing > File Sharing > Options and enable all users can read and write.

In your guest ubuntu, go Window Shares and add a random placeholder username and password another bug mentioned on reddit.

To see your shared files, go to Network > [your host mac name] > [your shared folder]. For the username, type in the username you added above, and password of your mac. Ensure they have permissions added on your mac.


7. Install Box64

On your guest ubuntu, run the following commands:

sudo apt update
sudo apt install git build-essential cmake

git clone https://github.com/ptitSeb/box64.git
cd box64

mkdir build
cd build

cmake ..

make -j$(nproc)
sudo make install

Then you can run your x86_64 executables using box64 [your executable] when you’re in the build directory 🎉