I have edited the autostart in "/etc/xdg/lxsession/LXDE-pi/" to this:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@lxterminal -e /home/pi/myScript.sh

All the script does is run an executable:


When the Pi is hooked up to a monitor, autostart works fine. Terminal pops up and the script is run with no issues. However, when I unplug the monitor and start the Pi, autostart doesn't run my script. I can still ssh into the pi and run it, but that's not a good solution for my situation.

Is there something in autostart that requires a monitor hookup?

  • 2
    perhaps adding hdmi_force_hotplug=1 will make the pi boot up as if a monitor is present Commented Jul 15, 2020 at 4:00
  • @JaromandaX Thank you! Just tried this and everything seems to be working just fine now. I'd still be interested in learning about why this works and how monitors affect autostart.
    – DreamCloud
    Commented Jul 15, 2020 at 4:20

2 Answers 2


You are using the autostart feature of the desktop environment, which cannot run without a screen. HDMI is smart enough to tell whether a screen is connected to it, and hdmi_force_hotplug dumbs it down exactly for cases like yours.

If your script doesn't actually need a desktop environment (it's not starting any graphical apps or changes the desktop resolution for instance), you should consider using systemd to start it up instead of LXDE.


You are mistaken; the Pi should boot, but if there is no monitor there will be no desktop so the GUI will not start. This affects the Pi4, earlier models would start, but use the composite video as output.

There is an option hdmi_force_hotplug=1 in config.txt and you should set a default resolution. See https://raspberrypi.stackexchange.com/a/113873/8697

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.