2

Accidentally executed this command and now many of my programs are not working.

sudo apt-get --purge remove libstdc++6

sudo apt now not working and some other stuff.

How do I revert this?

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

edit

I followed melebius by installing via dpkg -i ,libstdc++6 and it seems successful

root@server:~# sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb
Selecting previously unselected package libstdc++6:amd64.
(Reading database ... 71540 files and directories currently installed.)
Preparing to unpack libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libstdc++6:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

But when i tried to install something i get this error

root@server:~# sudo apt-get screen
apt-get: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory
root@server:~#
kalkun
  • 21
  • does firefox can work without libstdc++6? if it can, just download the package and reinstall it with dpkg (or get the package from another computer, transfer it with an USB driver) – damadam Jul 18 '18 at 13:09
  • i cant do any apt root@:~# sudo apt-get update sudo: apt-get: command not found – kalkun Jul 18 '18 at 13:11
  • dpkg != apt, see the answer of @Melebius just bellow – damadam Jul 18 '18 at 13:12

2 Answers2

1

According to the packages web page, dpkg should be able to work without libstdc++6 (unlike apt).

So you should be able to download the correct version libstdc++6 for your architecture manually and install it using dpkg -i, e.g.

sudo dpkg -i libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb

In the case you cannot use your normal web browser on the machine in question, get the right URL elsewhere and download the file using wget, e.g.

wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb

According to the following error:

apt-get: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory

you seem to have more missing required packages.

Check which package provides the file, download it and (re)install using dpkg like before. For liblz4.so.1, you need liblz4-1. Repeat this procedure with each file while APT complains about missing files.


One more thing… Your command invocation

root@server:~# sudo apt-get screen

indicates you are both logged in as root and using sudo. These two things are redundant, you need just one of them at a time.

Melebius
  • 11,431
  • 9
  • 52
  • 78
  • ok..sorry for that melebius ,i'll fix the formating – kalkun Jul 18 '18 at 13:38
  • i remember during executing the command (libstdc++6) ,there's confirmation dialog and i have to re enter confirmation word ..after that my perl,python script not working,apt get also not working. i dunno maybe during that confirmation, all the shared libraries also being removed ,even after i managed to install apt ,im end up with new problem (No sandbox user '_apt' on the system)..this is to much for new ubuntu user like my self ,so i end up asking server provider to reload my os ..but thanks melebius for your help – kalkun Jul 21 '18 at 06:26
0

I did the same mistake by deleting the libstdc++6, most programs were not working, apt-get as well. But I managed to restore the initial state by using.

sudo apt --fix-broken install