Getting Linux
Before Linux From Scratch, you need Linux. This chapter gets you a host — and teaches the parts every installer glosses over: UEFI vs BIOS, MBR vs GPT, how to partition without trusting the "guided" button, and why a VM is the honest way to practice. The featured distro is Slackware (or its accessible fork Slint) — the distro that asks you to do things rather than hiding them, which is exactly the education this handbook requires.
The five ways in
| Path | Best for | Cost |
|---|---|---|
| Virtual machine | Practicing, LFS hosting, zero risk | Free; snapshots = unlimited undo |
| Live USB | Trying before installing; rescue | One spare stick; nothing persists |
| Dual boot | Real hardware, real speed | Partition surgery on your disk |
| Dedicated machine | The fullest experience | A spare box |
| WSL | Linux tools on Windows | Fast, but not a real system |
The handbook's answer for almost everyone: a VM. QEMU/KVM or VirtualBox, 4 GB RAM, 2 CPUs, 30+ GB disk — a machine you can destroy with no consequences, snapshot before every risky step, and clone for parallel experiments. A VM is also the correct LFS host — chapter 2's whole setup assumes one.
The boot-mode fork: UEFI or BIOS
Every modern machine boots one of two ways, and the choice is made before installation:
- UEFI + GPT — the modern path: GPT partition tables, an EFI System Partition (FAT32, ~300 MB, type EF00) holding bootloader binaries, boot entries stored in NVRAM. Secure Boot may complicate unsigned kernels.
- BIOS + MBR — the legacy path: MBR partition table (4 primaries max, or extended), bootloader code in the boot sector.
Check before installing: ls /sys/firmware/efi on a live boot — exists = UEFI. In a VM you choose at machine-creation; QEMU -bios OVMF.fd for UEFI, default for BIOS. Mismatched boot mode and partition table is the #1 first-install failure — a GPT disk won't boot BIOS-mode without a BIOS boot partition; an MBR disk can't carry UEFI.
Slackware — the reference distro
Why Slackware specifically, when Ubuntu is "easier":
- The installer teaches — text menus that ask you to partition, choose filesystems, install package sets, configure LILO. It hides nothing; you learn because it makes you do it.
- BSD-style init —
rc.M,rc.inet1, readable shell scripts instead of a unit graph — matching this handbook's SysV path through LFS. - Complete dev environment — gcc, binutils, make, the full toolchain aboard out of the box — an LFS-ready host.
- Nothing between you and the system — no snap stores, no telemetry, no package managers that phone home.
Slint is Slackware rebuilt for accessibility — the same system with Speakup/BRLTTY integrated from the installer onward; for eyes-free users it's both the host distro and the destination philosophy.
The install, distilled
# inside the installer (or beforehand on any system):
cfdisk /dev/sda # or gdisk/fdisk — carve partitions
# root: ~25G type 8300 · swap: ~4G type 8200 · ESP: 300M type EF00 if UEFI
setup # Slackware's menu installer
# → ADDSWAP → TARGET → SOURCE → SELECT → INSTALL → CONFIGURE
# → LILO (or skip for ELILO/GRUB on UEFI)
The installer's steps map exactly onto the manual work LFS will ask of you — partitioning, filesystems, package selection, bootloader — which is why it's the trainer.
The VM matrix — every hypervisor's trade
# QEMU/KVM — the Linux native — near-native speed
qemu-img create -f qcow2 disk.qcow2 40G
qemu-system-x86_64 -m 4096 -smp 2 -enable-kvm \
-drive file=disk.qcow2,if=virtio \
-cdrom installer.iso -boot d \
-net nic -net user -display sdl
# snapshots: qemu-img snapshot -c name disk.qcow2
# UEFI: -bios /usr/share/OVMF/OVMF_CODE.fd
# serial console: -nographic -serial mon:stdio
# VirtualBox — the GUI choice
VBoxManage createvm --name lfs --register
VBoxManage modifyvm lfs --memory 4096 --cpus 2
VBoxManage createhd --filename lfs.vdi --size 40960
# snapshots in the GUI; EFI via Enable EFI
# virt-manager — QEMU with a GUI
# GNOME Boxes — the simplest
# VMware/Hyper-V — the Windows paths
The VM's virtues: snapshots (unlimited undo), clones (parallel builds), zero hardware risk, instant reinstalls. For LFS specifically: a VM is a disposable lab — break it freely, snapshot before every phase.
The QEMU path — a machine in a window
# create + boot a VM
qemu-img create -f qcow2 lfs-host.qcow2 40G
qemu-system-x86_64 \
-m 4096 -smp 2 -enable-kvm \
-drive file=lfs-host.qcow2,if=virtio \
-cdrom slint64-15.0.iso -boot d \
-net nic -net user -display sdl
-enable-kvm gives near-native speed; qcow2 is the copy-on-write image format; virtio devices are the paravirtual drivers the kernel supports natively. Snapshots: qemu-img snapshot -c before-chroot lfs-host.qcow2 — the undo button a real disk lacks.
Dual boot — the surgery path
If you install beside an existing OS:
- Back up first — repartitioning is the one operation with no undo
- Shrink the existing filesystem from inside its own OS (Windows' Disk Management shrinks NTFS safely)
- Install to the freed space — let the installer use the empty region, never the whole disk
- The bootloader (GRUB/LILO) takes over the boot sector and menus both OSes
UEFI dual-boots add a rule: both OSes share one ESP — the installer adds its entry; don't format or delete the existing ESP.
WSL — the tools, not the machine
Windows Subsystem for Linux gives you real bash, real coreutils, real gcc — superb for learning the tools this handbook's middle chapters teach. It is not a real Linux system: no real init, no real partitions, no kernel you control, loop devices unavailable by default. Practice grep in WSL; build LFS in a VM.
Slackware's installer — the annotated walkthrough
The setup menu — each step is a lesson:
- ADDSWAP — designate swap:
mkswap+ fstab entry — the installer does the mechanics - TARGET — pick the root partition — formats it
mkfs.ext4, mounts it - SOURCE — where the packages are — CD, HTTP, NFS, premounted
- SELECT — the package series: A (base), AP, D (development — gcc/binutils/make — LFS-essential), F (FAQ/docs), K (kernel source), L (libraries — Glibc etc), N (network), T/TCL, X/XAP (X+apps), E (emacs)... — install A AP D F K L N + T at minimum
- INSTALL —
fullmode is the honest choice — terse prompts per package - CONFIGURE — kernel (huge vs generic), LILO/GRUB, network, mouse, timezone, root password, fstab
- Reboot
The installer's honesty: it does what you'd do by hand — partition, mkfs, mount, untar packages, write configs — nothing hidden. The D series (gcc/binutils/make/kernel-headers) + K (kernel source) + L (libraries) make it LFS-ready out of the box.
The filesystems at install — what each partition does
/dev/sda1 ESP 300M vfat EF00 — UEFI boot binaries (UEFI only)
/dev/sda2 swap 4G swap 8200 — virtual memory overflow
/dev/sda3 / 36G ext4 8300 — the whole system
Slackware's setup walks each. The fstab it writes: defaults for root, pri=1 for swap, the virtual filesystems for proc/sys/devpts/devtmpfs/tmpfs — the same six rows chapter 6 teaches.
Post-install: the first checks
uname -a # what kernel, what arch
ls /sys/firmware/efi # UEFI or BIOS — know which
df -h # filesystems and free space
swapon --show # swap active?
ldd --version | head -1 # glibc — the LFS host requirement
gcc --version # toolchain present?
ping -c1 1.1.1.1 # network alive
All green = a host that qualifies for chapter 2's version-check roster.
Where installs go wrong
| Symptom | Cause |
|---|---|
| Installer can't find the disk | VM used the wrong bus — use virtio/sata, not scsi on old distros |
| Boots to GRUB rescue / no OS found | Boot mode vs partition table mismatch |
| UEFI install boots BIOS-only | Missing ESP or grub-install targeted wrong mode |
| Dual-boot Windows gone | ESP formatted, or "use whole disk" chosen |
| VM is unusably slow | KVM off (-enable-kvm), or nested virt unavailable |
| Slackware boots to no X | It doesn't install a desktop by default — that's normal |
Exercises
- Identify your machine's boot mode (
/sys/firmware/efi) and partition table (fdisk -l's "Disklabel type"). - Create a QEMU VM and snapshot it — then deliberately destroy the install and roll back.
- Partition a scratch disk three ways: MBR/BIOS, GPT/UEFI, GPT+ESP — describe the difference each makes.
- Install Slackware in the VM, noting every step the installer made you do.
- On a live USB, verify
ldd --versionreports glibc.
Timeline
| Step | Result |
|---|---|
| Boot mode | UEFI or BIOS chosen before anything |
| Path | VM for practice + LFS host; real HW for keeps |
| Distro | Slackware/Slint — visible machinery, dev-ready |
| Partition | gdisk/fdisk by hand — the real skill |
| Install | setup → the system you control |
| next | The filesystem — the tree you now own |
References
- slackware.com · slint.fr — the distros
- QEMU documentation — qcow2, virtio, KVM
- UEFI spec / OSdev wiki — the boot modes
- linuxfromscratch.org — host requirements the install must satisfy
See also
- Linux — chapter 1 · LFS Preparation — what the host is for