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?
#Pi Cam v3, having to restart crowsnest to get webcam image in Mainsail after initial boot
1 messages Β· Page 1 of 1 (latest)
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 π¦
I've seen one other report of this and adding a delay to the crowsnest.service fixed it.
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
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.
Yeah, but we might change the service management in a future update, that's why I recommended the first way
the first way leads to recreating the problem on each update.
Ok, to say it in other words. There might be a way in a future update, that allows something like that in an easier way (crowsnest.conf) and it might get obsolete within a few updates (hopefully only 2 updates) anyway. The thing about your way is that most people might forget about that.
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
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
I just say your way as you proposed it here in that thread.
@runic steppe Then do as @lofty mural said.
it makes it's presence clear when running systemctl cat $UNIT
tbh with you I'm a noob on most linux things.
I'm a very old hand at this point
Ok thank you for clarifying π
I will note that down π
over two decades and many distros
Here's as good walkthrough:
https://www.2daygeek.com/linux-modifying-existing-systemd-unit-file/
In this example, we will show how to modify an existing unit file. There are three main directories where unit files are stored on the system but the β/etc/systemd/system/β directory is reserved for unit files created or customized by the system administrator. /usr/lib/systemd/system/ β systemd unit files dropped when the package has installed./...
I'm born in 2000....
I always feel so young in the 3D printing scene ^^
that's a year after I started using Linux π
That's definitely more experience than me π
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 π€£
And I jsut realized I typoed above that message and Jamin copied that typo.
Correct would be
systemctl edit crowsnest.service
# add the following lines
[Service]
ExecStartPre=/bin/sleep 30
# save and exit the editor
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
Always that damn "quantum supporting". Just by trying to observe the error, it's gone
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.
it failed! logs and console screenshot!
do i put those lines where it says between those two comments on top, and do i add anything else?
Yes, you have to put it between those lines, like stated on the second line.
Those two lines should be enough. Here are they again:
[Service]
ExecStartPre=/bin/sleep 30
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.
Thanks! Probabkly can go ahead and close this thread?
If that is working, yes π
If it appear again, feel free to reopen
π Thanks to both of yas!
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.
Then I would ask for a log again. So if it happens, send a log before restarting crowsnest
roger that, is there any logging in the pi itself that the crowsnest.log may not capture?
Not that delay thingy again please... I was that excited to get rid of its slowlyness π©π
It seems like it's happening with the delay too, so maybe the cam is the problem and not the OS? Someone on the klipper discord had a similar issue where he needed to restart crowsnest for it to work
Ok, strange...
Are there other resolution modes? I could only find 4608x2592 30 fps mentioned. Maybe its initially choking on the resolution and frame rate?
Resolutions can be shown with libcamer-hello --list-cameras
There should be 2304x1296
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
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
Got about an hour left on a print, i'll change my config and reboot when thats done and see what happens.
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
delete the videocore one? or both of them
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
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
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
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
It shouldn't cause a failure, but it can.
.....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
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
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.
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?
I executed the command as directed
What command?
sorry, though i linked directly to the relevant post. This "CROWSNEST_ARGS="-c /home/pi/printer_data/config/crowsnest.conf -s 10""
unless this is outdated
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"