GDM doesn't work after installing NVIDIA driver in a QEMU VM

After installing the driver, my VM behaves incorrectly. I use the VM in two ways: one is to passthrough the GPU to the VM and the other is using virt-manager’s builtin client. After setting services.xserver.videoDrivers = ["nvidia" "modesetting"], the first way now works but when I boot using virt-manager’s client, I saw an error screen “Oh no! Something has gone wrong.” How can I further debug in this case?