Thanks to user lamayonnaise in this Reddit, I was able to solve the problem described below, which I encountered when upgrading a Debian GNU/Linux box from old stable (9.x, a.k.a. “stretch”) to new stable (10.0, a.k.a. “buster”). I’ve also seen this when upgrading from ‘stable’ to ‘testing’ — presumably the solution below would work there too.
Here’s what the problem looks like — full transcript, out of consideration for search engine indexes:
root# apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: guile-2.2-libs : Depends: libtinfo6 (>= 6) but it is not installed libedit2 : Depends: libtinfo6 (>= 6) but it is not installed libllvm7 : Depends: libtinfo6 (>= 6) but it is not installed libncurses6 : Depends: libtinfo6 (= 6.1+20181013-2) but it is not installed libreadline7 : Depends: libtinfo6 (>= 6) but it is not installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). root#
Hmmm, that doesn’t look good. I tried following the advice given there, but it didn’t work:
root# apt --fix-broken install 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: guile-2.2-libs libncurses6 libpython3.7-minimal libsasl2-modules libzstd1 mariadb-common python3.7-minimal Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libtinfo6 The following NEW packages will be installed: libtinfo6 0 upgraded, 1 newly installed, 0 to remove and 1326 not upgraded. 47 not fully installed or removed. Need to get 0 B/325 kB of archives. After this operation, 534 kB of additional disk space will be used. Do you want to continue? [Y/n] y apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_ALL to default locale: No such file or directory Setting up libpam0g:amd64 (1.3.1-5) ... locale: Cannot set LC_ALL to default locale: No such file or directory Checking for services that may need to be restarted...awk: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory Checking init scripts... awk: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory dpkg: error processing package libpam0g:amd64 (--configure): subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: libpam0g:amd64 E: Sub-process /usr/bin/dpkg returned an error code (1) root#
Okay, hmmm, what about trying the same but with apt-get instead of apt? Let’s see:
root# apt-get --fix-broken install 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: guile-2.2-libs libncurses6 libpython3.7-minimal libsasl2-modules libzstd1 mariadb-common python3.7-minimal Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libtinfo6 The following NEW packages will be installed: libtinfo6 0 upgraded, 1 newly installed, 0 to remove and 1326 not upgraded. 47 not fully installed or removed. Need to get 0 B/325 kB of archives. After this operation, 534 kB of additional disk space will be used. Do you want to continue? [Y/n] y apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct! perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_ALL to default locale: No such file or directory Setting up libpam0g:amd64 (1.3.1-5) ... locale: Cannot set LC_ALL to default locale: No such file or directory Checking for services that may need to be restarted...awk: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory Checking init scripts... awk: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory dpkg: error processing package libpam0g:amd64 (--configure): subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: libpam0g:amd64 E: Sub-process /usr/bin/dpkg returned an error code (1)
Nope.
All right, then. Let’s do it manually:
I’m not sure it was necessary, but at this point I ensured the locale by checking that the uncommented line “en_US.UTF-8 UTF-8” was present in /etc/locale.gen, running the command locale-gen as root, logging out and logging back in, and confirming the locale with locale -a.
Again, that locale dance may not have been necessary. What was necessary were the next steps:
Visit the Debian package pages for libtinfo6 and libpam0g, download the amd64 versions (using the sha256sum command to check the downloaded files against the SHA256 fingerprint listed at the bottoms of the Debian package pages), then install them manually:
root# dpkg -i libtinfo6_6.1+20181013-2_amd64.deb root# dpkg -i libpam0g_1.3.1-5_amd64.deb
Those commands succeeded, and I confirmed that the packages were now installed:
root# apt-get install libtinfo6 Reading package lists... Done Building dependency tree Reading state information... Done libtinfo6 is already the newest version (6.1+20181013-2). libtinfo6 set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 1325 not upgraded. root# apt-get install libpam0g Reading package lists... Done Building dependency tree Reading state information... Done libpam0g is already the newest version (1.3.1-5). 0 upgraded, 0 newly installed, 0 to remove and 1325 not upgraded. root#
Now the box was in working order again, and I could finish the dist-upgrade:
root# apt-get dist-upgrade [...zillions of lines of package names omitted...] 1325 upgraded, 390 newly installed, 19 to remove and 0 not upgraded. Need to get 41.7 MB/1,155 MB of archives. After this operation, 1,054 MB of additional disk space will be used. Do you want to continue? [Y/n] y [...zillions of lines of success omitted...]