Here is my solution fixing the dark/black screen in Gazebo.
I am running ROS2 Jazzy version. - Virtual Machine ubuntu-24.04.2-desktop-amd64.ISO
Here are my settings:
System -> Motherboard -> Base memory: >=4096 MB
System -> Motherboard -> Processors: 8 CPUs
System -> Motherboard -> Execusion Cap: 100%
System -> Motherboard -> Extended Features:
a. Enable PAE/NX -> checked
b. Enable Nested VT-x/AMD-V -> checked
Paravirtualization Interface: KVM (as I am running host Window 11 and guest Ubuntu
a. Hardware Virtualization: Enable Nested Paging
-> checked
Display -> Screen -> Video memory: 256 MB
Display -> Screen -> Graphics Controller: VMSVGA
Display -> Screen -> Extended Features: Enable 3D Acceleration -> checked
Extended Features: check the box Enable 3D Acceleration
A. Now open a terminal
run:
export LIBGL_ALWAYS_SOFTWARE=1 and export DISPLAY=:0
and run:
gz sim
They have to be in the same terminal window otherwise It won't work.
B. Run your files
Example: this is what I have
export LIBGL_ALWAYS_SOFTWARE=1 and export DISPLAY=:0
cd ~/ros2_ws
source install/setup.bash
colcon build
ros2 launch my_robot_bringup my_robot_gazebo.launch.xml
And same thing here, all of them have to stay in the same terminal window.
Good Luck!