[R-sig-Debian] update.packages() as ordinary user, /usr/lib/R/site-library is not writable

Dirk Eddelbuettel edd at debian.org
Wed Sep 21 14:49:22 CEST 2011

Hi Chris,

Thanks for patient follow-up even after I (as Johannes noted) evidently
overlooked key parts of your first email.

On 21 September 2011 at 07:49, Chris Evans wrote:
| I ran synaptic from the Debian application menu which defaults to root 
| after askling for the root password the first time I invoke it after a 
| reboot. (I probably should have said that I've been using Debian for my 
| internet server work for about 15 years: I'm not a Debian/linux newbie, 
| just someone finally throwing away the reins from M$ to have a laptop 
| running Debian as well!)


| I get that from invoking update.packages() in an R session launched from 
| a user (chris) terminal session. Before that I had done an install of 

I do that too, as well as calling the 'install.r' helper script from littler
(in its examples/ diretory, if interested).

This requires that you make /usr/local/lib/R/site-library/ writable for _you_
as user chris, else you cannot.

[ It also assumes that the Renviron setting mentioned last time is still
valid, do this:

edd at max:~$ R -q -e 'print(.libPaths())'
R> print(.libPaths())
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"       "/usr/lib/R/library"           

It _must_ be first as here.  ]

Now, /usr/local/lib/R/site-library/ comes shipped from the r-base-core
package as owned by group 'staff' so one solution is to add yourself to group

edd at max:~$ ls -ld /usr/local/lib/R/site-library/
drwxrwsr-x 136 root staff 4096 2011-09-20 07:44 /usr/local/lib/R/site-library/
edd at max:~$ id
uid=1000(edd) gid=1000(edd)
edd at max:~$ 

If those two conditions are met, you should be able to run install.packages()
as you.  I still prefer it from the shell as I sometimes need another apt-get
call for a missing library etc.

| I wouldn't dream of compiling locally anything I can get from a deb you 
| rolled!!


| However, I come back to feeling that there must be three separate 
| problems here that come from within the packages I added after the 
| initial r-cran-base install. My hunch is that there are things with XML 
| and rgl that I will be able to track down when restrict to just updating 

"I would not dream of compiling locally" either.  You could start by locally
re-building the packages.  Which requires the build depends.

| them but that at the moment there is a more global problem which I'm 
| guessing is caused by one package overriding the order of library path 
| options seen in .libPaths() which starts with a perfectly writable local 
| user directory and I am guessing there is some way that package has 
| insisted that the install tries /usr/lib/R/library.

Agreed on the first bit.  I think /usr/lib/R/library -- where we as users
should never tread as it is /usr which belongs to apt/dpkg -- is just the
fallback.  Somehow the value got nuked.
| I don't know enough about the way that R and linux work agree the use of 
| those library location options. From ?.libPaths and a bit more hunting 
| around the R help I had the impression that the .libPath options would 
| be used in order. I think I can remove the /usr ones by hacking in 


| /etc/R but that presumably risks losing access to the main libraries 
| that will have been installed there so that doesn't look a good step 
| forward except perhaps to debug things.

An easier option ... is to _explicitly add_ the
/usr/local/lib/R/site-library/ destination as an argument to install.packages!
| I suspect that I could do a complete remove of all of R, start again 
| installing r-cran-base, check that R installed by that updates fine run 
| by a user and then I could use synaptic to add the additional deb 
| packages you provide but doing that one by one and running R and 
| update.packages() after each one to see if I don't hit this until afetr 
| a particular deb but that's going to take quite a long time so I 
| wondered if you or the list had quicker suggestions to debug this.

That sounds too involved.
| Sorry for length but hope that's clearer (got to try to be an acceptable 
| friend on R lists as well as with linux and I really, really do 
| appreciate the generosity of this list).

No sweat. We're all just building karma :)


New Rcpp master class for R and C++ integration is scheduled for 
San Francisco (Oct 8), more details / reg.info available at

More information about the R-SIG-Debian mailing list