[SRU] R_HOME environmental variable not set
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
plr (Debian) |
Fix Released
|
Unknown
|
|||
plr (Ubuntu) |
Fix Released
|
Undecided
|
Martin Pitt | ||
Dapper |
Fix Released
|
Undecided
|
Unassigned | ||
Edgy |
Fix Released
|
Undecided
|
Unassigned | ||
Feisty |
Fix Released
|
Medium
|
Unassigned |
Bug Description
When installing postgresql-8.1-plr on fiesty (other releases/plr versions??) the R_HOME environmental variable is not set in /etc/postgresql
Usually setting R_HOME is not a big deal, as one can put it in /etc/profile, or ~postgres/.bashrc, etc.
But the init.d scripts are using pg_ctlcluster when starting postgres. And, after many hours of searching, I found that pg_ctlcluster clears the environment variables.
From a change log I found:
"""
* Support auxiliary environment variables for postmaster:
- pg_createcluster: Create /etc/postgresql
file (empty, just a comment).
...
- pg_ctlcluster: Clear environment and only set variables mentioned in
environment file and LANG/LC_ALL.
"""
=======
Step to reproduce:
1) Make sure postgres is started
$ /etc/init.
2) create a test database
$ sudo -u postgres createdb plr_test
3) setup R functions
$ sudo -u postgres psql plr_test < /usr/share/
4) create a user function that calls R
$ sudo -u postgres psql plr_test
plr_test=# CREATE OR REPLACE FUNCTION test() RETURNS text AS 'return ()' LANGUAGE 'plr' IMMUTABLE STRICT;
CREATE FUNCTION
5) call the function
plr_test=# select test();
ERROR: environment variable R_HOME not defined
HINT: R_HOME must be defined in the environment of the user that starts the postmaster process.
=======
To fix: Add a "R_HOME = '/usr/lib/R' " to /etc/postgresql
Example Fix for version 8.1:
$ sudo -s
# echo -e "\nR_HOME = '/usr/lib/R'" >> /etc/postgresql
# exit
To Test:
$ sudo /etc/init.
$ sudo -u postgres psql plr_test
plr_test=# select test();
test
------
(1 row)
Changed in plr: | |
status: | Unknown → New |
Changed in plr: | |
status: | New → Fix Released |
Confirmed in Gutsy, Feisty, Edgy, and Dapper.
Dapper version requires additional love: postgresql/ 8.1/plr. sql postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory postgresql/ 8.1/lib/ plr.so" : libR.so: cannot open shared object file: No such file or directory bugs.debian. org/360796.
root@gandalf:/# sudo -u postgres psql plr_test < /usr/share/
SET
ERROR: could not load library "/usr/lib/
ERROR: function plr_call_handler() does not exist
ERROR: could not load library "/usr/lib/
ERROR: could not load library "/usr/lib/
ERROR: could not load library "/usr/lib/
ERROR: could not load library "/usr/lib/
ERROR: could not load library "/usr/lib/
ERROR: relation "plr_environ_type" already exists
ERROR: could not load library "/usr/lib/
ERROR: function plr_environ() does not exist
ERROR: relation "r_typename" already exists
ERROR: language "plr" does not exist
ERROR: language "plr" does not exist
We need to use fix from http://