#Pi Cam v3, having to restart crowsnest to get webcam image in Mainsail after initial boot

1 messages Β· Page 1 of 1 (latest)

runic steppe
#

Since upgrading to a Pi Cam v3, its been working pretty well but more often than not after powering on my printer, which i fully power off between uses, the webcam view fails to load. Crowsnest log shows detection of the camera, but I get no stream unless I do a manual restart of the service. After that its rock solid. I may look into arranging things so that I leave the Pi4 on 24/7 and seperately powering the printer. but maybe theres something I need to fix or theres a bug in the boot sequence?

drowsy reef
#

Set log_level: debugin your crowsnest.conf, then delete your crowsnest.log and try to reproduce that issue once. Then send the log

#

And open the web browser console with the network tab open. Maybe something interesting is displaying there

#

I had that problem in the past too, but didn't investigate into it. Now it's gone for me somehow 😦

lofty mural
#

I've seen one other report of this and adding a delay to the crowsnest.service fixed it.

drowsy reef
#

If you don't know how. Edit /etc/systemd/system/crowsnest.service and add ExecStartPre=/bin/sleep 30 under the [Service] section. That will be gone after reinstalling/updating crowsnest
Have a look at the message below

lofty mural
#

Please don't do that...

use:

systemctl edit crowsnest.service
# add the following lines
[Services]
ExecStartPre=/bin/sleep 30
# save and exit the editor

This will create a override file that will persist after updates.

This is the recommended way of modifying systemd services.

drowsy reef
#

Yeah, but we might change the service management in a future update, that's why I recommended the first way

lofty mural
#

the first way leads to recreating the problem on each update.

drowsy reef
#

Also another thing that I right now not know, but you can answer me that question. What happens if the file get's just replaced and get's that command added? Does it execute twice then?

#

But you are totally right and that's not the way how this should get fixed

lofty mural
#

it's not my way... it's the recommended way of modifying systemd files and it leaves a clear detectable trace

#

it does not get executed twice

drowsy reef
#

I just say your way as you proposed it here in that thread.

#

@runic steppe Then do as @lofty mural said.

lofty mural
#

it makes it's presence clear when running systemctl cat $UNIT

drowsy reef
lofty mural
#

I'm a very old hand at this point

drowsy reef
lofty mural
#

over two decades and many distros

#
drowsy reef
lofty mural
#

that's a year after I started using Linux πŸ™‚

drowsy reef
#

That's definitely more experience than me πŸ˜‚

runic steppe
#

Of course NOW its working totally fine. I was trying just now to repro it with the logs and network tab like you asked for first, and its loading normally 🀣

drowsy reef
runic steppe
#

When it DOES fail, it at least persists through refreshes. So i can keep the log set to debug, and capture the browser network tab when it does act up

drowsy reef
lofty mural
#

From what I've seen it's a race condition, where crowsnest tries to start up too fast. It doesn't always happen. So, it's completely reasonable (and expected) that sometimes it would work just fine.

runic steppe
runic steppe
drowsy reef
lofty mural
#

Yes, just the two lines, nothing else, should delay the crowsnest startup by 30 seconds, if that works you can re-edit and lower the number, you'll probably find that you don't need more than 2 to 5 second delay.

runic steppe
#

Thanks! Probabkly can go ahead and close this thread?

drowsy reef
#

If that is working, yes πŸ˜„
If it appear again, feel free to reopen

runic steppe
#

πŸ‘ Thanks to both of yas!

runic steppe
#

OK, so yeah this issue is still occurring. Despite adding those lines to the file, I will have to restart crowsnest on first power up.

drowsy reef
#

Then I would ask for a log again. So if it happens, send a log before restarting crowsnest

runic steppe
#

roger that, is there any logging in the pi itself that the crowsnest.log may not capture?

drowsy reef
#

Only dmesg, I think

#

Sending that cannot harm too ^^

light current
#

Not that delay thingy again please... I was that excited to get rid of its slowlyness 😩😭

drowsy reef
light current
#

Ok, strange...

runic steppe
#

Are there other resolution modes? I could only find 4608x2592 30 fps mentioned. Maybe its initially choking on the resolution and frame rate?

