I want to make one of my projects begin upon startup and found a few tutorials for that, but I want to make it so it only auto-activates when no monitor is detected. I have a pi4, and have heard it doesn't boot up if no monitor is plugged in.

I tried the method with rc.local(Method 1 in the linked site), which didn't work with the program i want to run(perhaps because the program requires bluetooth to an external device?). I did try this method with a simple led flashing code, and it totally worked. Even when i added an LED to the code to indicate when to connect the devices, the LED never lit up. I checked everything over again, but it all looked fine. If you know how to fix this, please let me know.

Script file path I'm trying to run is /home/pi/suit.py

Rather important note- I only have coding experience in Python using thonny, so anything short of step-by-step instructions and you've lost me before you started. Sorry for my inexperience.

Current code from /etc/rc.local (not including comments)

-IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My Ip address is %s\n" "$_IP"

sudo python /home/pi/suit.py &
exit 0
  • I’ve no pi handy at the moment to test this but I would always call the program and get it to check if a monitor is connected. This link askubuntu.com/questions/639495/… has a python program that lists monitors that are connected that may help. Remember though, any auto run program will run in the background so you need to think how it will display any messages - maybe a little display on the GPIO pins would be best...
    – user115418
    Jul 18, 2020 at 22:40
  • "I have a pi4, and have heard it doesn't boot up if no monitor is plugged in." That's not true in general... I have several that boot happily, and they have never had a monitor connected. Who said that?
    – Seamus
    Jul 19, 2020 at 0:33
  • "I have a pi4, and have heard it doesn't boot up if no monitor is plugged in." Then you heard WRONG. See raspberrypi.stackexchange.com/questions/113868/… Most of my Pi run headless.
    – Milliways
    Jul 19, 2020 at 0:34
  • @Seamus generally the internet, and i tested it. sometimes, if theres no monitor plugged in, it wont boot up even if you plug one in after the power supply. sorry, this isnt very clear, if u plug in power, then monitor, pi doesnt boot up. thats basically what that means.
    – user121626
    Jul 19, 2020 at 0:34
  • @Ceramicmrno0b: Perhaps you've misunderstood something - I'm quite certain they boot without a monitor. Can you test this on your Pi? In other words, disconnect the monitor, boot, then try to SSH into the RPi from your PC/Mac/Linux machine.
    – Seamus
    Jul 19, 2020 at 0:39

1 Answer 1


followed vnc utorial and got it fixed thx for all the help.

Your Answer

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