Installation as virtual image with VMware or VirtualBox , on Ubuntu 22.04, In depth

Hello guys, I wasted a day trying to install HA on Ubuntu 22.04 lts desktop.

With VMware 17, I could not figure out how to boot, it’s giving me the error, there is no boot device, even if I add the downloaded image as a hdd.

With VirtualBox, I could boot just fine, but the problem is that I could never figure out how to make it automatically start after system reboot.

The guides on home assistant page are very shallow /outdated.

Do you know of any source with in depth guide for noobs like me?

Thank you, in the meantime I found the efi setting and made it work, however I couldn’t find any working guide to autorestart the image after system reboot.

Thanks but half of the people there say that is not working, and the other ones keep adding commands, so I don’t understand anything that can be done.
Also it’s about 9 years old, so I doubt it will work with Ubuntu 22.04

I used VB on Ubuntu 22.04 and was quite happy with it and VB was starting at boot time. Note that starting VB at boot is not a HA problem/issue it is between you and VB/Oracle/Ubuntu. There are people on this list that have used VB with HA and we are willing to help out if we can. I run HA remotely (1000mi away) restarting HA on reboot has to work every time.

I quit VB (and Ubuntu) when Snap decided that is was time to update VB to the latest version. For me this was the last straw after 10+ years with Ubuntu as my main platform (work and home). I am now running supervised install on Debian and have been quite happy.

How did you manage to make it auto start ? I reinstalled whole ubuntu to get rid of vmware and virtualbox and all other failed scripts , in order to start from scratch .

I prefer Ubuntu to Debian as its not a hassle to install proprietary drivers and stuff. Before I had debian 11 with HA and was working fine , but i want to use my station with others VMs too , so I`m searching a complete solution for Ubuntu + VirtualBox .

What about running it in Docker instead? Since you are having issues with VMware and Virtualbox.

I would like to have supervisor on. Since HA does not support Ubuntu, and I don’t like Debian, running it in a virtual machine on Ubuntu is the only way.

Also I plan to add more virtual machines in the future, so IF I find the fix I will use it also for those.

Soooo , i made it work . I reinstalled Ubuntu , then VirtualBox , then Virtual box extended pack ( don`t know if it was necessary ) then I followed the tutorial from the link below , and it worked perfectly.

https://www.paulligocki.com/make-virtual-box-vm-autostart/

Make Virtual Box VM Autostart

Linux

Ubuntu 20.04

What you need to know

  • VMNAME : Virtual Manchine Name that is registered with VirtualBox
  • user : Account to run as

Edit /etc/default/virtualbox

sudo nano /etc/default/virtualbox

Add the following few lines into the file

#AutoStarting VMs
VBOXAUTOSTART_DB=/etc/vbox
VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg

Create /etc/systemd/system/VMNAME.service

sudo nano /etc/systemd/system/VMNAME.service
[Unit]
Description=vm1
After=network.target virtualbox.service
Before=runlevel2.target shutdown.target
[Service]
User=user
Group=vboxusers
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/usr/bin/VBoxManage startvm VMNAME --type headless
ExecStop=/usr/bin/VBoxManage controlvm VMNAME acpipowerbutton
[Install]
WantedBy=multi-user.target

Reload Daemon

sudo systemctl daemon-reload

Test

systemctl status VMNAME

Start

sudo systemctl start VMNAME

Stop

sudo systemctl stop VMNAME

Enable

sudo systemctl enable VMNAME

Disable

sudo systemctl disable VMNAME