error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
Background: I was connected to the server via SSH, as a standard user. I switched via su to root to do some portage updates and depclean. There was a problem setting the new GCC version during install and because of a deleted old GCC version the paths were not correct anymore. The new GCC library was there but the path in env.d were wrong (pointing to the old deletes version)After a connection lost with SSH I lost my root shell from above and no more SSH connections were accepted. Luckily there was another standard user SSH connection opened. There I tried to switch to root again to set the correct paths (use gcc-config to set). But the mentioned error disallowed any "su" or "sudo" action.
I tried also to login using another shell, but at this moment I remembered only bash was available on this system and did not find anything suitable (searching for "sh" and "shell" only in my bin directory). I did not remember busybox which finally helped me to solve the error without restarting or connecting a monitor and keyboard to the server by setting the LD_LIBRARY_PATH and ran gcc-config:
/home/pjsb $ su -m -s /bin/bb root
Passwort:
/home/pjsb $ whoami
root
/home/pjsb $ gcc-config -l
/bin/bash: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
# setting the LD_LIBRARY_PATH did the final magic!!
/home/pjsb $ export LD_LIBRARY_PATH=/usr/lib/gcc/armv6j-hardfloat-linux-gnueabi/4.8.3/
/home/pjsb $ gcc-config -l
* gcc-config: Active gcc profile is invalid!
[1] armv6j-hardfloat-linux-gnueabi-4.8.3
/home/pjsb $ gcc-config 1
* Switching native-compiler to armv6j-hardfloat-linux-gnueabi-4.8.3 ...
>>> Regenerating /etc/ld.so.cache... [ ok ]
* If you intend to use the gcc from the new profile in an already
* running shell, please remember to do:
* . /etc/profile
/home/pjsb $ . /etc/profile
Some inspirations and more background can be found at https://forums.gentoo.org/viewtopic-p-7639042.html
No comments:
Post a Comment