Captcha image not showing up (Ubuntu 20.04)

Hello community,

Since I upgraded to Ubuntu 20.04 Focal, I am having a broken captcha. I had to disable the functionnality.

I’m using imagemagick 6.9 with ghostscript 9.50. Also have gsfonts and ttf-mscorefonts-installer packages installed.

I’ve tried generating the captcha with imagemagick verbose logs enabled, there are no errors at all.

Here are the enabled lines from /etc/ImageMagick-6/policy.xml:

<policymap>
  <policy domain="resource" name="memory" value="256MiB"/>
  <policy domain="resource" name="map" value="512MiB"/>
  <policy domain="resource" name="width" value="16KP"/>
  <policy domain="resource" name="height" value="16KP"/>
  <policy domain="resource" name="area" value="128MB"/>
  <policy domain="resource" name="disk" value="1GiB"/>
  <policy domain="delegate" rights="none" pattern="URL" />
  <policy domain="delegate" rights="none" pattern="HTTPS" />
  <policy domain="delegate" rights="none" pattern="HTTP" />
  <policy domain="path" rights="none" pattern="@*"/>
</policymap>

I’ve seen other topics where the same issue was solved by commenting the following line. However it does not exist on my ImageMagick6 xml file.
<policy domain="coder" rights="none" pattern="LABEL" />

Any ideas on this please?

Thank you!

Hey!

The best is to watch log/production.log for errors while opening the sign up page.

Hi @jhass!

log/production.log is actually showing only one line:

[2021-01-11T06:13:46] INFO  PID-1483681 TID-47399854692720 Rails: Started GET "/simple_captcha?code=2ea31532cccda508415d50a52c52af33979621d3" for xx.xx.xx.xx at 2021-01-11 06:13:46 +0000

for https://diaspora.psyco.fr/simple_captcha?code=2ea31532cccda508415d50a52c52af33979621d3

Request is also returning an HTTP 200.

The solution is in the first line of the response of the request:

$ curl "https://diaspora.psyco.fr/simple_captcha?code=2ea31532cccda508415d50a52c52af33979621d3" | head -1
ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

So you probably have hardcoded the path to libjemalloc somewhere (systemd service file?), but with Ubuntu 20.04 it was upgraded to libjemalloc.so.2 and libjemalloc.so.1 is no longer available. So your problem has nothing to do with imagemagick directly.

Hello,

Thanks for your help! Using curl | head -1 is very handy :slight_smile:

I’m using eye to launch diaspora server currently, and not using LD_PRELOAD in the eye.rb script. Also libjemalloc is not installed.

I’ve tried installing libjemalloc2 and adding the following line to the eye.rb script:
env "LD_PRELOAD" => "/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
and reloading it / restarting diaspora just now, but it looks like that it’s still trying to find libjemalloc.so.1.

I’m trying to find out where this could be hardcoded.

If you use eye with script/server then it shouldn’t be hardcoded. script/server tries to detect the correct path for libjemalloc: https://github.com/diaspora/diaspora/blob/develop/script/server#L196 (but if it isn’t installed, then it doesn’t add anything)

I also can highly recommend to install it to improve your memory usage a lot.

1 Like

I ended up just creating a symlink between .so.1 and .so.2 files for now. I’ll update here when I find the root cause.

Thank you !