Raspberry Pi 4B desktop environment won't start without monitor attached

Hi everyone.

Just sharing my issue with the Raspberry Pi 4B and my solution here.

Issue:
I installed the latest Ubuntu on my Raspberry Pi 4B and configured everything on the Raspberry Pi with a monitor attached on the micro HDMI port, I can use vnc viewer to log in to the desktop. But when I reboot it without the monitor, it failed to load up the desktop environment and I cannot get in via vnc viewer.

Solution:
The trick is to force the system to load the desktop environment

$sudo nano /boot/firmware/config.txt

Add the following content into this file and save it:

hdmi_force_hotplug=1
hdmi_drive=2

Reboot it and it will start everything as usual with/without the monitor physically attached.

As a reference:
I tried this https://www.bonusbits.com/wiki/HowTo:Fix_Ubuntu_Desktop_to_Boot_without_Monitor_Connected
This isn't a option as you'll start a dummy desktop environment and it would bypass the real monitor. Which means I can do anything to the Raspberry Pi remotely but I'll have no display on the monitor when I connect the monitor on micro HDMI port.

Hope this would help someone. Thanks!