Ao tentar instalar o R no Ubuntu 16.04 xenial, estou preso porque r-base-core
não pode ser configurado. Estou usando o manual comum . Após a instalação com falha e tentativa de configurar manualmente r-base-core
, o console basicamente se parece com isto:
~$ sudo dpkg --configure r-base-core
Setting up r-base-core (3.3.2-1xenial0) ...
dpkg: error processing package r-base-core (--configure):
subprocess installed post-installation script returned error exit
status 10
Errors were encountered while processing:
r-base-core
O script de pós-instalação r-base-core.postinst
em /var/lib/dpkg/info
contém o seguinte:
#!/bin/sh
#
# postinst script for the Debian GNU/Linux r-base-core package
# This version originally written by Douglas Bates <[email protected]>
# and now written and maintained by Dirk Eddelbuettel <[email protected]>
set -e
# Automatically added by dh_installdeb
dpkg-maintscript-helper mv_conffile /etc/bash_completion.d/R /usr/share/bash-completion/completions/R -- "$@"
# End automatically added section
case "$1" in
configure)
# edd 19 Jun 2004 deal with papersize
# edd 22 Jun 2004 make that conditional on paperconf
# edd 25 Oct 2006 rewritten for R 2.4.0 and R_PAPERSIZE_USER
# edd 21 Jun 2008 rewritten for R 2.7.1 and ucf input
# edd 23 Feb 2013 trying to avoid md5sum issues with help from Andy Beckman
# edd 26 Feb 2013 correct mode of temp. Renviron file with help from Don Armstrong
tmpRenviron=$(mktemp)
chmod 0644 "$tmpRenviron"
cat /usr/lib/R/etc/Renviron.ucf > "$tmpRenviron"
#if [ -x /usr/bin/paperconf ]; then
## get the value we want from Debian's paperconf utility
papersize='paperconf'
## have perl subst. second expression with $papersize for first
## uses the x mod. and curlies to denote the usual s|1st|2nd|
perl -p -i -e "s{^R_PAPERSIZE_USER=\$\{R_PAPERSIZE\}}
{R_PAPERSIZE_USER=\$\{R_PAPERSIZE-'$papersize'\}}x" "$tmpRenviron"
#fi
# edd 21 Jun 2008 whether or not Renviron was modified, ucf will handle it,
# so tell ucf that file Renviron.ucf is the source for
# conffile in /etc and register it
ucf "$tmpRenviron" /etc/R/Renviron
ucfr r-base-core /etc/R/Renviron
rm -f "$tmpRenviron"
#
#if [ -x /usr/bin/update-menus ]; then
# update-menus
#fi
# edd 03 Apr 2003 cf Section 10.1.2 of Debian Policy
if [ ! -e /usr/local/lib/R ]; then
if mkdir /usr/local/lib/R 2>/dev/null; then
chown root:staff /usr/local/lib/R
chmod 2775 /usr/local/lib/R
fi
fi
if [ ! -e /usr/local/lib/R/site-library ]; then
if mkdir /usr/local/lib/R/site-library 2>/dev/null; then
chown root:staff /usr/local/lib/R/site-library
chmod 2775 /usr/local/lib/R/site-library
fi
fi
#if [ -x /usr/bin/mktexlsr ]; then
# mktexlsr /usr/share/texmf
#fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \'$1'" >&2
;;
esac
Eu já tentei remover o script de pós-instalação para que a configuração acima seja executada sem erros e, de fato, o r-base pode ser instalado. No entanto, ao digitar R
no console, é assim que o console se parece:
cannot find system Renviron
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Error : .onLoad failed in loadNamespace() for 'utils', details:
call: options(op.utils[toset])
error: invalid value for 'editor'
Error : .onLoad failed in loadNamespace() for 'utils', details:
call: options(op.utils[toset])
error: invalid value for 'editor'
In addition: Warning message:
package ‘utils’ in options("defaultPackages") was not found
During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found
Definir a variável de ambiente como tal não altera nada:
export R_HOME=/usr/lib/R/
O conteúdo da pasta de instalação do R é:
~$ ls -l /etc/R
total 40
-rw-r--r-- 1 root root 793 Nov 1 11:45 ldpaths
-rw-r--r-- 1 root root 784 Apr 24 2016 ldpaths.dpkg-old
-rw-r--r-- 1 root root 6304 Nov 1 11:45 Makeconf
-rw-r--r-- 1 root root 6354 Apr 24 2016 Makeconf.dpkg-old
-rw-r--r-- 1 root root 608 Apr 24 2016 Renviron.site
-rw-r--r-- 1 root root 1161 Nov 1 11:45 repositories
-rw-r--r-- 1 root root 1424 Apr 24 2016 repositories.dpkg-old
-rw-r--r-- 1 root root 792 Apr 24 2016 Rprofile.site
Aparentemente, o script de pós-instalação falha quando o ucf deve fazer alguma coisa. Ao adicionar o argumento -x
ao script de pós-instalação:
Setting up r-base-core (3.3.2-1xenial0) ...
+ dpkg-maintscript-helper mv_conffile /etc/bash_completion.d/R /usr/share/bash-completion/completions/R -- configure
+ mktemp
+ tmpRenviron=/tmp/tmp.MANJybxXxQ
+ chmod 0644 /tmp/tmp.MANJybxXxQ
+ cat /usr/lib/R/etc/Renviron.ucf
+ paperconf
+ papersize=a4
+ perl -p -i -e s{^R_PAPERSIZE_USER=\$\{R_PAPERSIZE\}}
{R_PAPERSIZE_USER=\$\{R_PAPERSIZE-'a4'\}}x /tmp/tmp.MANJybxXxQ
+ ucf /tmp/tmp.MANJybxXxQ /etc/R/Renviron
dpkg: error processing package r-base-core (--configure):
subprocess installed post-installation script returned error exit status 10
Com base em outras postagens que encontrei on-line sobre problemas do ucf em scripts de pós-instalação, adicionei o nível de depuração 3 à linha ucf no script posinstallation. É assim que o console se parece agora:
+ dpkg-maintscript-helper mv_conffile /etc/bash_completion.d/R /usr/share/bash-completion/completions/R -- configure
+ mktemp
+ tmpRenviron=/tmp/tmp.LsP3FSBIRI
+ chmod 0644 /tmp/tmp.LsP3FSBIRI
+ cat /usr/lib/R/etc/Renviron.ucf
+ paperconf
+ papersize=a4
+ perl -p -i -e s{^R_PAPERSIZE_USER=\$\{R_PAPERSIZE\}}
{R_PAPERSIZE_USER=\$\{R_PAPERSIZE-'a4'\}}x /tmp/tmp.LsP3FSBIRI
+ ucf --debug=3 /tmp/tmp.LsP3FSBIRI /etc/R/Renviron
The new start file is '/tmp/tmp.LsP3FSBIRI\'
The destination is '/etc/R/Renviron\' ('\/etc\/R\/Renviron\')
The history is kept under \'/tmp\'
The file may be cached at \'/var/lib/ucf/cache/:etc:R:Renviron\'
The destination file does not exist.
The old md5sum does not exist.
The new file exists, and has md5sum:
7c899e0d9d42df33d5dfd303ef43c46b /tmp/tmp.LsP3FSBIRI
Historical md5sums are not available
The new start file is '/tmp/tmp.LsP3FSBIRI\'
The destination is '/etc/R/Renviron\' ('\/etc\/R\/Renviron\')
The history is kept under \'/tmp\'
The file may be cached at \'/var/lib/ucf/cache/:etc:R:Renviron\'
dpkg: error processing package r-base-core (--configure):
subprocess installed post-installation script returned error exit status 20