So as not to obscure the problem with output,

  1. I was trying prompted to run autoremove
  2. I ran it.
  3. It segfaulted.
  4. After which, nothing shows to be autoremove-able.
  5. Things are still present which were on the autoremove list?

I'd like to retry autoremove again.

# sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  amd64-microcode aspnetcore-store-2.0.0 dotnet-host dotnet-hostfxr-2.0.0 dotnet-runtime-deps-2.1.0-preview2-26406-04 gcc-7-base:i386 gfortran-mingw-w64
  gfortran-mingw-w64-i686 gfortran-mingw-w64-x86-64 gnat-mingw-w64 gnat-mingw-w64-base gnat-mingw-w64-i686 gnat-mingw-w64-x86-64 gnome-icon-theme-symbolic gnome-orca
  gnupg-agent gsettings-ubuntu-schemas gvfs-bin indicator-sound intel-microcode iucode-tool libapparmor-perl libarmadillo7 libbabeltrace-ctf1 libbind9-140
  libboost-date-time1.62.0 libboost-filesystem1.62.0 libboost-filesystem1.62.0:i386 libboost-filesystem1.65.1:i386 libboost-iostreams1.62.0 libboost-system1.62.0
  libboost-system1.62.0:i386 libboost-system1.65.1:i386 libboost-thread1.62.0 libc++1 libc++abi1 libcapnp-0.5.3 libcapnp-0.5.3:i386 libcapnp-0.6.1 libcapnp-0.6.1:i386
  libcdio-cdda1 libcdio-paranoia1 libcdio13 libcommons-codec-java libcryptsetup4 libdfu1 libdns-export162 libdns162 libegl1-mesa:i386 libfreerdp-cache1.1
  libfreerdp-client1.1 libfreerdp-codec1.1 libfreerdp-common1.1.0 libfreerdp-core1.1 libfreerdp-crypto1.1 libfreerdp-gdi1.1 libfreerdp-locale1.1
  libfreerdp-plugins-standard libfreerdp-primitives1.1 libfreerdp-utils1.1 libfwupd1 libgcr-3-common libgeos-3.5.1 libgnome-desktop-3-12 libgnome-games-support-1-2
  libgsoap-2.8.49 libgtk2-perl libhttpclient-java libhttpcore-java libical2 libicu57:i386 libidn11:i386 libisc-export160 libisc160 libisccc140 libisccfg140
  libiso9660-10 libiso9660-8 libjsoup-java libkeybinder0 liblivemedia58 libllvm5.0:i386 liblouis12 liblouisutdml7 liblttng-ust-ctl2 liblttng-ust-ctl4 liblttng-ust0
  liblwgeom-2.3-0 liblwres141 libmirclient9 libmirclient9:i386 libmircommon7 libmircommon7:i386 libmircore1 libmircore1:i386 libmirprotobuf3 libmirprotobuf3:i386
  libnetcdf11 libntfs-3g872 libopencv-core3.1:i386 libopencv-core3.1 libopencv-imgproc3.1:i386 libopencv-imgproc3.1 liborcus-0.12-0 libp11-kit-gnome-keyring
  libpango-perl libplexus-classworlds2-java libplexus-utils-java libpoppler68 libprotobuf-lite10:i386 libqca2-plugin-ossl libqgis-core2.14.18
  libqgis-networkanalysis2.14.18 libqgispython2.14.18 libqpdf18 libqtwebkit4 libreoffice-gtk libreoffice-gtk2 libruby2.3 libsbsms10 libsodium18 libsodium18:i386
  libsss-nss-idmap0 libsuitesparseconfig4 libtbb2 libtbb2:i386 libtinyxml2-5 libtxc-dxtn-s2tc0 libtxc-dxtn-s2tc0:i386 libunistring0 liburcu6 libva-wayland1
  libvcdinfo0 libvpx4 libvpx4:i386 libwagon2-java libwinpr-crt0.1 libwinpr-dsparse0.1 libwinpr-environment0.1 libwinpr-file0.1 libwinpr-handle0.1 libwinpr-heap0.1
  libwinpr-input0.1 libwinpr-interlocked0.1 libwinpr-library0.1 libwinpr-path0.1 libwinpr-pool0.1 libwinpr-registry0.1 libwinpr-rpc0.1 libwinpr-sspi0.1
  libwinpr-synch0.1 libwinpr-sysinfo0.1 libwinpr-thread0.1 libwinpr-utils0.1 libx264-148 libx264-148:i386 libx265-130:i386 libx265-130 libxerces-c3.1 libxfont1
  linux-headers-4.13.0-40 linux-headers-4.13.0-40-generic linux-image-4.13.0-40-generic linux-image-extra-4.13.0-40-generic python-beautifulsoup python-functools32
  python-imaging ruby2.3 snapd-login-service tcpd xfce4-volumed
0 upgraded, 0 newly installed, 171 to remove and 0 not upgraded.
After this operation, 1,177 MB disk space will be freed.
Do you want to continue? [Y/n] y
E: Sub-process /usr/bin/dpkg received a segmentation fault.

Nothing left to autoremove,

# sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Things are still installed (note linux-image-4.13.0-40-generic is in the list above and ii means installed)

$ dpkg -l linux-image-extra-4.13.0-40-generic
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                 Version                 Architecture           
ii  linux-image-extra-4.13.0-40-generic  4.13.0-40.45            amd64                  

They can still be manually, but I'd like to have dpkg to the same autoremove reoutine again.

# sudo apt-get --purge remove linux-image-4.13.0-40-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.13.0-40-generic* linux-image-extra-4.13.0-40-generic*
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 238 MB disk space will be freed.
Do you want to continue? [Y/n] n

Can I tell Debian to recalculate the autoremove list?

This is on a dist-upgrade from Ubuntu 17.10 to Ubuntu 18.04

  • Do you know why it dpkg segfaulted? Might want to make a proper bug report otherwise, so that it can be fixed
    – simon
    Apr 30 '18 at 17:08
  • @gurka Potentially bad memory, but I would hope that at (a) my package manager was transactional, and (b) it could recover from a crash even if it took some work on my part. Apr 30 '18 at 17:11

This looks like a bug in apt, where the /var/lib/apt/extended_states for those packages was cleared before dpkg returned success.

You can compare an old entry from /var/backups/apt.extended_states* to verify if that is actually the case.

If that's true, you can either:

  1. Run apt-mark auto linux-image-4.13.0-40-generic for the automatically installed packages which were removed
  2. Copy any entries which were removed from extended_states from the backup.

As near as I can tell, there aren't any bugs open in Debian against apt which match this issue.

  • 1
    When you say removed, you mean removed from the states but left in tact on the system, correct? Apr 30 '18 at 18:49
  • Right. My best guess is that the entry was just removed from extended_states or the whole file was truncated. For whatever reason, dpkg segfaulted before it even started removing those packages. Apr 30 '18 at 18:52
  • 1
    Bad ass. Didn't know about apt-mark this is exactly what I wanted. And, I do agree with what happening. What a nasty bug. Hope you stick around at Unix & Linux. Thanks for the tip. Apr 30 '18 at 18:54
  • 1
    I just did what you suggested so I don't think I have it any more, and I added and removed stuff since then but I don't think it'll be required. I can confirm your suspension that those entries (which I looked for before I ran apt-mark were in fact not in that file). Apr 30 '18 at 19:00
  • 1
    Wow! Excellent first answer! +1
    – Fabby
    Apr 30 '18 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.