title: unable to uninstall and reinstall R on centos
body: <p>I am trying to uninstall R in centos. I have tried </p>
  
  <pre><code>sudo rpm -e R.x86_64
  &gt;error: %preun(R-2.13.0-2.el6.rf.x86_64) scriptlet failed, exit status 1
  
  sudo yum remove R
  &gt;Failed:
    R.x86_64 0:2.13.0-2.el6.rf 
  
  R
  &gt;R version 3.1.0 (2014-04-10) -- "Spring Dance"
  Copyright (C) 2014 The R Foundation for Statistical Computing
  Platform: x86_64-redhat-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.
  </code></pre>
  
  <p>Iam unable to uninstall R its failing when i try with yum and rpm, later when i try R again it runs R as above. Please help how to uninstall R in centos.</p>
  
  <p>I have deleted the R directory due to that R execution is not working, but the reinstallation of R is also not working., I have to reinstall R again to install some of the packages which were not working earlier, please find the steps below:</p>
  
  <pre><code>$sudo rm -rf /usr/lib64/R ** deleted the R directory
  
  
  $sudo rpm -ivh http://mirror.chpc.utah.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  
  
  $sudo yum  -y  –enablerepo=epel  install  R  R-devel
  &gt;Loaded plugins: fastestmirror, refresh-packagekit, security
  
  $sudo yum  install RLoaded plugins: fastestmirror, refresh-packagekit, security
  &gt;Loading mirror speeds from cached hostfile
  epel/metalink                                            | 5.3 kB     00:00     
   * base: centos.aol.in
   * epel: mirror-fpt-telecom.fpt.net
   * extras: centos.aol.in
   * rpmforge: mirror-fpt-telecom.fpt.net
   * updates: centosmirror.go4hosting.in
  Cloudera-cdh4                                            |  951 B     00:00     
  base                                                     | 3.7 kB     00:00     
  cloudera-impala                                          |  951 B     00:00     
  extras                                                   | 3.4 kB     00:00     
  rpmforge                                                 | 1.9 kB     00:00     
  updates                                                  | 3.4 kB     00:00     
  Setting up Install Process
  Package R-3.1.0-5.el6.x86_64 already installed and latest version
  Nothing to do
  
  $R
  &gt;/usr/bin/R: line 236: /usr/lib64/R/etc/ldpaths: No such file or directory
  
  $ rpm -q --scripts R
  postinstall scriptlet (using /bin/sh):
  /sbin/install-info /usr/share/info/R-FAQ.info.gz /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info /usr/share/info/R-admin.info.gz /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info /usr/share/info/R-exts.info.gz /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info /usr/share/info/R-intro.info.gz /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info /usr/share/info/R-lang.info.gz /usr/share/info/dir 2&gt;/dev/null
  /sbin/ldconfig
  preuninstall scriptlet (using /bin/sh):
  /sbin/install-info --delete R-FAQ /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info --delete R-admin /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info --delete R-exts /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info --delete R-intro /usr/share/info/dir 2&gt;/dev/null
  /sbin/install-info --delete R-lang /usr/share/info/dir 2&gt;/dev/null
  postuninstall program: /sbin/ldconfig
  
  $ rpm --noscripts -e R
  error: "R" specifies multiple packages:
    R-2.13.0-2.el6.rf.x86_64
    R-3.1.0-5.el6.x86_64
  $ R
  /usr/bin/R: line 236: /usr/lib64/R/etc/ldpaths: No such file or directory
  </code></pre>
  
  <p>With the new commands.. not sure what does sudo rpm --noscripts -e --allmatches R do?</p>
  
  <pre><code>$ sudo rpm --noscripts -e --allmatches R
  $ R
  /usr/bin/R: line 236: /usr/lib64/R/etc/ldpaths: No such file or directory
  
  $ sudo yum reinstall R
  Loaded plugins: fastestmirror, refresh-packagekit, security
  Setting up Reinstall Process
  Loading mirror speeds from cached hostfile
  epel/metalink                                            | 4.7 kB     00:00     
   * base: centos.aol.in
   * epel: mirror-fpt-telecom.fpt.net
   * extras: centos.aol.in
   * rpmforge: mirror-fpt-telecom.fpt.net
   * updates: centosmirror.go4hosting.in
  Cloudera-cdh4                                            |  951 B     00:00     
  base                                                     | 3.7 kB     00:00     
  cloudera-impala                                          |  951 B     00:00     
  extras                                                   | 3.4 kB     00:00     
  rpmforge                                                 | 1.9 kB     00:00     
  updates                                                  | 3.4 kB     00:00     
  No Match for argument: R
  Package(s) R available, but not installed.
  Nothing to do
  
  $ sudo rpm --noscripts -e --allmatches R
  error: package R is not installed
  
  $ R
  /usr/bin/R: line 236: /usr/lib64/R/etc/ldpaths: No such file or directory
  </code></pre>
  
  <p>Current Output: -</p>
  
  <pre><code>$ type -p R
  /usr/bin/R
  
  $ sudo yum install R
  Loaded plugins: fastestmirror, refresh-packagekit, security
  Loading mirror speeds from cached hostfile
   * base: centos.aol.in
   * epel: epel.mirror.net.in
   * extras: centos.aol.in
   * rpmforge: mirror-fpt-telecom.fpt.net
   * updates: centosmirror.go4hosting.in
  Setting up Install Process
  Resolving Dependencies
  --&gt; Running transaction check
  ---&gt; Package R.x86_64 0:3.1.0-5.el6 will be installed
  --&gt; Finished Dependency Resolution
  
  Dependencies Resolved
  
  ================================================================================
   Package      Arch              Version                   Repository       Size
  ================================================================================
  Installing:
   R            x86_64            3.1.0-5.el6               epel             21 k
  
  Transaction Summary
  ================================================================================
  Install       1 Package(s)
  
  Total download size: 21 k
  Installed size: 0  
  Is this ok [y/N]: y
  Downloading Packages:
  R-3.1.0-5.el6.x86_64.rpm                                 |  21 kB     00:00     
  Running rpm_check_debug
  Running Transaction Test
  Transaction Test Succeeded
  Running Transaction
  Warning: RPMDB altered outside of yum.
  ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
  R-devel-3.1.0-5.el6.x86_64 has missing requires of R-core-devel = ('0', '3.1.0', '5.el6')
  R-java-devel-3.1.0-5.el6.x86_64 has missing requires of R-core-devel = ('0', '3.1.0', '5.el6')
    Installing : R-3.1.0-5.el6.x86_64                                         1/1 
  Unable to send message to PackageKit
    Verifying  : R-3.1.0-5.el6.x86_64                                         1/1 
  
  Installed:
    R.x86_64 0:3.1.0-5.el6                                                        
  
  Complete!
  
  $ R
  /usr/bin/R: line 236: /usr/lib64/R/etc/ldpaths: No such file or directory
  </code></pre>
  
  <p>How can we build the binary file which got deleted, it got installed but not building the file to execute R</p>