Set the preferred video device (VGA) for a Linux desktop with two or more. Useful for when the primary VGA cannot be set in BIOS/UEFI, or is reserved for hardware-passthrough (VFIO).
GPL-3.0 License
Automatically set the proper video output given a video device (VGA) is unavailable due to hardware-passthrough (VFIO) or any other reason, in the X.Org display environment for a Linux machine.
X.Org will specify a VGA device to be the primary video output. When that VGA device is Passed-through or restricted to Virtual Machines (VMs) only (like in a VFIO setup), the VGA device cannot be used by the Host machine (Linux). Unfortunately, X.Org will not search for the next valid VGA device. This is where auto-X.Org steps in...
This script will automatically set the proper video output everytime, as it runs at Host startup. This flexibility is very useful for a new or changing VFIO setup.
Project | Codeberg | GitHub |
---|---|---|
Deploy VFIO | link | link |
Auto X.Org | link | link |
Generate Evdev | link | link |
Guest Machine Guide | link | link |
Libvirt Hooks | link | link |
Power State Virtual Machine Manager | link | link |
Linux.
systemd
for system services.X.Org
or X11
as the video display environment.Wayland
is not supported.
Two (2) or more video devices. This script is not necessary for machines with one video device, as X.Org will find it.
Download the .zip
file:
<> Code
on GitHub.Download ZIP
and save..zip
file, then extract its contents.Clone the repository:
CTRL
+ ALT
+ F2
, F3
, F4
, F5
, orF6
.
CTRL
+ ALT
+ F7
.F1
is reserved for debug output of the Linux kernel.F7
is reserved for video output of the desktop environment.F8
and above are unused.cd ~
git clone https://www.codeberg.org/portellam/auto-xorg
git clone https://www.github.com/portellam/auto-xorg
Open the CLI (see Download).
Go to the directory of where the cloned/extracted repository folder is:
cd name_of_parent_folder/auto-xorg/
Make the installer script file executable: chmod +x installer.bash
installer.bash
or auto-xorg
sudo bash installer.bash
sudo bash auto-xorg
/usr/local/bin
. -h, --help Print this help and exit.
Update X.Org:
-r, --restart-display Restart the display manager immediately.
Set device order:
-f, --first Find the first valid VGA device.
-l, --last Find the last valid VGA device.
Prefer a vendor:
-a, --amd AMD or ATI
-i, --intel Intel
-n, --nvidia NVIDIA
-o, --other Any other brand (past or future).
sudo bash auto-xorg.bash -f -a
sudo bash auto-xorg -l -n -r
If the auto-xorg service fails, to diagnose review the log, execute:
sudo journalctl -u auto-xorg
Failure may be the result of absent VGA device(s), or an exception. Review the log to debug.
lspci -m | grep --extended-regexp --ignore-case 'vga|graphics'
lspci -ks 04:00.0 | grep --extended-regexp --ignore-case 'driver|VGA'
04:00.0 VGA compatible controller: ...
Kernel driver in use: nvidia
- Invalid example:
```
lspci -ks 04:00.0 | grep --extended-regexp --ignore-case 'driver|VGA'
01:00.0 VGA compatible controller: ...
Kernel driver in use: vfio-pci
```
/etc/X11/xorg.conf.d/10-auto-xorg.conf
/etc/X11/xorg.conf.d/
/usr/local/bin/
/etc/systemd/system/
Did you encounter a bug? Do you need help? Please visit the Issues page (Codeberg, GitHub).
PCI passthrough via OVMF. ArchWiki. Accessed June 14, 2024. https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF.
VFIO - Virtual Function I/O - The Linux Kernel Documentation. The linux kernel. Accessed June 14, 2024. https://www.kernel.org/doc/html/latest/driver-api/vfio.html.
VFIO Discussion and Support. Reddit. Accessed June 14, 2024. https://www.reddit.com/r/VFIO/.
XML Design Format. GitHub - libvirt/libvirt. Accessed June 18, 2024. https://github.com/libvirt/libvirt/blob/master/docs/formatdomain.rst.