Dspace 7.4 backend pgcrypto extension not installed error

296 views
Skip to first unread message

Jeff Mitchell

unread,
Dec 2, 2022, 12:19:20 PM12/2/22
to DSpace Technical Support
Hello all,

I just finished the build section of the configuration but when I got to run the ant fresh_install I get:

     [java] WARNING: Required PostgreSQL 'pgcrypto' extension is NOT INSTALLED on this database.

     [java] 

     [java] ** DSpace REQUIRES PostgreSQL >= 9.4 AND pgcrypto extension >= 1.1 ** 

However, when I check to see what extensions are installed it shows me that pgcrypto 1.3 is installed and yes I installed it as postgres and dspace db users. I'm running PSQL 13 if that helps.

Thanks in advance!

Jeff

Jeff Mitchell

unread,
Dec 2, 2022, 12:49:34 PM12/2/22
to DSpace Technical Support
Just to clarify I had run this already and restarted PSQL as well before running the build and install

# Login to the database as a superuser, and enable the pgcrypto extension on this database
psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"

Mohammad S. AlMutairi

unread,
Dec 3, 2022, 8:26:32 PM12/3/22
to DSpace Technical Support
Hi Jeff,

It is created but it can not be found because it's not included in the search path. One way of fixing this is to create a schema for all extensions first and then create the pgcrypto extension and add it to that schema. Just follow the steps you see below to pass the error.

1) su - postgres
2) createuser --username=postgres --no-superuser --pwprompt dspace
3) createdb --username=postgres --owner=dspace --encoding=UNICODE dspace
4) psql --username=postgres dspace
5) CREATE SCHEMA extensions;
6) CREATE EXTENSION pgcrypto SCHEMA extensions;
7) GRANT USAGE ON SCHEMA extensions TO dspace;
8) SELECT set_config('search_path',current_setting('search_path') || ',extensions',false) WHERE current_setting('search_path') !~ '(^|,)extensions(,|$)';
9) SHOW search_path;
10) ALTER DATABASE dspace SET search_path FROM CURRENT;
11) \q
12) exit

Good luck

Mohammad S. AlMutairi

unread,
Dec 4, 2022, 8:01:56 PM12/4/22
to DSpace Technical Support
@Tim I hope you see this to fix/add an extra missing step to the pgcrypto extention creation in the domcumentation so no user will face the warning message Jeff posted if the user chose to create the extention on the dspace database instead of adding it to a schema.

Executing psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;" alone won't work unless the search_path is set to include the pgcrypto extention in it.

# This should work
1) psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"
2) psql --username=postgres dspace -c 'ALTER ROLE dspace IN DATABASE dspace SET search_path = "$user",public,extensions,pgcrypto;'
3) psql --username=postgres dspace -c 'SHOW search_path;'

# Or this one
1) psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"
2) psql --username=postgres dspace -c 'ALTER DATABASE dspace SET search_path = "$user",public,extensions,pgcrypto;'
3) psql --username=postgres dspace -c 'SHOW search_path;'

# Or this one if the search path is set globally in the main postgresql configuration file.
1) vi /path-to/postgresql.conf
search_path = '$user",public,extensions,pgcrypto'

# Or this one if the dspace script/scripts sets the search_path in them (SET search_path = "$user",public,extensions,pgcrypto;).
1) psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"

Trying to help.
Reply all
Reply to author
Forward
0 new messages