VNC & HDMI are loosing connection after Pi is running for some time

December 27, 2023, 14:01

nxc110

Hello I am using the PI-4. He is connected through a LAN cable. I am running a python scirpt on it and therefore want him to be always turned on. When I turn the Pi on, while a HDMI cable is plugged in, he connects normally to my monitor. I go to the settings and turn VNC on and try to connect to the Pi through the RealVNC app. It works. I start the python script and let it run. I change the signal from the monitor to my PC‘s display port (the HDMI is still plugged in) and use it. I turn the montior off and check back on the Pi at the next day. I notice that I only get a grey screen as soon as I change the signal from the monitor back to HDMI. I try to connect to the Pi through VNC (what worked the day before) but it doesn‘t work. I just get the error: „The port on which the computer is listening for a connection could not be contacted.“. I can‘t turn the Pi properly of, so is unplug him from the power cable wait shortly and plug him in again. The Pi boots and connects again to my monitor (the monitor is turned on while I do this). It works again. I go to the settings and look for VNC. It is turned off even though I didn‘t turned it off. Wheb I turn it back on and try to connect to the Pi, it works again. This repeats every day. I do not know after which time it happens but it is often at the same day.

jannik44

if you only want to run that python script why do you even have a monitor connected?

jannik44

thats the reason why a headless operating system exists

nxc110

Because I need to start the python script and I wanted to look if there will be issues on the script while it runs.

jannik44

ssh

nxc110

Is it possible to use ssh on mobile? Also I do need the graphical version for fixing issues in the script.

oops.se

SSH on mobile = Yes

nxc110

1. How? 2. Is it possible to get the terminal output from the python script in the ssh?

oops.se

1. App store 2. Yes

k9t33n

I use termiux for this, it's nice and and easy UI is great

k9t33n

anyway back to the problem

k9t33n

is the pi fully shutting down or just display?

nxc110

I think only the display. The red lamp is still glowing.

nxc110

Thanks.

k9t33n

the red light?

k9t33n

what abt green?

nxc110

Do you mean the green for the Ethernet cable?

k9t33n

nope

k9t33n

you have no green next to the red?

nxc110

I do not see any green light there. Even at the time period after startup where everything works normal.

nxc110

Do you have one there?

k9t33n

this means disk activity

k9t33n

aka if it's working or not

k9t33n

wait it doesn't even turn on when it is working properly?

nxc110

Uhm yes…

nxc110

I mean

nxc110

Right now I can connect using VNC and the python script is also running (but it only does something every 2-3 hours), but I do only see the red light

k9t33n

just making sure your talking about these lights?

nxc110

Yeah

nxc110

There is only the red light

k9t33n

very weird

k9t33n

broken led?

nxc110

I do not think so. I can’t remind a purpose on why it could be broken

nxc110

even if it would be, I do not know how to check if it is broken or not

k9t33n

me neither

k9t33n

one second I'm thinking

nxc110

Ok

k9t33n

ok next step is to determine if the pi actually turns off or not

k9t33n

we shall do this with ssh

nxc110

Alright

k9t33n

ok get your pis ip first

nxc110

Have it

k9t33n

oh yeah forgot you had vnc

nxc110

:)

k9t33n

you know how to do ssh?

nxc110

Well I do not really, I just downloaded „Termius“ (app) for SSH and there I entered some of the needed stuff. I got a connection to the Pi with this

k9t33n

great

k9t33n

connect now and run your python script

nxc110

1. I do not know how to run the script with SSH. 2. I already started it earlier with VNC where it runned as it should

k9t33n

Did the pi shutdown when it did?

k9t33n

like is ssh still connected?

nxc110

No not at when I started the script

nxc110

Wait

nxc110

I changed the device so I needed to login again. Yes it can connect.

k9t33n

ok so it is alive

k9t33n

but vnc and displays are a no go?

k9t33n

could you share your script please?

nxc110

Not really, it includes session tokens and that stuff

nxc110

VNC works right now, Display not

k9t33n

just delete them and put [token]

nxc110

prob gonna do this but for what purpose?

k9t33n

so I can figure out what the problem is(?)

k9t33n

to help lol

k9t33n

I'm only tryna help you nothing else

k9t33n

wth is it?

k9t33n

I wonder why people do this

k9t33n

just use bots

nxc110

Because I can not use a bot on all servers. in order to use them there, the owners have to add it to the server

nxc110

If you understand what I mean

k9t33n

sneaky but okay, who am I to judge

k9t33n

anyway go ahead with sharing it's fine

nxc110

alright, might take a bit of Tim until I got it

k9t33n

Oki dokie

nxc110

Do you know if it is possible to get the script as output on the ssh thing?

k9t33n

I don't know ssh well enough

k9t33n

one second let me Google

k9t33n

vim filename.py

nxc110

Ok thanks.

nxc110

Hmm

k9t33n

oh idk then

k9t33n

use vnc instead

k9t33n

once you reboot ofc

nxc110

I think I got it but it may be formatted weird

nxc110

I will send it in dms

nxc110

Did

k9t33n

after seeing the code... I have no clue why this would effect the UI at all