Can't get raspicam at Zero 2W to work continually

Camera model
raspi camera for PI Zero 2W

What is the problem?

I setup a new Bullseye System on my Pi Zero 2W and set things up according to the guide given in this Forum, struggling partly because it is not completely uptodate unless you read years of posts and still for me some things are hard to understand because I am hardly familiar with Linux. Octoprint works fine but I can't get my camera to run continously. It seems that the Paths are not set properly despite I tried to set them according to the guide. Once I reboot everything is lost again. Yesterday I could see the still picture in Octoprint but never managed to get the webcam stream working. I know I could use the Image but it is still based on Buster (I had it before, worked fine) and I wanted to update my Debian Version.

What did you already try to solve it?

I tried for 2 days now everything you can imagine but due to the fact that I am not really familiar with Linux I struggle to get things running. The camera is detected and supported according vcgencmd. I could see the still tonight but right now, after logging in via SSH, nothing worked again and I received the following status...

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)

● webcamd.service - Camera streamer for OctoPrint
     Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-12-06 01:02:47 CET; 10h ago
   Main PID: 602 (webcamDaemon)
      Tasks: 2 (limit: 718)
        CPU: 15.072s
     CGroup: /system.slice/webcamd.service
             β”œβ”€ 602 /bin/bash /home/pi/scripts/webcamDaemon
             └─8539 sleep 120

Dez 06 11:09:02 raspberrypi webcamDaemon[8538]: MJPG Streamer Version: git rev: 310b29f4a94c46652b20c4b7b6e5cf24e532af39
Dez 06 11:09:02 raspberrypi webcamDaemon[8538]: ERROR: could not find input plugin
Dez 06 11:09:02 raspberrypi webcamDaemon[8538]:        Perhaps you want to adjust the search path with:
Dez 06 11:09:02 raspberrypi webcamDaemon[8538]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Dez 06 11:09:02 raspberrypi webcamDaemon[8538]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
Dez 06 11:09:02 raspberrypi mjpg_streamer[8538]: MJPG-streamer [8538]: ERROR: could not find input plugin
Dez 06 11:09:02 raspberrypi webcamDaemon[602]: /
Dez 06 11:09:02 raspberrypi mjpg_streamer[8538]: MJPG-streamer [8538]:        Perhaps you want to adjust the search path with:
Dez 06 11:09:02 raspberrypi mjpg_streamer[8538]: MJPG-streamer [8538]:        # export LD_LIBRARY_PATH=/path/to/plugin/folder
Dez 06 11:09:02 raspberrypi mjpg_streamer[8538]: MJPG-streamer [8538]:        dlopen: input_raspicam.so: cannot open shared object file: No such file or directory

My webcamDaemon:

#!/bin/bash

MJPGSTREAMER_HOME=/home/pi/mjpg-streamer/mjpg-streamer-experimental
MJPGSTREAMER_INPUT_USB="input_uvc.so"
MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so"

# init configuration
camera="auto"
camera_usb_options="-r 640x480 -f 10"
camera_raspi_options="-fps 10"

if [ -e "/boot/octopi.txt" ]; then
    source "/boot/octopi.txt"
fi

# runs MJPG Streamer, using the provided input plugin + configuration
function runMjpgStreamer {
    input=$1
    pushd $MJPGSTREAMER_HOME
    echo Running ./mjpg_streamer -o "output_http.so -w ./www" -i "$input"
    LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www" -i "$input"
    popd
}

# starts up the RasPiCam
function startRaspi {
    logger "Starting Raspberry Pi camera"
    runMjpgStreamer "$MJPGSTREAMER_INPUT_RASPICAM $camera_raspi_options"
}

# starts up the USB webcam
function startUsb {
    logger "Starting USB webcam"
    runMjpgStreamer "$MJPGSTREAMER_INPUT_USB $camera_usb_options"
}

# we need this to prevent the later calls to vcgencmd from blocking
# I have no idea why, but that's how it is...
vcgencmd version

# echo configuration
echo camera: $camera
echo usb options: $camera_usb_options
echo raspi options: $camera_raspi_options

# keep mjpg streamer running if some camera is attached
while true; do
    if [ -e "/dev/video0" ] && { [ "$camera" = "auto" ] || [ "$camera" = "usb" ] ; }; then
        startUsb
    elif [ "`vcgencmd get_camera`" = "supported=1 detected=1" ] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi" ] >        startRaspi
    fi

    sleep 120
done

Additional information about your setup (OctoPrint version, OctoPi version, ...)
V1.7.2, V 0.18.0

Please let me know if additional information is required.

Hello @PiJoe !

Have you checked the power supply for delivering enough power for the Zero 2?
Not enough power can effect the cam.

Thank you for the reply. Yes, I use an original Pi 4 power supply. It seems to be an software issue, I guess. The webcam status tells me to set a PATH but I am not sure where and how. I (think I) tried as described in the guide with

export LD_LIBRARY_PATH=.

but then after rebooting it is empty again...