====== Booting the Installation Environment from HDD ======
This article shows how to boot the Slackware installation environment from a hard drive instead of the usual installation media.
The Slackware installation environment is a small live Linux system with busybox, partitioning and some other useful utilities, and the ''setup'' program. It starts automatically when you boot your system from Slackware install media: CD, DVD, USB stick or PXE.
In order to boot the Slackware installation environment without creating install media you need an image of this boot environment, a suitable Linux kernel, and a boot loader.
With grub2 you can also boot from the iso file by adding it to the grub menu.
===== Image of the Environment =====
All software that you can use after booting the Slackware installation media resides in an [[wp>initrd|initial ramdisk image]]. You can find it as ''/isolinux/initrd.img'' on any installation media or at the same location on any of the Slackware mirrors.
===== Linux Kernel =====
Slackware uses (at least now) one of its huge kernels to run the installation environment. You can find the kernel's ''bzImage'' files in sub-directories of the ''/kernel'' directory on the installation media or at the same location on any Slackware mirror.
===== Getting The Files =====
If you already have an ISO image of the Slackware install media you can mount this image with the loop option and copy the files, for example to a ''/boot/swsetup'' directory which you create yourself first.
* This is how that looks for a Slackware 14.0 64-bit ISO image:
# mkdir -p /mnt/tmp /boot/swsetup
# mount -o loop /tmp/slackware64-14.0-install-dvd.iso /mnt/tmp
# cp /mnt/tmp/isolinux/initrd.img /mnt/tmp/kernel/huge.s/bzImage /boot/swsetup/
# umount /mnt/tmp
* And for Slackware 14.0 32-bit:
# mkdir -p /mnt/tmp /boot/swsetup
# mount -o loop /tmp/slackware-14.0-install-dvd.iso /mnt/tmp
# cp /mnt/tmp/isolinux/initrd.img /mnt/tmp/kernel/hugesmp.s/bzImage /boot/swsetup/
# umount /mnt/tmp
You can also download the kernel and initrd image from one of the Slackware mirrors. There are some examples below.
* Slackware 14.0 64-bit:
* kernel: http://slackware.osuosl.org/slackware64-14.0/kernels/huge.s/bzImage
* initrd: http://slackware.osuosl.org/slackware64-14.0/isolinux/initrd.img
* Slackware 14.0 32-bit:
* kernel: http://slackware.osuosl.org/slackware-14.0/kernels/hugesmp.s/bzImage
* initrd: http://slackware.osuosl.org/slackware-14.0/isolinux/initrd.img
===== Boot Loader =====
There are many boot loaders around. Slackware uses SYSLINUX to boot from the install media, installs LILO to boot the installed system, and provides a GRUB-legacy package in ''/extra'' (32 bit only). Many distributions use GRUB (renamed from GRUB2) as their main boot loader. If you use a Linux system you probably already have a suitable one. You need to put the ''bzImage'' and ''initrd.img'' files in a suitable place and instruct the boot loader to boot them. \\ Note that some parameters are passed to the kernel in ''/isolinux/isolinux.cfg''; you need them to configure your boot loader properly.
==== LILO ====
Add to ''/etc/lilo.conf'' something like:
image = /boot/swsetup/bzImage
initrd = /boot/swsetup/initrd.img
addappend = "load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s"
label = SwSetup
and run
# lilo
==== GRUB ====
Add to ''/boot/grub/grub.cfg'' something like:
menuentry 'SwSetup' {
set root='(hd0,2)'
linux /boot/swsetup/bzImage load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s
initrd /boot/swsetup/initrd.img
}
(hd0,2) means "//the second partition on the first drive//" (i.e. ''/dev/sda2''). You can find the right value in the "''set root''" command of the menu entry used to boot your system, or else consult with [[http://www.gnu.org/software/grub/manual/grub.html|GRUB manual]].
If you use a separate partition for ''/boot'', then you must remove "/boot" from any pathnames.
==== GRUB-legacy ====
Add to ''/boot/grub/menu.lst'' something like:
title SwSetup
root (hd0,1)
kernel /boot/swsetup/bzImage load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s
initrd /boot/swsetup/initrd.img
(hd0,1) means the //second partition// (this is not a typo, GRUB-legacy numbers partitions from 0) on the //first drive// (i.e. ''/dev/sda2''). You can find the right value in the "''root''" command in the section used to boot your system; or else consult with [[http://www.gnu.org/software/grub/manual/legacy/grub.html|GRUB-legacy manual]].
If you use a separate partition for ''/boot'', then you must remove "/boot" from any pathnames.
==== Boot ISO with GRUB2 ====
Add to ''/etc/grub.d/40_custom'':
menuentry "Slackware 14 install (DVD)" {
insmod loopback
insmod iso9660
set isofile="/slackware64-14.0-install-dvd.iso"
loopback loop (hd0,2)$isofile
linux (loop)/kernels/huge.s/bzImage load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 SLACK_KERNEL=huge.s
initrd (loop)/isolinux/initrd.img
}
(hd0,2) means "//the second partition on the first drive//" (i.e. ''/dev/sda2''). You can find the right value in the "''set root''" command of the menu entry used to boot your system, or else consult with [[http://www.gnu.org/software/grub/manual/grub.html|GRUB manual]].
Then update grub with:
grub-mkconfig -o /boot/grub/grub.cfg
On Slackware before running grub-mkconfig you have to run ln -s /dev/sda2 /dev/root
where for sda2 you have to enter your root device.
===== Test It =====
Reboot your system and select SwSetup at boot prompt.
If you have an unused partition you can install Slackware on it right now.
==== Using an ISO Image as Source ====
If you downloaded the Slackware DVD ISO image you can use it as package source.
* In the "''SOURCE MEDIA SELECTION''" step select "''2 Install from hard drive partition''",
* enter the name of the disk partition containing the ISO image file, for example ''/dev/sda2'',
* then type in the full path on that partition's filesystem to the directory with the DVD ISO image, for example ''/tmp/'',
* and agree with the prompt to use the ISO image as package source:
┌──────────────────────SOURCE MEDIA SELECTION────────────────────────┐
│ Please select the media from which to install Slackware Linux: │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │ 1 Install from a Slackware CD or DVD │ │
│ │ 2 Install from a hard drive partition │ │
│ │ 3 Install from NFS (Network File System) │ │
│ │ 4 Install from FTP/HTTP server │ │
│ │ 5 Install from Samba share │ │
│ │ 6 Install from a pre-mounted directory │ │
│ └────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────┤
│ < OK > │
└────────────────────────────────────────────────────────────────────┘
┌────────────────────INSTALLING FROM HARD DISK───────────────────────┐
│ In order to install directly from the hard disk you must have a │
│ partition (such as /dev/sda1, /dev/sdb5, etc) with the Slackware │
│ distribution's slackware/ directory like you'd find it on the FTP │
│ site. It can be in another directory. For example, if the │
│ distribution is in /stuff/slackware/, then you have to have │
│ directories named /stuff/slackware/a, /stuff/slackware/ap, and so │
│ on each containing the files that would be in that directory on │
│ the FTP site. You may install from FAT or Linux partitions. │
│ │
│ Please enter the partition (such as /dev/sda1) where the Slackware │
│ sources can be found, or [enter] to see a partition list: │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │/dev/sda2 │ │
│ └────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────┤
│ < OK > │
└────────────────────────────────────────────────────────────────────┘
┌───────────────────SELECT SOURCE DIRECTORY─────────────────────┐
│ Now we need to know the full path on this partition to the │
│ slackware/ directory where the directories containing │
│ installation files and packages to be installed are kept. │
│ For example, if you downloaded Slackware into the /stuff │
│ directory on your hard drive (so that you have the │
│ directories /stuff/slackware/a, /stuff/slackware/ap, and so │
│ on each containing the files that would be in that directory │
│ on the FTP site), then the full path to enter here would be: │
│ │
│ /stuff/slackware │
│ │
│ What directory are the Slackware sources in? │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │/tmp/ │ │
│ └───────────────────────────────────────────────────────────┘ │
├───────────────────────────────────────────────────────────────┤
│ < OK > │
└───────────────────────────────────────────────────────────────┘
┌────────────────────────USE ISO IMAGE──────────────────────────┐
│ │
│ An ISO image of Slackware's install DVD was found. │
│ Do you want me to mount the ISO image and use this as the │
│ package source? │
│ │
├───────────────────────────────────────────────────────────────┤
│ < Yes > < No > │
└───────────────────────────────────────────────────────────────┘
Then continue as usual.
Slackware setup (starting with version 13.0) automatically finds an ISO image if it is named as ''slackwar*-install-dvd.iso''.
You can also mount your image manually.
* Before starting ''setup'' or later from another console (use Alt+F# to switch to a different console number "#"), execute
# mkdir /hd /iso
# mount /dev/sda2 /hd
# mount -o loop /hd/tmp/slackware64-14.0-install-dvd.iso /iso
* In the "''SOURCE MEDIA SELECTION''" step select "''6 Install from a premounted directory''",
* In the next dialog window, enter the path to the directory containing the "//package series//", meaning the subdirectories "''a''", "''ap''", ..., "''y''". This path would be ''/iso/slackware64'' for a 64 bit system or ''/iso/slackware'' for 32-bit.
Then continue with the installation as usual.
====== Sources ======
* Originally written by [[wiki:user:bormant | Serg Bormant]]
{{tag>howtos author_bormant}}