You may come across the Fatal server error: No screen found Xorg error, unable to connect to X server: connection refused – No devices detected when executing the startx command in FreeBSD.
In this troubleshooting guide, I will show you how to fix this Xorg issue. The No screen found (ee) error looks like this:
The No screen found (EE) error is mainly caused by the X server [Xorg] being confused about which GPU should use as a primary, especially when your system is equipped with more than one discrete GPU.
The issue is easily fixed by adding the correct BusID in the xorg.conf for the discrete GPU that has your display connected.
I recently experienced this issue when installing FreeBSD with XFCE and NVIDIA proprietary drivers on bare metal on a system with dual-GPU [2x Gigabyte GTX 1070 graphics cards].
Here is how to fix the No screens found (EE) – unable to connect to X server error in a few simple steps:
- Log in as root user on FreeBSD.
- Find the BusID for the primary GPU
List the graphics cards in your system by using the following command and take note of the VGA PCI Bus IDs.
pciconfig -l | grep VGA
Where [in my system]:
pci0:0:2:0 is the built-in GPU
pci0:1:0:0 is the 1st discrete GPU [PCI slot closest to the CPU]
pci0:2:0:0 is the 2st discrete GPU
Your PCI IDs might look slightly different but you’ll get the point in a moment.
Take note of the PCI ID [pci0:x:x:x:x] for the GPU that has your display connected. In my case, this is the pci0:1:0:0.
If you don’t know which PCI slot has your primary GPU connected to the display, inspect your computer ports behind and check where, e.g., the HDMI cable is inserted.
Alternatively, you can find the PCI slot configured for the primary GPU in the BIOS settings for some motherboards [e.g., Gigabyte].
- Fix the No screen found Xorg error in xorg.conf
Start by editing the xorg.conf file using the following command:
NOTE: The xorg.conf file should be generated automatically when installing your GPU drivers. If your xorg.conf is empty, most likely the automatic process failed to generate the file. On NVIDIA, use the nvidia-xconfig command to generate the xorg.conf file. You need to install nvidia-xconfig first [pkg install nvidia-xonfig].
Look for the Section “Device” and add the following line:
BusID “PCI:<the Bus ID for the GPU connected to your display>”
IMPORTANT: the PCI bus should NOT include the domain ID, e.g., PCI0:x:x:x
Save the xorg.conf file by pressing ESC, then press twice the “a” key to save and exit the file.
- Gracefully reboot the system
shutdown -r now
- Test the X server on FreeBSD
Upon rebooting FreeBSD, log in as root user. Issue the following command to test if the X server detects and use the correct GPU:
The X server is up and running. Now you’re ready to go one step further and install your favorite Desktop Environment or Window Manager on FreeBSD. I’ll keep my system like this as the old-school look is growing on me.
TIP: You can return back to the shell by pressing CTRL+ALT+F2 if needed. You can also get back to X by pressing CTRL+ALT+F9.
There you go! This is how you fix the Fatal server error: No screen found (EE) – unable to connect to X server: connection refused [No devices detected] on FreeBSD. Here you can find more information on how to configure Xorg on FreeBSD.
I hope you found this troubleshooting guide useful. If so, do me a favor and share it online with your friends and colleagues. This way we can give FreeBSD the attention it deserves.