Fix Drupal's "Failed to get available update data" error on Available updates

nabbisen - May 26 '21 - - Dev Community

Summary

That short made me really troubled meanwhile😅


Environment


I have installed Drupal 8/9 on OpenBSD several times.

Drupal admin panel has the function to look up "Available updates" in "Report" pages.
I was in trouble because it always failed after those installations.

Failed

Fig.1 Failed

Solution

I found it was because of TLS connection failure, after struggling and being empowered by the official documentation:

To fix it, place cacert.pem under chroot's root and configure PHP aka php.ini.

First, get the certificate.



$ # /etc in `chroot` is `/var/www/etc` in actual
$ cd /var/www/etc

$ doas mkdir ssl
$ cd ssl

$ # get the cacert.pem
$ doas ftp https://curl.haxx.se/ca/cacert.pem
$ doas chmod a-w cacert.pem


Enter fullscreen mode Exit fullscreen mode

It looks like:



$ pwd
/var/www/etc/ssl
$ ls -l
total 448
-r--r--r--  1 root  daemon  206919 Apr 13 12:12 cacert.pem


Enter fullscreen mode Exit fullscreen mode

Then, edit php.ini.



$ doas nvim /etc/php-7.4.ini


Enter fullscreen mode Exit fullscreen mode

to add the line:



  [curl]
  ; A default value for the CURLOPT_CAINFO option. This is required to be an
  ; absolute path.   
  ;curl.cainfo =
+ curl.cainfo = "/etc/ssl/cacert.pem"


Enter fullscreen mode Exit fullscreen mode

Finally, restart the PHP-FPM daemon.



$ doas rcctl restart php74_fpm
Enter fullscreen mode Exit fullscreen mode




Conclusion

Happily, my site got the update information🙂

Successful

Fig.2 Successful
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .