This page documents issues with the new feature that allows using multiple CDs or DVDs during an installation. The main purpose of this page is to provide background information to users who run into the problem in the hope that that will help narrow down the real cause of the problem.

Note: on the rest of this page "CD" will be used for both CDs and DVDs.

Introduction

The Sarge version of Debian Installer (D-I) still used base-config which supported scanning of multiple CDs before installing "additional software" during the second stage of the installation of a new system (after the first reboot).

With the Etch version of the installer base-config was replaced by various different D-I components, including:

For Etch, apt-setup supported only using the installation CD. It did not support scanning additional CDs. This regression was accepted because of the general advantages of being able to do the whole installation in a consistent environment without needing to reboot.

For Lenny Beta1, apt-setup has been changed to support scanning multiple CDs. For this to be possible, changes were needed in various other D-I components, including pkgsel.

After the release of Lenny Beta1 some additional changes have been made to the way D-I uses CDs.

The main problem with supporting multiple CDs is that the installation CD is needed simultaneously in the "D-I environment" and in the "target environment", which basically means that the CD has to be mounted twice: once on /cdrom and once on /target/cdrom (which is a symlink to /target/media/cdrom0).

As a CD can only be changed (ejected) if it is not mounted anywhere, some regulation of how/when a CD is used for what was needed.


The next sections give an overview how the installer uses CDs, both now and in the past.

Note that only the use of real CDs that are accessed through either a physical or virtual (in the case of emulators) CD drive is described, and not the use of CD images (.iso files) for the hd-media installation method.

CD usage in D-I -- Etch

CD drives are detected early in the installation and if an installation CD is found, it is mounted on /cdrom.

During the installation of the base system (base-installer), the CD is first used by debootstrap using APT's file protocol (i.e: debootstrap does not actually know it's reading a CD; it just uses a directory).

After that base-installer "bind mounts" the CD in the target environment to allow additional packages to be installed. The command used is (using /dev/hdc as example for the CD drive):

mount -o bind /cdrom/ /target/cdrom/

Because the directory is bind mounted, the CD obviously cannot be unmounted and remounted by apt-cdrom in the target environment, so a trick is used to avoid that. Before apt-cdrom is actually run, the configuration of APT in /target/etc/apt/ is changed (for the duration of the installation) in such a way that apt-cdrom does not try to mount or unmount the CD. Essentially it is told to use 'true' as the mount/unmount command, which always succeeds but does nothing.

With that setup the CD can then simply be scanned by using:

chroot /target apt-cdrom add

But it should now be obvious why CD changing will not work :-)

During apt-setup the installer creates /etc/apt/sources.list from scratch, so the CD will be scanned again, but the situation does not really change.

CD usage in D-I -- Lenny Beta 1

Everything up to and including base-installer remains unchanged, but in apt-setup two different cases are distinguished:

  1. the installation CD is not part of a set
  2. the installation CD is part of a set

In the first case, nothing changes: the installer still works like it did for Etch.

In the second case, the following is done in apt-setup:

There are also changes in pkgsel and when individual packages are installed after this point. Two subcases can be distinguished:

For case 2b we need to make sure that /cdrom is not mounted in the D-I environment whenever we run apt or aptitude in the target environment because we do not know beforehand whether APT will need a package that is not on a different CD and having /cdrom mounted would prevent ejecting and changing the CD by the user when APT asks him to.

The installer checks if there are more than one CDs listed in /target/etc/apt/sources.list and if so unmounts /cdrom.

Each time after APT has been used in the target environment, the installer checks if the installation CD is in the drive. If it is not, it will ask the user to insert it. When the installation CD is detected, it is mounted on /cdrom again.

For cases 1 and 2a there will never be any need to change CDs during package installation, so if /target/etc/apt/sources.list only contains a single CD, /cdrom is not unmounted during package installation.

This is fairly complex, but it does ensure that

Issues

Before Lenny Beta1

Before Beta1 there was an issue where the CD was remounted in the D-I environment at a time it was not supposed to be mounted, which prevented changing CDs when multiple CDs were being used.

This was the problem behind 470423 and this was solved in time for the release.

With Lenny Beta1 images

The issues that have been reported after Beta1 seem to be revolve around the fact that apt-cdrom for some reason fails to recognize or mount the CD in the target environment while it is also mounted in the D-I environment.

Early during pkgsel if only the first CD (or DVD) of a set is used (i.e. if the user has answered that he does not want to scan any additional CDs (case 2a), the user would be prompted endlessly to insert CD1 even though that CD already was inserted - 474346.

Changes after the release of Lenny Beta1

Initial changes

After the release of Beta1, an attempt was made to make the handling of CDs more consistent by not using the bind mount at all. The use of the CD during debootstrap is not changed, but immediately after that, during the second part of base-installer, apt-cdrom is allowed to mount and unmount the CD as needed, including single-CD installs and installs that use the netinst CD.

The basic assumption behind this change was that mounting and unmounting the CD in the target environment should be possible regardless of whether or not the CD is also mounted in the D-I environment. It's not possible to eject a CD that's still mounted somewhere, but mounting a CD more once should not be a problem.

Issues

Unfortunately this resulted in failures for some people with daily netinst images during base-installer when the installer first tries to scan the CD after debootstrap - 475639.

Note that basically this is still the same issue as with the Lenny Beta1 images: mounting the CD in the target environment fails because it is already mounted in the D-I environment.

Further changes

After analysis of the issues it was decided to revert the changes in base-installer and go back to using a bind mount.

To avoid the issues during pkgsel with case 2a, pkgsel and apt-install have now been changed to always unmount the CD in the D-I environment, even if only a single CD was being used.

Because the now different handling of netinst CDs and full CDs could still potentially create problems, for example if a user should run apt-setup twice, apt-setup was changed to also allow apt-cdrom to manage CD mounting for netinst CDs.

Conclusion

The issues due to the implementation of support of CD changing should now be resolved, at least with the D-I Lenny Beta2 release.

The current situation is as follows:

The question is still why mounting a CD when it's already mounted elsewhere fails on some systems when it works fine on most.