[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#779960: apt-get remove doesn't respect dependencies' manual-flag



Package: apt
Version: 1.0.9.6
Severity: normal

Dear Maintainer,

   * What led up to the situation?
While trying to minimize the size of my docker image, I wanted to remove build-only dependncies while leaving runtime dependencies intact.
I first installed runtime libs, then the -dev packages.
When removing the -dev packages, I noticed that some of the packages manually installed were auto-removed, because they were found to be "unecessary".

   * What exactly did you do (or not do) that was effective (or
     ineffective)?
As a workaround, we avoid remove, and only use apt-mark auto && apt-get autoremove.

   * What was the outcome of this action?
Some  manually installed packages were automatically removed.

   * What outcome did you expect instead?
Only the packages mentioned in apt-get-remove and their automatic deps should be removed.
Any dependencies flagged as manual should remain intact.



Full reproduction: (note that libfontconfig1 is uninstalled)

#!/bin/sh
set -ex
DEBIAN_FRONTEND=noninteractive

apt-get update
apt-get --yes --no-install-recommends install libfontconfig1
apt-get --yes --no-install-recommends install libfreetype6
apt-mark showmanual | grep libfont
apt-get --yes remove libfreetype6
apt-mark showmanual | grep libfont

exit 0

cat <<DEMO
$ cat repro.sh | docker run -i debian:sid sh
+ DEBIAN_FRONTEND=noninteractive
+ apt-get update
Get:1 http://http.debian.net sid InRelease [249 kB]
Get:2 http://http.debian.net sid/main amd64 Packages [9525 kB]
Fetched 9775 kB in 7s (1288 kB/s)
Reading package lists...
+ apt-get --yes --no-install-recommends install libfontconfig1
Reading package lists...
Building dependency tree...
The following extra packages will be installed:
  fontconfig-config fonts-dejavu-core libexpat1 libfreetype6 libpng12-0 ucf
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libexpat1 libfontconfig1 libfreetype6
  libpng12-0 ucf
0 upgraded, 7 newly installed, 0 to remove and 31 not upgraded.
Need to get 2437 kB of archives.
After this operation, 5764 kB of additional disk space will be used.
Get:1 http://http.debian.net/debian/ sid/main libexpat1 amd64 2.1.0-6+b3 [80.3 kB]
Get:2 http://http.debian.net/debian/ sid/main libpng12-0 amd64 1.2.50-2+b2 [172 kB]
Get:3 http://http.debian.net/debian/ sid/main libfreetype6 amd64 2.5.2-3 [466 kB]
Get:4 http://http.debian.net/debian/ sid/main ucf all 3.0030 [69.7 kB]
Get:5 http://http.debian.net/debian/ sid/main fonts-dejavu-core all 2.34-1 [1047 kB]
Get:6 http://http.debian.net/debian/ sid/main fontconfig-config all 2.11.0-6.3 [273 kB]
Get:7 http://http.debian.net/debian/ sid/main libfontconfig1 amd64 2.11.0-6.3 [329 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 2437 kB in 1s (1269 kB/s)
Selecting previously unselected package libexpat1:amd64.
(Reading database ... 7528 files and directories currently installed.)
Preparing to unpack .../libexpat1_2.1.0-6+b3_amd64.deb ...
Unpacking libexpat1:amd64 (2.1.0-6+b3) ...
Selecting previously unselected package libpng12-0:amd64.
Preparing to unpack .../libpng12-0_1.2.50-2+b2_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.50-2+b2) ...
Selecting previously unselected package libfreetype6:amd64.
Preparing to unpack .../libfreetype6_2.5.2-3_amd64.deb ...
Unpacking libfreetype6:amd64 (2.5.2-3) ...
Selecting previously unselected package ucf.
Preparing to unpack .../archives/ucf_3.0030_all.deb ...
Moving old data out of the way
Unpacking ucf (3.0030) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../fonts-dejavu-core_2.34-1_all.deb ...
Unpacking fonts-dejavu-core (2.34-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../fontconfig-config_2.11.0-6.3_all.deb ...
Unpacking fontconfig-config (2.11.0-6.3) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../libfontconfig1_2.11.0-6.3_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.11.0-6.3) ...
Setting up libexpat1:amd64 (2.1.0-6+b3) ...
Setting up libpng12-0:amd64 (1.2.50-2+b2) ...
Setting up libfreetype6:amd64 (2.5.2-3) ...
Setting up ucf (3.0030) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.1 /usr/local/share/perl/5.20.1 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up fonts-dejavu-core (2.34-1) ...
Setting up fontconfig-config (2.11.0-6.3) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.1 /usr/local/share/perl/5.20.1 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libfontconfig1:amd64 (2.11.0-6.3) ...
Processing triggers for libc-bin (2.19-13) ...
+ apt-get --yes --no-install-recommends install libfreetype6
Reading package lists...
Building dependency tree...
Reading state information...
libfreetype6 is already the newest version.
libfreetype6 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.
+ apt-mark showmanual
+ grep libfont
libfontconfig1
+ apt-get --yes remove libfreetype6
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  fontconfig-config fonts-dejavu-core libexpat1 ucf
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libfontconfig1 libfreetype6
0 upgraded, 0 newly installed, 2 to remove and 31 not upgraded.
After this operation, 1460 kB disk space will be freed.
(Reading database ... 7696 files and directories currently installed.)
Removing libfontconfig1:amd64 (2.11.0-6.3) ...
Removing libfreetype6:amd64 (2.5.2-3) ...
Processing triggers for libc-bin (2.19-13) ...
+ apt-mark showmanual
+ grep libfont
DEMO



