How to fix broken glibc packages

5,832

Solution 1

I fixed by downloading 2.27 version of all those packages and run dpkg on them.

I tried to install them in same order before I broke. I used dpkg on multiple deb files to prevent cyclic dependencies or something like that also. Not sure if it changes anything.

Solution 2

Apt isn't broken - it still works just fine. But you have unwisely told apt to make a Frankensystem, mixing packages from different releases of Ubuntu.

Apt won't be able to work out the now-illogical dependencies...ever. (Neither will you). Since apt cannot function, you will never get any more upgrades nor security patches until you remove the wrong-version packages.

We do not provide support for Frankensystems. By definition, they are unstable and prone to unusual and hard-to-diagnose problems. Deb-based systems are designed function with specific versions of packages. Wrong-version packages cause problems.

Remove the wrong-version packages. If you want to run 19.04 packages, then consider installing Ubuntu 19.04. Perhaps in a VM or spare partition if you wish to keep your current 18.04 system.

Share:
5,832

Related videos on Youtube

maydin
Author by

maydin

Updated on September 18, 2022

Comments

  • maydin
    maydin over 1 year

    I am using Ubuntu 18.04 and I tried to upgrade libc6 from version 2.27 to 2.29 but I ended up breaking package system. I cannot fix because when I try to use fix commands, it always shows tons of package in system will be REMOVED.

    Synaptic shows these packages as broken:

    • glibc-doc 2.27-3
    • libc-dev-bin 2.27-3
    • libc6 2.29-0
    • libc6-dbg 2.27-3
    • libc6-dev 2.27-3
    • libc6:i386 2.27-3

    How I broke? I downloaded following packages from https://packages.ubuntu.com/

    • glibc-doc_2.29-0ubuntu2_all.deb
    • glibc-source_2.29-0ubuntu2_all.deb
    • libc6_2.29-0ubuntu2_amd64.deb
    • libc6-amd64_2.29-0ubuntu2_i386.deb
    • libc-bin_2.29-0ubuntu2_amd64.deb
    • locales_2.29-0ubuntu2_all.deb

    I tried to install them via dpkg one by one but didn't work because of dependency errors, and lastly I used this command:

    sudo dpkg -i libc-bin_2.29-0ubuntu2_amd64.deb libc6_2.29-0ubuntu2_amd64.deb libc6-amd64_2.29-0ubuntu2_i386.deb 
    

    After this, I said "Yes" inside a prompt which says some programs like postgres needs to be restarted.

    Then I saw broken packages error.

    sudo apt update gives no error. When I try to fix, it shows almost everything needs to removed:

    sudo apt install -f
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Correcting dependencies... Done
    The following packages were automatically installed and are no longer required:
      alex freeglut3 freeglut3-dev happy hscolour libbsd-dev libdrm-dev libffi-dev
      libgl1-mesa-dev libgles1 libglu1-mesa-dev libglvnd-core-dev libglvnd-dev
      libgmp-dev libgmpxx4ldbl libopengl0 libtinfo-dev libx11-xcb-dev
      libx11-xcb1:i386 libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev
      libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev
      libxcb-sync-dev libxcb-xfixes0-dev libxdamage-dev libxext-dev libxfixes-dev
      libxi-dev libxmu-dev libxmu-headers libxshmfence-dev libxxf86vm-dev
      linux-headers-4.18.0-17 linux-headers-4.18.0-17-generic
      linux-image-4.18.0-17-generic linux-libc-dev linux-modules-4.18.0-17-generic
      linux-modules-extra-4.18.0-17-generic mesa-common-dev x11proto-damage-dev
      x11proto-fixes-dev x11proto-xext-dev x11proto-xf86vidmode-dev
    Use 'sudo apt autoremove' to remove them.
    The following additional packages will be installed:
      glibc-doc-reference
    The following packages will be REMOVED:
      build-essential cabal-install g++ g++-7 ghc haskell-platform libbsd0:i386
      libc-dev-bin libc6:i386 libc6-amd64:i386 libc6-dbg libc6-dev
      libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386
      libdrm-radeon1:i386 libdrm2:i386 libedit2:i386 libelf1:i386 libexpat1:i386
      libffi6:i386 libgcc1:i386 libghc-async-dev libghc-attoparsec-dev
      libghc-call-stack-dev libghc-case-insensitive-dev libghc-fgl-dev
      libghc-fixed-dev libghc-gluraw-dev libghc-glut-dev libghc-half-dev
      libghc-hashable-dev libghc-haskell-src-dev libghc-html-dev libghc-http-dev
      libghc-hunit-dev libghc-integer-logarithms-dev libghc-mtl-dev
      libghc-network-dev libghc-network-uri-dev libghc-objectname-dev
      libghc-opengl-dev libghc-openglraw-dev libghc-parallel-dev
      libghc-parsec3-dev libghc-primitive-dev libghc-quickcheck2-dev
      libghc-random-dev libghc-regex-base-dev libghc-regex-compat-dev
      libghc-regex-posix-dev libghc-scientific-dev libghc-split-dev
      libghc-statevar-dev libghc-stm-dev libghc-syb-dev libghc-text-dev
      libghc-tf-random-dev libghc-unordered-containers-dev libghc-vector-dev
      libghc-zlib-dev libgl1:i386 libgl1-mesa-dri:i386 libgl1-mesa-glx:i386
      libglapi-mesa:i386 libglvnd0:i386 libglx-mesa0:i386 libglx0:i386
      libllvm7:i386 libncurses5-dev libnvidia-compute-418:i386
      libnvidia-decode-418:i386 libnvidia-encode-418:i386 libnvidia-fbc1-418:i386
      libnvidia-gl-418:i386 libnvidia-ifr1-418:i386 libpciaccess0:i386
      libsensors4:i386 libstdc++-7-dev libstdc++6:i386 libtinfo5:i386
      libx11-6:i386 libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386
      libxcb-glx0:i386 libxcb-present0:i386 libxcb-sync1:i386 libxcb1:i386
      libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386
      libxshmfence1:i386 libxxf86vm1:i386 zlib1g:i386 zlib1g-dev
    The following NEW packages will be installed:
      glibc-doc-reference
    0 upgraded, 1 newly installed, 97 to remove and 0 not upgraded.
    6 not fully installed or removed.
    Need to get 5.483 kB of archives.
    After this operation, 1.303 MB disk space will be freed.
    Do you want to continue? [Y/n] 
    
    • maydin
      maydin almost 5 years
      I added all steps I did.
    • maydin
      maydin almost 5 years
      Because they are not in 18.04 repos, therefore I got them from 19.04 repo. Problem is everything works in my computer, real old libraries still unchanged probably, just apt has problem.
    • user535733
      user535733 almost 5 years
      Installing wrong-release packages may break your system very horribly...as you have discovered. You are fortunate that your system is still bootable. Your wisest course is to uninstall the 19.04 packages and return your system to the 18.04 packages.
    • maydin
      maydin almost 5 years
      Yes but I dont want to remove all those packages, because I know nothing is broken except apt. Even if I said yes to something, it gave error at the end.
  • maydin
    maydin almost 5 years
    Finally I fixed. I downloaded 2.27 version of same packages and run dpkg in same order as I remember. There was an error like some shared directories are different from other instances of package, I removed those directories and its done.
  • Ryan J. Yoder
    Ryan J. Yoder almost 5 years
    @maydin Consider add your solution as an answer. Although user535733 is correct that this was a bad idea, I'm sure you're not the first to do it, nor will you will you be that last. It'll be great to have a documented solution.
  • maydin
    maydin almost 5 years
    I waited a day to make sure everything okay. Now added my answer @RyanJ.Yoder
  • lelorrain
    lelorrain almost 3 years
    I just decided to switch to 20.04 LTS, rather than play with modifying deb files. Also that brought the stupid problem of .desktop files not starting from folders (corrected with DEX!)