Skip to content

Instantly share code, notes, and snippets.

@bmegli
Created February 8, 2022 11:16
Show Gist options
  • Save bmegli/7d91d4401d86c40a748489d012daf73f to your computer and use it in GitHub Desktop.
Save bmegli/7d91d4401d86c40a748489d012daf73f to your computer and use it in GitHub Desktop.
Ubuntu 18.04 how to recover from libgcc_s.so.1 dissaster

Motivation

When:

  • using newer compilers from Ubuntu test ppa (e.g. ppa:ubuntu-toolchain-r/test)
  • ppa-purge later to revert the system to clean state

it is possible to get to dissastrous state where libgcc_s.so.1 is misssing.

In such state apt and other applications may not work and system will not boot.

Workaround

Boot to recovery terminal.

Locate ligcc_so.so.1 on your system (if you are lucky):

find / -name libgcc_s.so.1 2>/dev/null

Copy it (or link) to location where it is expected

cp your_path /lib/x86_64-linux-gnu/libgcc_s.so.1

After that your system should boot and apt should work.

Alternatively:

  • copy from other machine
  • check /var/cache/apt/archives, you may still have deb package to install it from

Cleanup

On a clean Ubuntu 18.04 machine it is possible to check where file comes from:

# on clean Ubuntu 18.04 machine
dpkg -S /lib/x86_64-linux-gnu/libgcc_s.so.1
# in my case:
# libgcc1:amd64: /lib/x86_64-linux-gnu/libgcc_s.so.1

Reinstall this package on your now working machine:

 sudo apt-get --reinstall install libgcc1:amd64

This step is important if you do some deb packaging on your system. (you need sound apt state, able to track dependencies correctly)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment