I tried the approach suggested by Torsten Bronger in How do I add lens correction for my model+lens to Lensfun in Darktable? (extracting the xml files from 0.3.0 tar and overwriting in /usr/share/lensfun). There are three problems: 1. Darktable still doesn't recognize the lens, even if the entry is in one of the xml files. 2. Darktable no longer shows a drop-down list of lenses (clicking in the box, nothing happens) but it did before I overwrote the files. 3. http://wilson.bronger.org/lensfun_coverage.html says that lens "Nikkor AF-S 18-55mm f/3.5-5.6G DX VR II" is available in 0.3.0, but the downloaded .xml files do not show an entry for it (only for VR without "II"). I tried duplicating the VR entry and adding "II" to the name, but still, Darktable wouldn't recognize it.

Darktable's exact wording for the lens is: "Nikon AF-S DX Nikkor 18-55mm f/2.5-5.6G VR II"

So my question is, how to manually install lensfun 0.3.0. The README is not clear on where to extract the files. Do I extract them into /usr/share/lensfun? or in a temp area and MAKE will correctly copy them to /usr/share/lensfun?

  • \$\begingroup\$ Maybe your database format doesn't work for your lensfun version. If you start darktable form the command line, do you see lensfun complaints? \$\endgroup\$ Commented Apr 18, 2015 at 6:13
  • \$\begingroup\$ What is the version number of your lensfun? Not the database, but the library. \$\endgroup\$ Commented Apr 18, 2015 at 10:40
  • \$\begingroup\$ Please edit your question to add the result of this command: ls -al /usr/share/lensfun | grep nikon. Welcome to stackexchange! \$\endgroup\$
    – chili555
    Commented Apr 18, 2015 at 13:02
  • \$\begingroup\$ Version number of lensfun was from the standard package on ubuntu: 0.2.8. \$\endgroup\$
    – dsaronin
    Commented Apr 19, 2015 at 2:24
  • \$\begingroup\$ with my original install of darktable 1.6.4 and lensfun 0.2.8, it worked fine for finding the lens of my Nikon D3100 kit lens 18-55mm. Only after I got a new camera D5300 with the aforementioned newer version of the kit lens, did I have the issue that the lens wasn't found. In researching a solution, I found that later versions of lensfun did appear to support the new lens, but upon downloading the tar, I see that in fact it did NOT have data for the new lens in 0.3.0. \$\endgroup\$
    – dsaronin
    Commented Apr 19, 2015 at 2:26

3 Answers 3


The lensfun website explains how to update lenses without root permissions (see how database files are found and loaded). What worked for me was:

mkdir -p .local/share/lensfun
cd .local/share/lensfun

Then download and extract the updated lenses:

wget http://wilson.bronger.org/db/version_0.tar.bz2
bunzip2 version_0.tar.bz2
tar xvf version_0.tar

The referenced link mentions that you should place the files in .local/share/lensfun/updates but that did not work for me. Also, the download link is from the personal website of the creator of lensfun so it should be there for a while.

  • \$\begingroup\$ This works perfectly for me. I've spent a long time trying to solve this issue until I found this solution, thanks a lot. \$\endgroup\$ Commented May 9, 2019 at 0:11
  • \$\begingroup\$ At least newer versions of lensfun have a tool lensfun-update-data which downloads the latest lens data to ~/.local/share/lensfun/updates. I still had to move them one level up, though, so your answer was very helpful! \$\endgroup\$
    – luator
    Commented Dec 23, 2020 at 8:33
  • \$\begingroup\$ So the full steps for me were: lensfun-update-data; cd ~/.local/share/lensfun; ln -s updates/*.xml . \$\endgroup\$
    – luator
    Commented Dec 23, 2020 at 8:33

Solution found. See below. Here are the steps I took to fix the issues described.

  1. uninstalled darktable and lensfun packages via synaptic.
  2. fresh install of darktable (which also installs the dependency of lensfun 0.2.8)
  3. unpacked lensfun 0.3.0 tar into my home directory, to folder lensfun-0.3.0
  4. $ cd lensfun-0.3.0
  5. $ gvim data/db/slr-nikon.xml
  6. copy and insert a duplicate of data for Nikon AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G VR, remove the vignette lines (since the lensfun table said NO), add " II" to the model name, change cropfactor to 1.523 (per the latest lensfun table); save file.
  7. $ mkdir cmake_build
  8. $ cd cmake_build
  10. $ make
  11. $ sudo make install

Also note preparatory step 0: $ sudo apt-get install cmake make doxygen libglib2.0-dev

Step 6 creates a close-enough approximation to the new lens (assumption). Step 9 is required due to the where the Ubuntu lensfun package is installed (/usr/share). Step 10 requires sudo to write into /usr/share and overwrite the 0.2.8 data files.

I would suggest that the lensfun tar README be updated to reflect steps 9 and 10 for ubuntu users (there's a large number of us in the world).

Now, when I open darktable, it successfully recognizes the D5300 kit lens II and gets the data.

  • 1
    \$\begingroup\$ I don't think you want to change the crop factor for a given data set. Since that's the crop factor that the data was obtained with, it's part of the correction data. You should either get the updated data set for your lens from here, or just use the lensfun-update-data command mentioned in the other answer. \$\endgroup\$ Commented Apr 19, 2015 at 19:20

I got it working with lensfun version 0.2.8 without having to recompile and install manually version 0.3.1, just by slightly editing and using 0.3.1 db.

The main difference between 0.2.8 and 0.3.1 xmls (set aside the number of cameras and lens covered) seems to be in the parent markup <lensdatabase> versus <lensdatabase version="1"> respectively. So if you remove version="1" in the markup, darktable (I tested with 1.6.7) loads properly both cameras and lens.

But if you actually use Torsten Bronger's files as specified in How do I add lens correction for my model+lens to Lensfun in Darktable?, you don't need to manually edit the xml files as they don't contain the version info and the content is very close to 0.3.1 and maybe even more up-to-date.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.