-- Package-specific info:

-- apt-config dump --

APT "";
APT::Architecture "amd64";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
APT::Install-Recommends "1";
APT::Install-Suggests "0";
APT::NeverAutoRemove "";
APT::NeverAutoRemove:: "^firmware-linux.*";
APT::NeverAutoRemove:: "^linux-firmware$";
APT::VersionedKernelPackages "";
APT::VersionedKernelPackages:: "linux-image";
APT::VersionedKernelPackages:: "linux-headers";
APT::VersionedKernelPackages:: "linux-image-extra";
APT::VersionedKernelPackages:: "linux-signed-image";
APT::VersionedKernelPackages:: "kfreebsd-image";
APT::VersionedKernelPackages:: "kfreebsd-headers";
APT::VersionedKernelPackages:: "gnumach-image";
APT::VersionedKernelPackages:: ".*-modules";
APT::VersionedKernelPackages:: ".*-kernel";
APT::VersionedKernelPackages:: "linux-backports-modules-.*";
APT::VersionedKernelPackages:: "linux-tools";
APT::Never-MarkAuto-Sections "";
APT::Never-MarkAuto-Sections:: "metapackages";
APT::Never-MarkAuto-Sections:: "restricted/metapackages";
APT::Never-MarkAuto-Sections:: "universe/metapackages";
APT::Never-MarkAuto-Sections:: "multiverse/metapackages";
APT::Never-MarkAuto-Sections:: "oldlibs";
APT::Never-MarkAuto-Sections:: "restricted/oldlibs";
APT::Never-MarkAuto-Sections:: "universe/oldlibs";
APT::Never-MarkAuto-Sections:: "multiverse/oldlibs";
APT::Update "";
APT::Update::Post-Invoke "";
APT::Update::Post-Invoke:: "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true";
APT::Architectures "";
APT::Architectures:: "amd64";
APT::Compressor "";
APT::Compressor::. "";
APT::Compressor::.::Name ".";
APT::Compressor::.::Extension "";
APT::Compressor::.::Binary "";
APT::Compressor::.::Cost "1";
APT::Compressor::gzip "";
APT::Compressor::gzip::Name "gzip";
APT::Compressor::gzip::Extension ".gz";
APT::Compressor::gzip::Binary "gzip";
APT::Compressor::gzip::Cost "2";
APT::Compressor::gzip::CompressArg "";
APT::Compressor::gzip::CompressArg:: "-9n";
APT::Compressor::gzip::UncompressArg "";
APT::Compressor::gzip::UncompressArg:: "-d";
APT::Compressor::bzip2 "";
APT::Compressor::bzip2::Name "bzip2";
APT::Compressor::bzip2::Extension ".bz2";
APT::Compressor::bzip2::Binary "false";
APT::Compressor::bzip2::Cost "3";
APT::Compressor::xz "";
APT::Compressor::xz::Name "xz";
APT::Compressor::xz::Extension ".xz";
APT::Compressor::xz::Binary "xz";
APT::Compressor::xz::Cost "4";
APT::Compressor::xz::CompressArg "";
APT::Compressor::xz::CompressArg:: "-6";
APT::Compressor::xz::UncompressArg "";
APT::Compressor::xz::UncompressArg:: "-d";
APT::Compressor::lzma "";
APT::Compressor::lzma::Name "lzma";
APT::Compressor::lzma::Extension ".lzma";
APT::Compressor::lzma::Binary "xz";
APT::Compressor::lzma::Cost "5";
APT::Compressor::lzma::CompressArg "";
APT::Compressor::lzma::CompressArg:: "--format=lzma";
APT::Compressor::lzma::CompressArg:: "-9";
APT::Compressor::lzma::UncompressArg "";
APT::Compressor::lzma::UncompressArg:: "--format=lzma";
APT::Compressor::lzma::UncompressArg:: "-d";
Dir "/";
Dir::State "var/lib/apt/";
Dir::State::lists "lists/";
Dir::State::cdroms "cdroms.list";
Dir::State::mirrors "mirrors/";
Dir::State::extended_states "extended_states";
Dir::State::status "/var/lib/dpkg/status";
Dir::Cache "var/cache/apt/";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "";
Dir::Cache::pkgcache "";
Dir::Etc "etc/apt/";
Dir::Etc::sourcelist "sources.list";
Dir::Etc::sourceparts "sources.list.d";
Dir::Etc::vendorlist "vendors.list";
Dir::Etc::vendorparts "vendors.list.d";
Dir::Etc::main "apt.conf";
Dir::Etc::netrc "auth.conf";
Dir::Etc::parts "apt.conf.d";
Dir::Etc::preferences "preferences";
Dir::Etc::preferencesparts "preferences.d";
Dir::Etc::trusted "trusted.gpg";
Dir::Etc::trustedparts "trusted.gpg.d";
Dir::Bin "";
Dir::Bin::methods "/usr/lib/apt/methods";
Dir::Bin::solvers "";
Dir::Bin::solvers:: "/usr/lib/apt/solvers";
Dir::Bin::dpkg "/usr/bin/dpkg";
Dir::Bin::bzip2 "/bin/bzip2";
Dir::Bin::xz "/usr/bin/xz";
Dir::Bin::lzma "/usr/bin/xz";
Dir::Media "";
Dir::Media::MountPath "/media/apt";
Dir::Log "var/log/apt";
Dir::Log::Terminal "term.log";
Dir::Log::History "history.log";
Dir::Ignore-Files-Silently "";
Dir::Ignore-Files-Silently:: "~$";
Dir::Ignore-Files-Silently:: "\.disabled$";
Dir::Ignore-Files-Silently:: "\.bak$";
Dir::Ignore-Files-Silently:: "\.dpkg-[a-z]+$";
Dir::Ignore-Files-Silently:: "\.save$";
Dir::Ignore-Files-Silently:: "\.orig$";
Dir::Ignore-Files-Silently:: "\.distUpgrade$";
Acquire "";
Acquire::cdrom "";
Acquire::cdrom::mount "/media/cdrom/";
Acquire::GzipIndexes "true";
Acquire::CompressionTypes "";
Acquire::CompressionTypes::Order "";
Acquire::CompressionTypes::Order:: "gz";
Acquire::Languages "";
Acquire::Languages:: "none";
DPkg "";
DPkg::Pre-Install-Pkgs "";
DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt || true";
DPkg::Post-Invoke "";
DPkg::Post-Invoke:: "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true";
CommandLine "";
CommandLine::AsString "apt-config dump";

-- (no /etc/apt/preferences present) --


-- /etc/apt/sources.list --

deb http://http.debian.net/debian sid main

-- System Information:
Debian Release: 8.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13.0-39-generic (SMP w/24 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages apt depends on:
ii  debian-archive-keyring  2014.3
ii  gnupg                   1.4.18-6
ii  libapt-pkg4.12          1.0.9.6
ii  libc6                   2.19-13
ii  libgcc1                 1:4.9.2-10
ii  libstdc++6              4.9.2-10

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc                      <none>
pn  aptitude | synaptic | wajig  <none>
pn  dpkg-dev                     <none>
ii  python-apt                   0.9.3.11

-- no debconf information


Reply to: