Debian Guest Installation Using Debian Installer: Difference between revisions
(Add warning about xm-debian.cfg and link to xl.cfg(5)) |
|||
(7 intermediate revisions by 5 users not shown) | |||
Line 5: | Line 5: | ||
The main benefit of using Debian Installer to install a Xen guest is that you are able to use all the technologies (like pre-seeding) which you are used to using on a native system. You also end up with an installed system which is as similar as possible to a native Debian system installed via the same mechanisms. Installing a Xen guest Debian Installer produces a fully configured Debian system without the need to setup things such as ''/etc/fstab'' by hand. |
The main benefit of using Debian Installer to install a Xen guest is that you are able to use all the technologies (like pre-seeding) which you are used to using on a native system. You also end up with an installed system which is as similar as possible to a native Debian system installed via the same mechanisms. Installing a Xen guest Debian Installer produces a fully configured Debian system without the need to setup things such as ''/etc/fstab'' by hand. |
||
There is an [https://bugzilla.kernel.org/show_bug.cgi?id=207695 unpatched bug in the Linux kernel] that causes the Bullseye (Debian 11.x) Debian Installer to crash when trying to install Debian 11.x in a Xen HVM DomU using official Debian installation media such as the debian-11.x.0-amd64-netinst.iso that can be downloaded [https://cdimage.debian.org/cdimage/release/current/amd64/iso-cd/ here]. Workarounds are available to build an unofficial iso image that can be used to prevent the crash from occurring, as discussed in [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983357#31 this Debian bug report] and on the [https://lists.debian.org/debian-user/2021/08/msg01339.html debian-user] mailing list. |
|||
<div id="netboot"> |
|||
{{Anchor|netboot}} |
|||
==Netboot installation== |
==Netboot installation== |
||
</div> |
|||
A netboot installation is a quick and easy way to install Debian. You start by downloading a small (approximately 20MB) installer kernel and initrd which you boot as a PV guest. After this Debian Installer will take over and you can install the guest direct from the network. If you are only installing a single guest this has the advantage of only downloading exactly what is needed for the installation. If you are installing lots of guests then you may find it beneficial to create a local mirror (which will require a large initial bandwidth investment) or install a caching proxy such as [http://packages.debian.org/search?keywords=apt-cacher apt-cacher] to reduce the number of external downloads. |
A netboot installation is a quick and easy way to install Debian. You start by downloading a small (approximately 20MB) installer kernel and initrd which you boot as a PV guest. After this Debian Installer will take over and you can install the guest direct from the network. If you are only installing a single guest this has the advantage of only downloading exactly what is needed for the installation. If you are installing lots of guests then you may find it beneficial to create a local mirror (which will require a large initial bandwidth investment) or install a caching proxy such as [http://packages.debian.org/search?keywords=apt-cacher apt-cacher] to reduce the number of external downloads. |
||
{{Anchor|netboot_mirror}} |
|||
===Select A Mirror=== |
===Select A Mirror=== |
||
</div> |
|||
If you are not using your own mirror or a tool such as apt-cacher then you will need to choose a nearby mirror from Debian's [http://www.debian.org/mirror/list list of worldwide mirrors]. In general you should select the mirror which is nearest to you. Alternatively you can simply use the (unofficial) [http://cdn.debian.net http://cdn.debian.net] service to automatically select a nearby mirror. |
If you are not using your own mirror or a tool such as apt-cacher then you will need to choose a nearby mirror from Debian's [http://www.debian.org/mirror/list list of worldwide mirrors]. In general you should select the mirror which is nearest to you. Alternatively you can simply use the (unofficial) [http://cdn.debian.net http://cdn.debian.net] service to automatically select a nearby mirror. |
||
Line 23: | Line 24: | ||
Once you have selected a mirror then you can download the Debian Installer kernel and initrd. You only need to do this once since you can reuse the same images multiple times. |
Once you have selected a mirror then you can download the Debian Installer kernel and initrd. You only need to do this once since you can reuse the same images multiple times. |
||
Download both ''vmlinuz'' and ''initrd.img'' from [http://cdn.debian.net/debian/dists/squeeze/main/installer-amd64/current/images/netboot/xen/ here (amd64)] or [http://cdn.debian.net/debian/dists/squeeze/main/installer- |
Download both ''vmlinuz'' and ''initrd.img'' from [http://cdn.debian.net/debian/dists/squeeze/main/installer-amd64/current/images/netboot/xen/ here (amd64)] or [http://cdn.debian.net/debian/dists/squeeze/main/installer-i386/current/images/netboot/xen/ here (i386)] and save them to your Xen system. This guide assumes you have put them in ''/scratch/debian/squeeze/amd64'' and ''/scratch/debian/squeeze/i386'' respectively. |
||
These instructions assume you are installing Debian Squeeze. However you can modify the URLs to point to any release from Lenny onwards. |
These instructions assume you are installing Debian Squeeze. However you can modify the URLs to point to any release from Lenny onwards. |
||
{{Anchor|netboot_create_cfg}} |
|||
===Create Initial Guest Configuration=== |
===Create Initial Guest Configuration=== |
||
</div> |
|||
{{Info|Some versions of Debian shipped an example ''xm-debian.cfg'' file which included Python code to automate some parts of the installer. This was always unreliable with the xend toolstack and no longer works with the [[XL]] toolstack. It is strongly recommended not to use this |
{{Info|Some versions of Debian shipped an example ''xm-debian.cfg'' file which included Python code to automate some parts of the installer. This was always unreliable with the xend toolstack and no longer works with the [[XL]] toolstack. It is strongly recommended not to use this example configuration as a basis for any new installation. Newer versions of Debian ship an example ''debian.cfg'' which does not contain Python code but which serves as a useful starting point}} |
||
For the initial boot you should configure the guest to use the ''vmlinux'' and ''initrd.gz'' which you downloaded above and with a command line suitable for using the installer. e.g. |
For the initial boot you should configure the guest to use the ''vmlinux'' and ''initrd.gz'' which you downloaded above and with a command line suitable for using the installer. e.g. |
||
Line 60: | Line 61: | ||
See [[Xen Man Pages]], in particular the [http://xenbits.xen.org/docs/unstable/man/xl.cfg.5.html ''xl.cfg(5)''] manpage, for more details of the guest configuration syntax. |
See [[Xen Man Pages]], in particular the [http://xenbits.xen.org/docs/unstable/man/xl.cfg.5.html ''xl.cfg(5)''] manpage, for more details of the guest configuration syntax. |
||
{{Anchor|netboot_install}} |
|||
===Install Debian=== |
===Install Debian=== |
||
Line 118: | Line 120: | ||
One option for booting these is to extract them from the ISO image, store them in your domain 0 filesystem and refer to them with ''kernel'' and ''ramdisk'' directives in your guest configuration file, much like the [[#netboot_create_cfg|netboot case]]. |
One option for booting these is to extract them from the ISO image, store them in your domain 0 filesystem and refer to them with ''kernel'' and ''ramdisk'' directives in your guest configuration file, much like the [[#netboot_create_cfg|netboot case]]. |
||
However it may be more convenient to use the ''pygrub'' tool to extract the correct kernel from the image. To do this first ensure that the PV CDROM device is the first device in the guest configuration ''disk'' directive and then specify ''pygrub'' as the bootloader giving the path to the kernel and ramdisk as bootloader arguments |
However it may be more convenient to use the ''pygrub'' tool to extract the correct kernel from the image. To do this first ensure that the PV CDROM device is the first device in the guest configuration ''disk'' directive and then specify ''pygrub'' as the bootloader giving the path to the kernel and ramdisk as bootloader arguments via the ''bootloader_args'' configuration file option. {{Warning|xm/xend uses "bootargs" rather than "bootloader_args"}} |
||
e.g. for a 32 bit guest: |
|||
bootloader = "pygrub" |
bootloader = "pygrub" |
||
bootloader_args = "--kernel=/install.386/xen/vmlinuz --ramdisk=/install.386/xen/initrd.gz" |
bootloader_args = "--kernel=/install.386/xen/vmlinuz --ramdisk=/install.386/xen/initrd.gz" |
||
or for a 64 bit guest: |
or for a 64 bit guest: |
||
bootloader = "pygrub" |
bootloader = "pygrub" |
||
bootloader_args = "--kernel=/install. |
bootloader_args = "--kernel=/install.amd/xen/vmlinuz --ramdisk=/install.amd/xen/initrd.gz" |
||
As with the netboot install you should specify suitable command line options. e.g.: |
As with the netboot install you should specify suitable command line options. e.g.: |
||
Line 191: | Line 194: | ||
[[Category:Guest Install]] |
[[Category:Guest Install]] |
||
[[Category:Users]] |
[[Category:Users]] |
||
[[Category:Debian]] |
Latest revision as of 19:00, 9 February 2022
Debian Installer
Debian Installer is the standard installer used to install Debian on native systems. Debian Installer has supported netboot installation of Xen as a PV guests (both i386 and amd64) since Lenny (Debian 5.0) was released and has supported CD-ROM (and DVD, Blu-Ray etc) installations since Squeeze (Debian 6.0).
The main benefit of using Debian Installer to install a Xen guest is that you are able to use all the technologies (like pre-seeding) which you are used to using on a native system. You also end up with an installed system which is as similar as possible to a native Debian system installed via the same mechanisms. Installing a Xen guest Debian Installer produces a fully configured Debian system without the need to setup things such as /etc/fstab by hand.
There is an unpatched bug in the Linux kernel that causes the Bullseye (Debian 11.x) Debian Installer to crash when trying to install Debian 11.x in a Xen HVM DomU using official Debian installation media such as the debian-11.x.0-amd64-netinst.iso that can be downloaded here. Workarounds are available to build an unofficial iso image that can be used to prevent the crash from occurring, as discussed in this Debian bug report and on the debian-user mailing list.
Netboot installation
A netboot installation is a quick and easy way to install Debian. You start by downloading a small (approximately 20MB) installer kernel and initrd which you boot as a PV guest. After this Debian Installer will take over and you can install the guest direct from the network. If you are only installing a single guest this has the advantage of only downloading exactly what is needed for the installation. If you are installing lots of guests then you may find it beneficial to create a local mirror (which will require a large initial bandwidth investment) or install a caching proxy such as apt-cacher to reduce the number of external downloads.
Select A Mirror
If you are not using your own mirror or a tool such as apt-cacher then you will need to choose a nearby mirror from Debian's list of worldwide mirrors. In general you should select the mirror which is nearest to you. Alternatively you can simply use the (unofficial) http://cdn.debian.net service to automatically select a nearby mirror.
The following instructions assume that you are using http://cdn.debian.net, substitute the mirror which you have selected or the name of your apt-cacher/mirror machine as appropriate.
Download Debian Installer Images
Once you have selected a mirror then you can download the Debian Installer kernel and initrd. You only need to do this once since you can reuse the same images multiple times.
Download both vmlinuz and initrd.img from here (amd64) or here (i386) and save them to your Xen system. This guide assumes you have put them in /scratch/debian/squeeze/amd64 and /scratch/debian/squeeze/i386 respectively.
These instructions assume you are installing Debian Squeeze. However you can modify the URLs to point to any release from Lenny onwards.
Create Initial Guest Configuration
Some versions of Debian shipped an example xm-debian.cfg file which included Python code to automate some parts of the installer. This was always unreliable with the xend toolstack and no longer works with the XL toolstack. It is strongly recommended not to use this example configuration as a basis for any new installation. Newer versions of Debian ship an example debian.cfg which does not contain Python code but which serves as a useful starting point |
For the initial boot you should configure the guest to use the vmlinux and initrd.gz which you downloaded above and with a command line suitable for using the installer. e.g.
kernel = "/scratch/debian/squeeze/amd64/vmlinuz" ramdisk = "/scratch/debian/squeeze/amd64/initrd.gz" extra = "debian-installer/exit/always_halt=true -- console=hvc0"
The rest of the guest configuration is down to you and your requirements for the guest you are installing. You would normally want to configure a disk and network device as normal. A network device with external connectivity (or connectivity to your local mirror/cache) is required for the duration of the installation process.
In order to use Debian Installer it is necessary to use the whole disk disk configuration rather than the partitions. In other words you must configure an xvda device and not xvda1, xvda2 etc. For example a complete (if rather minimal) installation time configuration might be:
name = "debian-installer" memory = 256 disk = ['phy:/dev/VG/debian-installer,xvda,w'] vif = [' '] kernel = "/scratch/debian/squeeze/amd64/vmlinuz" ramdisk = "/scratch/debian/squeeze/amd64/initrd.gz" extra = "debian-installer/exit/always_halt=true -- console=hvc0"
At this point you should create the backing storage for the disk configuration you are using. e.g. in this case:
# lvcreate -L 4G -n debian-installer /dev/VG
See Xen Man Pages, in particular the xl.cfg(5) manpage, for more details of the guest configuration syntax.
Install Debian
Now that you have created the guest configuration you can start the guest and connect to its console. e.g. assuming your guest configuration file is /etc/xen/debian-installer.cfg:
# xl create -c /etc/xen/debian-installer.cfg
At this point the guest will boot and Debian Installer will start. Now you can install Debian like you normally would, perhaps following the Debian Installation Guide.
See Xen Man Pages for more details on the use of xl
Finalize Guest Configuration
Once installation has completed the guest will shutdown and exit. At this point you should remove the kernel, initrd and extra lines from the guest configuration and replace them with simply:
bootloader = "pygrub"
Keep the rest of the configuration file the same.
Now you can start the guest again to boot your newly installed Debian guest!
# xl create -c /etc/xen/debian-installer.cfg
CD-ROM installation
Selecting a CD/DVD/BD ISO image
Full support for installing a Xen PV guest (32 or 64 bit) from an ISO image was added to Debian in the Squeeze (6.0.0) release.
Downloads of Debian CD images are available from the Debian CD Image site. Several options are available for downloading, it is preferred to use jigdo (a tool which can reconstitute an ISO image from a Debian mirror) or BitTorrent rather than direct download of ISO (which may be throttled or otherwise slower). More info on downloading using jigdo is available on the Debian CD Jigdo page. Selection of a Debian mirror, which is required for a jigdo download, is discussed above.
Debian provides several different flavours of the first ISO image, only some of which support installation as a Xen PV guest. The main two flavours which support Xen PV are:
- multi-arch (i386 & amd64) netinst CD Images of Debian Squeeze 6.0.4 (jigdo,torrent)
- multi-arch (i386, amd64 & source) DVD Images of Debian Squeeze 6.0.4 (jigdo,torrent)
In both cases the image supports installation of both 32 bit (i386) and 64 bit (amd64) Debian guests.
Information on verifying the authenticity of these images is available here.
If the machine on which you want to install guests has a network connection then the netinst option is preferable since it reduces the initial download and will then only download precisely what you need for your configuration. Note that if you have a network connection then booting a netboot image (as described above) is an even better option.
Having selected the appropriate first ISO you can then combine this with the images from the standard set in order to make up a complete set of Debian packages installable from ISO.
In addition to the above stable release images there are daily builds of multi-arch netinst CD images (jigdo,torrent) and weekly builds of the multi-arch DVD images (jigdo, torrent) for the testing release. Note that the testing release of Debian is by definition a work in progress and may contain transient issues etc.
Create Initial Guest Configuration
For the most part this is the same as the guest configuration for the netboot installation case discussed above (e.g. the requirement to use the whole disk partitioning scheme remains). Installation from an ISO image differs from netboot in the need to provide the ISO image as a device to the guest and to select the appropriate kernel from the ISO to use.
Providing the ISO image to the guest as a PV CDROM device is simply a case of including the ISO image in the disk directive of your configuration file. For example to configure a domain with /dev/xvda as a disk and /dev/xvdd as the ISO image use:
disk = ['file:/scratch/debian-6.0.4-amd64-i386-netinst.iso,xvdd:cdrom,r', 'phy:/dev/VG/debian-installer,xvda,w']
(Note: if you are using the pygrub method to boot from the ISO as described below then the CDROM device must come first as shown)
Each Debian ISO image which supports installation as a Xen PV guest contains a kernel (vmlinuz) and installer ramdisk (initrd.gz) specially for this use case. These live in /install.386/xen and /install.amd/xen for 32 and 64 bit installation respectively.
One option for booting these is to extract them from the ISO image, store them in your domain 0 filesystem and refer to them with kernel and ramdisk directives in your guest configuration file, much like the netboot case.
However it may be more convenient to use the pygrub tool to extract the correct kernel from the image. To do this first ensure that the PV CDROM device is the first device in the guest configuration disk directive and then specify pygrub as the bootloader giving the path to the kernel and ramdisk as bootloader arguments via the bootloader_args configuration file option.
e.g. for a 32 bit guest:
bootloader = "pygrub" bootloader_args = "--kernel=/install.386/xen/vmlinuz --ramdisk=/install.386/xen/initrd.gz"
or for a 64 bit guest:
bootloader = "pygrub" bootloader_args = "--kernel=/install.amd/xen/vmlinuz --ramdisk=/install.amd/xen/initrd.gz"
As with the netboot install you should specify suitable command line options. e.g.:
extra = "debian-installer/exit/always_halt=true -- console=hvc0"
Therefore a complete (if minimal) example of an install time configuration booting using pygrub might be:
name = "debian-installer" memory = 256 disk = ['file:/scratch/debian-6.0.4-amd64-i386-netinst.iso,xvdd:cdrom,r', 'phy:/dev/VG/debian-installer,xvda,w'] vif = [' '] bootloader = "pygrub" bootloader_args = "--kernel=/install.386/xen/vmlinuz --ramdisk=/install.386/xen/initrd.gz" extra = "debian-installer/exit/always_halt=true -- console=hvc0"
Install Debian
Installation proceeds in the same way as with netboot, as described above.
Depending upon the ISO image you have chosen to install from you may be offered the option to select a Debian mirror in order to install further software from the online repositories. The selection of a Debian mirror is discussed above.
Finalize Guest Configuration
Once installation has completed the guest will shutdown and exit. At this point you should remove any bootloader_args, kernel, initrd and extra lines from the guest configuration and use simply:
bootloader = "pygrub"
Keep the rest of the configuration file the same.
Now you can start the guest again to boot your newly installed Debian guest!
# xl create -c /etc/xen/debian-installer.cfg
Advanced Options
Preseeding
You can preseed a Xen installation in the same way as a normal native install by adding the necessary command line directives to the extra configuration line. e.g.
extra = "debian-installer/exit/always_halt=true -- console=hvc0 auto-install/enable=true url=http://example.com/debian/squeeze.cfg"
More information on preseeding can be found in Appendix B of Debian's Installation Guide
Other Installation Methods
Debian's Xen wiki page covers several other methods of installing Xen guests, including debootstrap and xen-tools.
External References
General Links
- Xen on the Debian Wiki
- Debian Install Guide (i386, amd64)
- Debian CD Page
Development (testing and unstable) Links
These links are to the current development version of Debian. Please report installer bugs to the debian-boot mailing list and CD/DVD image bugs to the debian-cd mailing list. For Xen specific issues please also copy xen-devel.
- Debian Installer daily builds (includes netboot images for amd64 and i386)
- CD image daily builds
- DVD image weekly builds