How can I start a Qt GUI application on boot without a display connected?

Solution 1:

I don't think you can run Qt without X, so you need to run X. It won't start by default if a monitor is not detected.

I found this Ubuntu Forums thread (link to exact answer) that might help you get over the problem of not being able to connect a monitor:

I am not that great with Ubuntu (been using it for past 2 years), so there might be other options to do the same.

I was having the exact same problem - I want to run X on a machine that (for now) doesn't have a monitor attached.

Using the intel driver, X was finding no monitors attached, and giving up:

(II) intel(0): Output VGA disconnected
(WW) intel(0): No outputs definitely connected, trying again...
(II) intel(0): Output VGA disconnected
(WW) intel(0): Unable to find initial modes
(EE) intel(0): No valid modes.
(II) UnloadModule: "intel"

I stumbled across a solution pieced together from several different threads on these and other forums.

First I needed to make a basic xorg.conf file, in which I specified the VESA driver rather than the intel one (see bottom of post for my xorg.conf)

This led to me seeing a different error:

(EE) VESA: Kernel modesetting driver in use, refusing to load
(WW) Falling back to old probe method for vesa
(EE) No devices detected.

I then had to add nomodeset to my GRUB boot options (used to be in /boot/grub/menu.lst but now in /etc/default/grub)

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

...and run sudo update-grub.

With some basic settings for the (non-existent) monitor, the result is that I get X running with no monitor plugged in, using the VESA driver, and with a decent resolution - which is fine for what I wanted it for.

The xorg.conf file:

Section "Monitor"
  Identifier   "Monitor0"
  HorizSync    31-81
  VertRefresh  56-75
EndSection

Section "Device"
  Identifier  "Card0"
  Driver      "vesa"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
EndSection