9

I am working on a CentOS 7 workstation. I had installed Rstudio and it was working fine until recently. But now, if I try to launch it at http://localhost:8787/ I get an error that says Unable to connect to service

I checked if R is working properly in terminal and I got following error.

/usr/lib64/R/bin/exec/R: error while loading shared libraries: /lib/libgcc_s.so.1: file too short

If I try to install R again using following command, sudo yum install R -y I get following reply

Package R-3.5.2-2.el7.x86_64 already installed and latest version
Nothing to do

What do I have to do?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Satyajeet Khare
  • 103
  • 1
  • 1
  • 6
  • I know this message and it is typically true: The `so` is truncanted or empty because of some prior problem. What does `objdump /lib/libgcc_s.so.1` say (if you have the GNU tools installed)? – Philippos Jun 07 '19 at 08:28
  • I don't get the output. It asks for more details. It says `At least one of the following switches must be given` and then there are options `--archive-headers` `--file-headers` etc. And the output is blank if I select these two options. – Satyajeet Khare Jun 07 '19 at 08:32
  • You are right. Just choose some random option like `objdump -a` – Philippos Jun 07 '19 at 08:35
  • I updated my post a bit late. There is no output with any option I try. – Satyajeet Khare Jun 07 '19 at 08:38
  • Then I bet the file is empty. In this case uninstall and reinstall the package. – Philippos Jun 07 '19 at 08:41
  • I removed R, R-core, R-devel and R-core-devel using `remove` command. I re-installed R using `sudo yum install epel-release` and `sudo yum install R`. The installation completed successfully with `Complete!` message. But if I hit `R --version`, I again the get the same error. – Satyajeet Khare Jun 07 '19 at 08:56
  • what is the size of `/lib/libgcc_s.so.1` if it is symlink share source file size. – asktyagi Jun 07 '19 at 09:01
  • 1
    Looks like an empty file. `0 /lib/libgcc_s.so.1` – Satyajeet Khare Jun 07 '19 at 09:06
  • Check which package provides and try install it with test mode to check what are the things will be changed, if it's production server pay extra attention. It may screw the things. – asktyagi Jun 07 '19 at 09:10

2 Answers2

7

You have a damaged .so.

In general, you issue the following command to find the package it belongs to:

yum provides \*/<so_file>

In your case:

$ yum provides \*/libgcc_s.so.1
[...]
libgcc-4.4.6-4.el6.i686 : GCC version 4.4 shared support library
Repo : base
Matched from:
Filename : /lib/libgcc_s.so.1
[...]

In this case, we want libgcc-4.4.6-4.el6.i686, you will get another version.

You need to reinstall that package.

yum reinstall libgcc-<version>.i686
thecarpy
  • 3,885
  • 1
  • 16
  • 35
  • I tried doing that but got an error. `Loaded plugins: fastestmirror, langpacks No Match for argument: libgcc-4.4.6-4.el6.i686 Loading mirror speeds from cached hostfile * base: mirror.nbrc.ac.in * epel: kartolo.sby.datautama.net.id * extras: mirror.nbrc.ac.in * updates: mirror.nbrc.ac.in Error: Nothing to do` . `No package libgcc-4.4.6-4.el6.i686 available.` – Satyajeet Khare Jun 07 '19 at 09:07
  • Yeah, hm, I should have removed version info! Will edit my answer ... I do not have CentOS 7 here ... ;-) What does `yum provides \*/libgcc_s.so.1` report for `/lib/libgcc_s.so.1` ? – thecarpy Jun 07 '19 at 09:38
  • Multiple lines but mostly this `libgcc-4.8.5-36.el7_6.2.i686 : GCC version 4.8 shared support library` – Satyajeet Khare Jun 07 '19 at 11:44
  • Oh, I see! Thanks :) – Satyajeet Khare Jun 07 '19 at 11:56
0

In my case I was getting ld : error : myfile: file too short, or sometimes:

ld: warning: myfile has a section extending past end of file
ld : error : myfile: ELF section name out of range

because I was patching for Nix a folder containing both source code and binary blob… and since the number of files to patch was high I used a script to patch them all at the same time (using find and sed -i). Unfortunately, sed was also applied on binary files, which completely corrupted them.

I realized that by printing objdump -a myfile before and after the patching (I would get an error in the second case).

tobiasBora
  • 3,376
  • 2
  • 23
  • 34