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

Installing Debian without any Recommends, by hacking

I've already posted a couple of hacks to reduce the number of
Recommends packages that are installed by netinst, but they
weren't enough to override the main installation step, ie
"Select and install software". The extra hack reported here
appears to do just that.

The first two hacks were to /bin/apt-install:

    WITH_RECOMMENDS=1 ← change this to 0
    OPTS="$OPTS $1"

near line 20, and:

  apt_opts="-q -y"
  if [ -z "$ALLOW_REMOVE" ]; then
      apt_opts="$apt_opts --no-remove"
  if [ "$WITH_RECOMMENDS" ]; then
      apt_opts="$apt_opts -o APT::Install-Recommends=true" ← change this to false
  elif [ "$NO_RECOMMENDS" ]; then
      apt_opts="$apt_opts -o APT::Install-Recommends=false"

about 20 lines before the end.¹

/bin/apt-install is available for editing as early as before the
"Detect and mount installation media" step.

The third hack is to /target/usr/bin/tasksel, about 25 lines before
the end:

  push @cmd, qw{apt-get -q -y -o APT::Install-Recommends=true -o APT::Get::AutomaticRemove=true -o Acquire::Retries=3 install}; ← change the first true to false

This appears to build the command that installs the bulk of the
packages. The binary is available for editing immediately after
the "Install the base system" step. Note that any edits are
permanent, because you're modifying the installed copy.²

So those changes are enough to prevent any Recommends being
obeyed during, and possibly after (when using tasksel),
installation. Whether this is wise is left to the reader/sysadmin.
Hopefully, that puts this problem to bed.

(Examples are from bullseye rc2 amd64 netinst with firmware.)

¹ /bin/apt-install comes out of the installer's initrd, so I suppose
  the latter could be unpacked, modified and repacked into a rebuilt
  ISO file. Bear in mind there are three initrds for different options.

² /target/usr/bin/tasksel comes from the tasksel package, which is
  found in pool/main/t/tasksel/tasksel_…_all.deb. I would hazard
  a guess that modifying this package might not affect its
  installation (the installation medium is Trusted?), but could
  affect upgrading it, which appears to be a rare event.¹

The footnotes are aimed only at people who want to build an ISO
containing these modifications, so that they don't have to do
the editing each time they install a new system.


Reply to: