d-i_internals

Upload: mohamad-amin-rastgoo

Post on 07-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 d-i_internals

    1/45

    debian-installer internals

    Frans Pop

    March 4, 2006

    This talk is licensed under the terms of the GNU General Public License.c 2004 Gaudenz Steinlin / 2006 Frans Pop

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    2/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Outline

    Past, Present and Future - a short introduction

    Walkthrough the installation process

    D-I key components

    Interesting udebs

    Discussion

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    3/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    The present (2004)

    d-i is nearly release quality (rc1 underway)

    Porting to most architectures almost done Bug squashing and fine tuning for release

    No big changes anymore before releasing Sarge

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    4/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    The future (now)

    Well done graphical front-end

    Custom installers made easy

    Automated or unattended installs

    Install without reboot?

    ...

    (The modular design makes additions easy)

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    5/45

  • 8/6/2019 d-i_internals

    6/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 0: bootingGoal: Get the installer running

    Standard path:1. Booting of the computer by the BIOS,

    OpenFirmware, ...

    2. Loading of the boot-loader from CD-ROM

    3. Loading of the kernel and initial ramdisk

    4. Starting the kernel

    Additional paths:

    Booting from another OS (loadlin, BootX)

    Network Boot (PXE, TFTP, ...)

    Loading of kernel and initial ramdisk from floppy

    Booting from USB memory stick

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    7/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 0: bootingGoal: Get the installer running

    Standard path:1. Booting of the computer by the BIOS,

    OpenFirmware, ...

    2. Loading of the boot-loader from CD-ROM

    3. Loading of the kernel and initial ramdisk

    4. Starting the kernel

    Additional paths:

    Booting from another OS (loadlin, BootX)

    Network Boot (PXE, TFTP, ...)

    Loading of kernel and initial ramdisk from floppy

    Booting from USB memory stick

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    8/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 1: initial ramdiskGoal: setup access to additional components

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    9/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 1: initial ramdiskGoal: setup access to additional components

    1. Setup shm filesystem, copy initrd content andpivot root into it

    2. Choose installation language, country and keyboard

    3. First hardware detection4. Different paths depending on installation medium

    Network configuration on netboot and floppy installs CD drive detection on CD-ROM installs Detection of other medias containing installer

    components5. Load additional installer components (from cdrom,

    network or iso-image)

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    10/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 1: initial ramdiskGoal: setup access to additional components

    1. Setup shm filesystem, copy initrd content andpivot root into it

    2. Choose installation language, country and keyboard

    3. First hardware detection4. Different paths depending on installation medium

    Network configuration on netboot and floppy installs CD drive detection on CD-ROM installs Detection of other medias containing installer

    components5. Load additional installer components (from cdrom,

    network or iso-image)

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    11/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 1: initial ramdiskGoal: setup access to additional components

    1. Setup shm filesystem, copy initrd content andpivot root into it

    2. Choose installation language, country and keyboard

    3. First hardware detection4. Different paths depending on installation medium

    Network configuration on netboot and floppy installs CD drive detection on CD-ROM installs Detection of other medias containing installer

    components5. Load additional installer components (from cdrom,

    network or iso-image)

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    12/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 1: initial ramdiskGoal: setup access to additional components

    1. Setup shm filesystem, copy initrd content andpivot root into it

    2. Choose installation language, country and keyboard

    3. First hardware detection4. Different paths depending on installation medium

    Network configuration on netboot and floppy installs CD drive detection on CD-ROM installs Detection of other medias containing installer

    components5. Load additional installer components (from cdrom,

    network or iso-image)

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    13/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 1: initial ramdiskGoal: setup access to additional components

    1. Setup shm filesystem, copy initrd content andpivot root into it

    2. Choose installation language, country and keyboard

    3. First hardware detection4. Different paths depending on installation medium

    Network configuration on netboot and floppy installs CD drive detection on CD-ROM installs Detection of other medias containing installer

    components5. Load additional installer components (from cdrom,

    network or iso-image)

    S

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    14/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    S 2 f l di ddi i l

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    15/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d i i lS 2 f l di ddi i l

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    16/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d i i t lSt 2 ft l di dditi l t

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    17/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d i internalsSt 2 ft l di dditi l t

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    18/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d i internalsSt 2 ft l di dditi l ts

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    19/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d-i internalsStage 2: after loading additional components

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    20/45

    d-i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d-i internalsStage 2: after loading additional components

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    21/45

    d i internals

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Stage 2: after loading additional componentsGoal: Install the base-system and make it bootable

    1. Partition disks and assign mount points

    2. Set up clock (UTC/local), timezone, root password,user

    3. Install base system (from cdrom, network oriso-image)

    4. Install a few additional packages and kernel

    5. Configure apt for target system and install tasks

    6. Install boot loader

    7. Reboot into installed system

    d-i internalsSummary: advantages and features of d i

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    22/45

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Summary: advantages and features of d-i

    Advantages

    Easy default installs Wizard style guided installation Reasonable default options Minimum of questions asked

    Possibility of expert installs for fine tuning Modular design makes additions easy

    Normal Linux system, but

    Very specific purpose Mainly running only one program

    Root filesystem in a RAM disk

    Configured to run on almost any hardware

    d-i internalsSummary: advantages and features of d i

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    23/45

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    Summary: advantages and features of d-i

    Advantages

    Easy default installs Wizard style guided installation Reasonable default options Minimum of questions asked

    Possibility of expert installs for fine tuning Modular design makes additions easy

    Normal Linux system, but

    Very specific purpose Mainly running only one program

    Root filesystem in a RAM disk

    Configured to run on almost any hardware

    d-i internalsudebs - installer components

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    24/45

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    udebs - installer components

    Minimal Debian packages: udebs

    Normal Debian packages (technically) Not policy compliant

    No documentation and copyright files File ending .udeb Reduced to minimal size

    d-i internalsudebs - installer components

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    25/45

    F. Pop

    Outline

    Past, Present and

    Future

    Walkthrough

    Key components

    udebs

    Discussion

    udebs installer components

    Types of udebs

    Perform an installation step Provide a menu item (Choose language, Install the

    base system, ...) Postinst script to perform actions

    Contain support files Kernel modules Programs (discover, busybox, ...)

    Libraries (full libc, libparted, ...)Companion: udpkg - a stripped down dpkg

    d-i internalscdebconf - user input

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    26/45

    F. Pop

    Outline

    Past, Present and

    FutureWalkthrough

    Key components

    udebs

    Discussion

    cdebconf user input

    Debconf All user input uses debconf

    Reimplementation of debconf in C Separation of protocol, storage back-end and

    front-end Preseeding the debconf database for automated

    installs Different front-ends for different purposes

    Standard debconf tools can be used for i18n New developments

    Plug-ins Pass through

    d-i internalscdebconf - user input

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    27/45

    F. Pop

    Outline

    Past, Present and

    FutureWalkthrough

    Key components

    udebs

    Discussion

    cdebconf user input

    Priority

    Each question has its priority (low, medium, high orcritical)

    D-I runs at a given priority (normally at high) Questions below the current priority are not shown

    (default answer)

    The priority is dynamically lowered on error (andraised on subsequent success)

    Priority critical mainly used in combination withpreseeding

    d-i internalscdebconf - user input

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    28/45

    F. Pop

    Outline

    Past, Present and

    FutureWalkthrough

    Key components

    udebs

    Discussion

    cdebconf user input

    Front-ends

    Standard newt front-end

    Text front-end

    Graphical GTK front-end (new for Etch)

    ...

    d-i internalsmain-menu - Choosing the Next Step

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    29/45

    F. Pop

    Outline

    Past, Present and

    FutureWalkthrough

    Key components

    udebs

    Discussion

    C g S p

    Main-menu after booting the installer

    d-i internalsmain-menu - Choosing the Next Step

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    30/45

    F. Pop

    Outline

    Past, Present and

    FutureWalkthrough

    Key components

    udebs

    Discussion

    g p

    Full main-menu after loading of additional components

    d-i internalsmain-menu - Choosing the Next Step

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    31/45

    F. Pop

    Outline

    Past, Present and

    FutureWalkthrough

    Key components

    udebs

    Discussion

    g p

    Central component controlling the installationprocess

    A debconf select question

    Not shown in default installs More than a menu

    Dynamically adds items as new udebs are installed Chooses next action based on menu item number,

    provides and dependencies Calls udpkg to run postinst scripts

    d-i internalsShell and C Code only

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    32/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    y

    Space is very limited

    No PERL, no Python, no ... (insert your favouritescripting language)

    d-i should fit on 2 floppies (kernel and initrd)

    d-i should be able to install with minimal RAM

    (currently approx. 32MB)

    Programs either in C or shell (busybox)

    Shell prefered: easier to debug (set -x) and maintain

    Shell prefered: live changes possible

    Only stripped down tools from busybox

    nano: editor (and pager)

    C where shell is not feasible (anna, kbd-chooser, ...)

    d-i internalsShell and C Code only

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    33/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    y

    Space is very limited

    No PERL, no Python, no ... (insert your favouritescripting language)

    d-i should fit on 2 floppies (kernel and initrd)

    d-i should be able to install with minimal RAM

    (currently approx. 32MB)

    Programs either in C or shell (busybox)

    Shell prefered: easier to debug (set -x) and maintain

    Shell prefered: live changes possible

    Only stripped down tools from busybox

    nano: editor (and pager)

    C where shell is not feasible (anna, kbd-chooser, ...)

    d-i internalslocale-/kbd-chooser

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    34/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    /Packages: localechooser, kbd-chooser

    localechooser lists all available translations

    localechooser is the first screen shown on ordinaryd-i installs

    Everything shown after this should continue localized Language choice affects defaults for country and

    keyboard selection

    Which languages are available depends on frontend

    Language and country together determine defaultlocale (UTF-8)

    d-i internalsHardware detection(

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    35/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: udev, discover1, ddetect (ethdetect, hw-detect,hw-detect-full)

    Hardware detection For 2.4 based installs: discover

    For 2.6 based installs: udev

    d-i internalsanna and retrieversP k { d fl } i

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    36/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: anna, {net,cdrom,floppy}-retriever

    annas not nearly apt, but for Debian installer, it will do

    d-i internalsanna and retrieversP k { d fl } i

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    37/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: anna, {net,cdrom,floppy}-retriever

    system to download/install additional components installs all udebs with priority standard or higher

    resolves dependencies

    changes to the list of selected udebs are possible at

    debconf priority smaller than medium

    udebs are downloaded/installed by retrievers

    net-retriever to download from a Debian mirror

    cdrom-retriever to install from a mounted CD-ROM(or loop mounted iso-image)

    floppy-retriever to install some udebs from floppyand rerun anna afterwards

    d-i internals

    F P

    anna and retrieversP k { t d fl } t i

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    38/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: anna, {net,cdrom,floppy}-retriever

    system to download/install additional components installs all udebs with priority standard or higher

    resolves dependencies

    changes to the list of selected udebs are possible at

    debconf priority smaller than medium

    udebs are downloaded/installed by retrievers

    net-retriever to download from a Debian mirror

    cdrom-retriever to install from a mounted CD-ROM(or loop mounted iso-image)

    floppy-retriever to install some udebs from floppyand rerun anna afterwards

    d-i internals

    F P

    partman - partitioning and mount pointsPackages: partman * mdcfg lvmcfg

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    39/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: partman-*, mdcfg, lvmcfg

    Partmans main screen

    d-i internals

    F Pop

    partman - partitioning and mount pointsPackages: partman * mdcfg lvmcfg

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    40/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: partman-*, mdcfg, lvmcfg

    Features

    Multiple filesystem support: ext2/3 reiserfs jfs xfs

    Based on libparted

    Support for LVM and software RAID

    Automatic and manual partitioning New: automatic partitioning using LVM

    d-i internals

    F Pop

    partman - partitioning and mount pointsPackages: partman * mdcfg lvmcfg

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    41/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: partman- , mdcfg, lvmcfg

    Split into several small udebs:

    One for each supported filesystem

    Simple to add support for new filesystems

    Additional udebs for architecture support Any addition can be implemented in its own udeb

    Client/Server architecture

    Server written in C performs actions using libparted Clients written in Shell send commands over FIFOs

    Partman would be a topic for a talk on its own.

    d-i internals

    F Pop

    partman - partitioning and mount pointsPackages: partman-* mdcfg lvmcfg

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    42/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: partman- , mdcfg, lvmcfg

    Split into several small udebs:

    One for each supported filesystem

    Simple to add support for new filesystems

    Additional udebs for architecture support Any addition can be implemented in its own udeb

    Client/Server architecture

    Server written in C performs actions using libparted Clients written in Shell send commands over FIFOs

    Partman would be a topic for a talk on its own.

    d-i internals

    F. Pop

    Boot Loader InstallersPackages: {aboot, delo, grub, lilo, palo, yaboot, ...}-installer,

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    43/45

    F. Pop

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: {aboot, delo, grub, lilo, palo, yaboot, ...} installer,os-prober, nobootloader

    grub-installer asking where to install grub

    d-i internals

    F. Pop

    Boot Loader InstallersPackages: {aboot, delo, grub, lilo, palo, yaboot, ...}-installer,

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    44/45

    p

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Packages: {aboot, delo, grub, lilo, palo, yaboot, ...} installer,os-prober, nobootloader

    Separate small udebs to install the boot loader

    Grub currently default on i386 Special os-prober udeb to detect other operating

    systems and to offer multiboot

    nobootloader udeb to skip bootloader installation onsystems that dont need a boot loader

    d-i internals

    F. Pop

    Discussion

    http://find/http://goback/
  • 8/6/2019 d-i_internals

    45/45

    p

    Outline

    Past, Present andFuture

    Walkthrough

    Key components

    udebs

    Discussion

    Its your turn now!

    http://find/http://goback/