UV4L on Raspberry Pi running Debian Buster

Some time ago, I have published a post about creating a Pan Tilt camera using UV4L library on a Raspberry Pi. It works really well. The camera position can be adjusted via a web interface while providing a live stream. It seems like a nice little thing. However, after upgrade of my Raspberry Pi from Debian Stretch to Debian Buster it broke down. The live stream is no longer available through UV4L on Debian Buster. Here is how to fix it!

The problem with UV4L is related to the SSL library. In Debian Buster it has changed a bit and now it does not work as expected. The solution to this problem was based on the post UV4L on raspbian buster.

First of all, the problem has to be identified. For this status of UV4L raspicam daemon needs to be checked. This can be done with following command

sudo service uv4l_raspicam status

Above command will return something similar to

uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-11-06 18:15:39 CET; 3s ago
  Process: 17715 ExecStart=/usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-co Main PID: 17715 (code=exited, status=1/FAILURE)

Nov 06 18:15:38 rpi uv4l[17715]: <notice> [core] Device detected!
Nov 06 18:15:38 rpi uv4l[17715]: <notice> [core] Trying to load the the Streaming Server plug-in...
Nov 06 18:15:39 rpi uv4l[17715]: <notice> [server] HTTP/HTTPS Streaming & WebRTC Signalling Server v1.1.125 built on Sep  5 2019
Nov 06 18:15:39 rpi uv4l[17715]: Auto configuration failed
Nov 06 18:15:39 rpi uv4l[17715]: 1995535188:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:185:filename(libssl_conf.so): libssl_conf.so: cannot open shared object fiNov 06 18:15:39 rpi uv4l[17715]: 1995535188:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:
Nov 06 18:15:39 rpi uv4l[17715]: 1995535188:error:0E07506E:configuration file routines:MODULE_LOAD_DSO:error loading dso:conf_mod.c:285:module=ssl_conf, path=ssl_conf
Nov 06 18:15:39 rpi uv4l[17715]: 1995535188:error:0E076071:configuration file routines:MODULE_RUN:unknown module name:conf_mod.c:222:module=ssl_conf
Nov 06 18:15:39 rpi systemd[1]: uv4l_raspicam.service: Main process exited, code=exited, status=1/FAILURE
Nov 06 18:15:39 rpi systemd[1]: uv4l_raspicam.service: Failed with result 'exit-code'.

Immediately, you can see that there is something wrong since it returns failed status. Also, if you start analysing the output it can be seen that there is a problem with SSL library. Fixing this will fix the problem of running UV4L with Debian Buster on Raspberry Pi. Editing service script will solve this. Run following to edit the uv4l_raspicam.service file.

sudo vim /etc/systemd/system/uv4l_raspicam.service

Original file looks like this

[Unit]
Description=UV4L Raspicam

[Service]
Type=simple
ExecStart=/usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf
Restart=on-abnormal
LimitNOFILE=65536

After modification it should look like the one below

[Unit]
Description=UV4L Raspicam

[Service]
Type=simple
Environment="OPENSSL_CONF=/etc/uv4l/openssl.cnf"
ExecStart=/usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-file=/etc/uv4l/uv4l-raspicam.conf
Restart=on-abnormal
LimitNOFILE=65536

As it can be easily noticed, an additional line

Environment="OPENSSL_CONF=/etc/uv4l/openssl.cnf"

was added. It sets environmental variable for the configuration file of the OpenSSL. The tricky part is the file itself. If you try to copy current (Raspbian Buster) configuration file of OpenSSL to /etc/uv4l from /etc/ssl you will find soon enough that it does not solve the problem. This is because the file has changed and it differs from the one available on Debian Stretch. Following file is a copy of an original /etc/ssl/openssl.cnf from Debian Stretch. This will work on Raspberry Pi running Debian Buster. The file can be found here, just remember to rename it to openssl.cnf

After downloading the file rename it to openssl.cnf and copy it to your RPi with scp. Place it in /etc/uv4l. Now, reload systemctl daemon

sudo systemctl daemon-reload

Restart UV4L raspicam server

sudo service uv4l_raspicam restart

Check status of the server

sudo service uv4l_raspicam status

Now, you should be able to see that everything went well

uv4l_raspicam.service - UV4L Raspicam
   Loaded: loaded (/etc/systemd/system/uv4l_raspicam.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-11-06 18:16:42 CET; 21s ago
 Main PID: 17966 (uv4l)
    Tasks: 10 (limit: 2077)
   Memory: 3.9M
   CGroup: /system.slice/uv4l_raspicam.service
           └─17966 /usr/bin/uv4l -f -k --sched-fifo --mem-lock --config-file=/etc/uv4l/uv4l-raspicam.conf --driver raspicam --driver-config-file=/etc/uv4l/uv4l-raspicam.conf --server-option=--editable-config-fil

Nov 06 18:16:42 rpi uv4l[17966]: <notice> [driver] Selected format: 640x480, encoding: mjpeg, JPEG Video Capture
Nov 06 18:16:42 rpi uv4l[17966]: <notice> [driver] Framerate max. 30 fps
Nov 06 18:16:42 rpi uv4l[17966]: <notice> [core] Device detected!
Nov 06 18:16:42 rpi uv4l[17966]: <notice> [core] Trying to load the the Streaming Server plug-in...
Nov 06 18:16:43 rpi uv4l[17966]: <notice> [server] HTTP/HTTPS Streaming & WebRTC Signalling Server v1.1.125 built on Sep  5 2019
Nov 06 18:16:43 rpi uv4l[17966]: <notice> [server] SSL is enabled for the Streaming Server. Using secure HTTPS.
Nov 06 18:16:43 rpi uv4l[17966]: <notice> [core] Streaming Server loaded!
Nov 06 18:16:43 rpi uv4l[17966]: <warning> [core] Cannot create /dev/video0 because file already exists
Nov 06 18:16:43 rpi uv4l[17966]: <notice> [core] Registering device node /dev/video1
Nov 06 18:16:43 rpi uv4l[17966]: <notice> [server] Web Streaming Server listening on port 8080

That’s all! You should have UV4L server working once again! Probably with an another release of the UV4L software it will be fixed but for now (as of the date of writing this article) the official release of UV4L working under Debian Buster for Raspberry Pi is unfortunately unavailable. You can always check the UV4L package site for new releases.

3 thoughts on “UV4L on Raspberry Pi running Debian Buster

    1. Jan Szymanski

      Can’t open new.cert.csr for reading, No such file or directory
      1995669520:error:02001002:system library:fopen:No such file or directory:../crypto/bio/bss_file.c:69:fopen(‘new.cert.csr’,’r’)
      1995669520:error:2006D080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:76:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.