Source: Using a digital camera ( Canon) as webcam – Ask Ubuntu
Few additions to the original article (I used the beta of Ubuntu 20.04, but it should work on older versions):
– after installing sudo apt install gphoto2 v4l2loopback-utils
when your camera mounts, unmount it (in your normal Ubuntu setup you can unmount the camera using right mouse button in file explorer Nautilus when clicking on the camera in the bar on the left)
– after sudo modprobe v4l2loopback
you create a video device with the camera, but when you don’t have another active cam (like the internal webcam of your laptop) you have to set the device to /video0 instead of /video1 or /video2:gphoto2 --stdout --capture-movie | gst-launch-1.0 fdsrc ! decodebin3 name=dec ! queue ! videoconvert ! v4l2sink device=/dev/video1
When you want to use the camera for tethering in applications like Darktable, you should be able to use the camera without any of the additional applications as shown above, but you must make sure your camera is unmounted as well!
Make sure you use the right setting, like the active camera view or the video setting on the camera. Toy around with those settings on the camera when it doesn’t work.