drowsy reef
#

Resolutions can be shown with libcamer-hello --list-cameras

#

There should be 2304x1296

runic steppe
#

Modes: 'SBGGR10_CSI2P' : 1536x864 [30.00 fps - (0, 0)/0x0 crop]
2304x1296 [30.00 fps - (0, 0)/0x0 crop]
4608x2592 [30.00 fps - (0, 0)/0x0 crop]

#

maybe i can see if i can do that half resolution mode

drowsy reef
#

2304x1296 gives you the highest fov and resolution you can use for video

#

Can you send your /boot/config.txt real quick?

#

I forgot that you use a raspicam and with that resolution there might be one thing that's causing this problem

#

But 2304x1296 should be preferred anyway

runic steppe
#

Got about an hour left on a print, i'll change my config and reboot when thats done and see what happens.

drowsy reef
#

Ok, doesn't seem like the problem I know of. But you should delete thos camera_auto_detect at the bottom of the file

#

Those can lead to problems, but that shouldn't cause this issue afaik

runic steppe
#

delete the videocore one? or both of them

drowsy reef
#

Both

#

You got it already at the top

#

Caused issues in the past if you had multiple of them inside your boot config with different defined values

runic steppe
#

Just occurred again. It SEEMS to occur after a long term shutdown, like at least overnight where i've fully cut power to the printer via my TPlinl Kasa power strip. Dont think it happens after reboots of the pi or after shutdown and quick powercycle.

#

thats got crowsnest log, dmesg output, and the console from my browser

drowsy reef
#

Does a simple browser refresh doesn't help to get the image? Your log looks identical to mine, and I can't find anyhting obvious inside the dmesg output too.

#

The weird thing is the bad request inside the console, but the log says, that it's receiving and sending

runic steppe
#

refresh doesnt help no

#

but when i restart crowsnest THEN refresh I get the feed

runic steppe
#

OK this is weird and dunno if its related. But now, mid print, the video feed fails to load. I get the same blank grey area that i did on boot. The browser console is showing a 400 (bad request) for the webcam url.

#

I can try a crowsnest restart if that wont cause a print failure

drowsy reef
#

It shouldn't cause a failure, but it can.

runic steppe
#

.....its loading on chrome on my phone but not on my laptop. and my adblockers and what have you are disabled for that ip

#

starting to wonder if the pi cam v3 was a bad move

drowsy reef
#

This isn't something about the picam, it's something about camera-streamer or your network setup

#

Hard to debug, if there is no error, or if it just starts to act up randomly during a print

runic steppe
#

Next time it fails on boot, i need to remember to check my phone. I only ever check the printer on my phone or my laptop. Both are wifi 6, i have wifi 6 access points in my basement and 2nd floor. Printer is also on wifi and i know that needs to change. I had the whole ass connection cease working mid print the other day. I had that when i used a prusa + octoprint. They suspected it was the wifi crapping out. Didnt have this network setup then. I had my basement redone, added that access point, then the prusa died, i finally built this V2.....and proceeded to not use wired Ethernet again lol.

runic steppe
#

Reopening to follow up. Been having to do the restart of crowsnest on boot for a while again following a clean install at some point (i honestly don't remember when but i have no sign of the original delay fix) after my initial issue. I noticed that this was added to 4.1 https://github.com/mainsail-crew/crowsnest/issues/117#issuecomment-1806943132 but I am unlear how to use it. I executed the command as directed but am I supposed to see a change in my config file?

GitHub

What happened On boot, the camera is not working (black screen with FPS:00). Go to services control, stop, start and working... I've uploaded the log. Version: v4.0.2-0-gb0c011b crowsnest_fail ...

drowsy reef
runic steppe
#

unless this is outdated

drowsy reef
#

Did you read it?

#

That's not a command

runic steppe
#

OH

#

god

#

sorry

drowsy reef
#

That shell parameter can be used inside the environment file ~/printer_data/systemd/crowsnest.env.
Just add -s at the end of the file. It should then look similar to:
CROWSNEST_ARGS="-c /home/pi/printer_data/config/crowsnest.conf -s"