1.3. Planning a Debian System

Installation media and defaults can carry a system a long way, but the choices that are expensive to change later should be made deliberately: architecture, deployment model, storage layout, network access, and administrative access. The commands in this section inspect the example system; they do not modify it.

1.3.1. Matching Hardware and Architecture to the Workload

The first decision is the architecture, because it determines which installer images, kernels, and packages are available. Debian 13's installable architectures cover the common server and desktop platforms, with two legacy architectures restricted.

Architecture Typical hardware Debian 13 note
amd64 64-bit x86 PCs and servers Fully supported; i386 is a co-architecture only
arm64 64-bit ARM servers, boards, and virtual machines Fully supported
armhf 32-bit ARMv7 boards Fully supported
ppc64el Little-endian POWER servers Fully supported
riscv64 64-bit RISC-V hardware Officially supported since Debian 13
s390x IBM Z mainframes Fully supported
i386 Legacy 32-bit x86 No installer or kernel; co-architecture on amd64
armel Older ARM boards Upgrade-only; no installer; last release

The processor inventory on the example system:

$ lscpu
Architecture:                            x86_64
CPU op-mode(s):                          32-bit, 64-bit
Address sizes:                           40 bits physical, 48 bits virtual
Byte Order:                              Little Endian
CPU(s):                                  1
On-line CPU(s) list:                     0
Vendor ID:                               GenuineIntel
Model name:                              Intel Core Processor (Skylake, IBRS)
CPU family:                              6
Model:                                   94
Thread(s) per core:                      1
Core(s) per socket:                      1
Socket(s):                               1
Stepping:                                3
BogoMIPS:                                7584.02
[...]
Virtualization:                          VT-x
Hypervisor vendor:                       KVM
Virtualization type:                     full
[...]

Selected output; the long CPU flag list, cache and NUMA details, and vulnerability rows are omitted.

CPU(s) is the number of logical CPUs visible to the system, while Thread(s) per core, Core(s) per socket, and Socket(s) show the topology. The example has one logical CPU, so it is suitable for testing but not for estimating the capacity of a production server. Virtualization: VT-x describes the CPU feature exposed to this guest; Hypervisor vendor: KVM shows that the guest is running under KVM, not on bare metal. Containers are detected separately by systemd-detect-virt in Section 1.3.2.

Memory is the second constraint:

$ free -h
               total        used        free      shared  buff/cache   available
Mem:           967Mi       372Mi       173Mi       2.3Mi       592Mi       594Mi
Swap:             0B          0B          0B

The free column is memory not currently used for anything, while available estimates how much can be given to new applications without swapping. The buff/cache column is memory used for cached file data and can be reclaimed. This guest has no swap, so memory pressure would have to be handled by reducing workload or adding memory; a desktop or database server would normally have swap or enough memory to avoid it. The values are a snapshot and will change as processes run.

Workload Usually constrained by Planning consequence
Desktop Graphics, memory, storage latency Check firmware and kernel driver support before buying hardware
General server Memory and network A small VM may suffice, but leave room for logs and updates
Database or cache Memory, IOPS, and storage latency Separate data storage from the operating system; measure before sizing
File or web server Disk throughput and network Plan capacity and backups together
Build or CI host CPU, memory, and disk space Fast local storage and enough RAM for parallel jobs
Virtualization host CPU, memory, and I/O Plan overcommit and host recovery, not just guest count

Hardware support is more than the CPU. Graphics, Wi-Fi, storage controllers, and network adapters may require firmware or a newer kernel than the installer provides. Check the Debian installation guide and the hardware compatibility notes for the specific model, and test the device before relying on it. Firmware and kernel details are covered in Chapter 7, and graphics in Chapter 4.

1.3.2. Choosing Physical, Virtual, or Cloud Deployment

A physical system gives direct control of firmware, disks, and devices, but hardware failures and console access are your responsibility. A virtual machine adds a hypervisor layer, which makes snapshots, cloning, and virtual hardware easy but also means the host controls CPU, memory, and device availability. A cloud instance is a virtual machine managed through a provider's API, usually with cloud-init, provider networking, and metered storage and traffic.

Deployment layers and the administration boundary

Figure 1.3. Who controls each layer in physical, virtual, and cloud deployments. The dashed line marks the administration boundary.

Criterion Physical Virtual machine Cloud instance
Hardware control Full; firmware and devices Virtual hardware; host controls the rest Provider controls the platform
Provisioning Manual or imaging Clone or install from media API, image, or template
Storage Local disks, RAID, SAN Virtual disks on host storage Provider volumes or ephemeral disks
Network Your switches and addresses Virtual NICs and bridges Provider network and security groups
Recovery Console, rescue media, backups Snapshots, host console, backups Provider console, snapshots, rebuild
Best fit GPUs, direct I/O, appliances Isolation, testing, consolidation Elastic or managed workloads
Watch for Hardware failure and spares Host capacity and noisy neighbors Cost, data egress, and provider limits

The example system identifies its own deployment model:

$ systemd-detect-virt
kvm

systemd-detect-virt prints the virtualization technology it detects. On bare metal it prints none and exits with a nonzero status; in a container it prints the container manager, such as docker or lxc.

systemd-detect-virt option Effect
--vm Detect full virtualization only.
--container Detect containers only.
--quiet Suppress output and report the result through the exit status.

Identity gathered from the firmware and the OS is collected by hostnamectl:

$ hostnamectl
 Static hostname: trixie
       Icon name: computer-vm
  Virtualization: kvm
Operating System: Debian GNU/Linux 13 (trixie)
          Kernel: Linux 6.12.86+deb13-amd64
    Architecture: x86-64
 Hardware Vendor: QEMU
  Hardware Model: Standard PC _i440FX + PIIX, 1996_
Firmware Version: 1.16.3-debian-1.16.3-2
   Firmware Date: Tue 2014-04-01
    Firmware Age: 12y 7month 2w 4d

Selected output; the chassis, machine ID, and boot ID lines are omitted.

hostnamectl merges identity from several sources. The static hostname is trixie; the hardware vendor and model describe the emulated QEMU machine, not a physical chassis. The firmware date and age refer to the emulated firmware image, so they are not a recommendation about updating a real server's firmware.

A cloud image is not configured like a DVD installation. It boots, obtains instance metadata through a provider service, and applies cloud-init configuration for hostname, users, SSH keys, and network settings. The image must match the provider and the boot firmware; an image built for one cloud's metadata service may not boot correctly elsewhere. Debian publishes cloud images through cloud.debian.org, and the release notes list the providers for which images are published. This book treats cloud images as a deployment choice and covers the Debian-side configuration; the provider's console and API remain the recovery path.

Containers are not a substitute for a full Debian system in this comparison. A container shares the host kernel and usually runs one service, so it has no independent kernel, boot loader, or firmware. Containers are covered in Chapter 25. Virtual machines and libvirt are covered in Chapter 24.

1.3.3. Planning Storage, Network Access, and Administration

Storage, network, and administrative access are planned together because they determine how the system is installed and how it is recovered. A separate /var partition can protect the root filesystem from log growth, but it also adds a mount that must be present at boot. A remote server needs a network configuration that survives a reboot and a console path that does not depend on the network. An administrative account needs a recovery method that does not depend on the same credentials that might be lost.

The block-device tree shows where the system's storage lives:

$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
NAME    SIZE TYPE FSTYPE MOUNTPOINTS
vda     100G disk
└─vda1  100G part ext4   /

lsblk shows the device hierarchy. vda is a virtio disk, vda1 is a partition on it, and the partition contains an ext4 filesystem mounted at /. There is no separate /boot, /var, or swap device. The output does not show free space or inode use; those require df.

lsblk option Effect
-o columns Select and order columns.
-f Show filesystem type, label, UUID, and mount point.
-p Print full device paths, such as /dev/vda1.
$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        98G  4.9G   88G   6% /

df -h reports block usage in human-readable units. The inode count is a separate resource:

$ df -i /
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/vda1      6553600 122254 6431346    2% /

df -i reports inode usage; in this guest 2% of the inode table is used. The block report shows 98G while the block device reports 100G because ext4 reserves space and uses some for metadata; the tools also round units differently. A filesystem can have free bytes but no free inodes, especially on a filesystem with many small files, and the error will still say that the device is full. Check both when diagnosing space problems.

df option Effect
-h Show sizes in human-readable units.
-i Show inode usage instead of block usage.
-T Include the filesystem type.
Storage layout Isolation or benefit Cost or risk
Single root filesystem Simple; one mount to recover Log growth or data fills the root
Separate /home User data survives a root reinstall More partitions to size and mount
Separate /var Logs and caches cannot fill root Must be large enough for packages and logs
LVM Flexible growth and snapshots More complex recovery; volume metadata
LVM on LUKS Encryption at rest Passphrase or key management; boot integration
Btrfs or ZFS Checksums, snapshots, flexible volumes Different repair and capacity rules

The example's single ext4 root is a reasonable test layout, not a universal recommendation. Partitioning is destructive: read the review screen in the installer, and back up data before changing an existing disk. Chapter 2 covers the installer's partitioning choices; Chapters 11-13 cover disks, filesystems, LVM, RAID, and encryption, Chapters 15-16 cover backup and recovery, and ZFS has its own treatment in Chapter 30.

Network access follows the same pattern: inspect what exists, then decide what must be persistent:

$ ip -br addr
lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP             192.168.121.39/24 fe80::5054:ff:fe30:78ce/64

lo is the loopback interface and is always present; its UNKNOWN state is normal for loopback and is not an error. eth0 is up and has an IPv4 address in the 192.168.121.0/24 network and an IPv6 link-local address. The -br option asks for the brief one-line format, and addr selects address information. This is a NAT network used by the example environment; a physical server will usually have a different interface name, such as enp1s0, and a different address. Predictable interface names are covered in Chapter 17.

$ ip route
default via 192.168.121.1 dev eth0
192.168.121.0/24 dev eth0 proto kernel scope link src 192.168.121.39

The default route sends traffic for addresses outside the local network to the gateway 192.168.121.1. The second route describes the directly connected network and records the source address. Without a default route, the system can reach its own subnet but not the internet or a remote package mirror.

$ ss -lntup
Netid State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
udp   UNCONN 0      0            0.0.0.0:5353       0.0.0.0:*
udp   UNCONN 0      0          127.0.0.1:323        0.0.0.0:*
udp   UNCONN 0      0            0.0.0.0:68         0.0.0.0:*
udp   UNCONN 0      0               [::]:5353          [::]:*
udp   UNCONN 0      0              [::1]:323           [::]:*
tcp   LISTEN 0      4096       127.0.0.1:631        0.0.0.0:*
tcp   LISTEN 0      128          0.0.0.0:22         0.0.0.0:*
tcp   LISTEN 0      4096           [::1]:631           [::]:*
tcp   LISTEN 0      128             [::]:22            [::]:*

Selected output; two UDP sockets with high port numbers are omitted.

ss lists listening sockets. -l selects listeners, -n keeps numeric addresses and ports, -t selects TCP, -u selects UDP, and -p asks for the owning process. The process column is empty here because the listeners belong to other users and the command was not run as root; a privileged sudo ss -lntup would show the process names. Port 22 is SSH, port 68 is a DHCP client, port 323 is a time-synchronization service, port 5353 is multicast DNS, and port 631 is a print server bound to loopback only. The UDP entries are marked UNCONN because UDP is connectionless; they are still bound and waiting for datagrams. The 0.0.0.0 and [::] addresses mean all IPv4 and IPv6 addresses, while 127.0.0.1 and [::1] are loopback only.

ss option Effect
-l Show listening sockets only.
-n Keep addresses and ports numeric; do not resolve names.
-t, -u Select TCP or UDP sockets.
-p Show the owning process; full details require privilege.
-4, -6 Restrict output to IPv4 or IPv6.
Access decision Common choice Planning note
Address assignment DHCP for clients, static for servers A server that changes address can disappear from monitoring
IPv4 and IPv6 Dual stack where the network supports it Test firewall and DNS behavior for both families
Name resolution DHCP-provided or explicit resolver Record the resolver and search domains
Remote administration SSH with keys Keep a console or out-of-band path for network failures
Packet filtering Default-deny inbound Allow only the services the role needs
Recovery Console, rescue image, or provider console Verify it before the first remote change

Firewall rules are covered in Chapter 18, and routing, bridges, VLANs, and VPNs in Chapter 19.

Administrative access is a separate design decision from the network. The account inventory starts with id:

$ id
uid=1001(john) gid=1001(john) groups=1001(john),27(sudo)

john has uid and gid 1001 and belongs to one supplementary group, sudo (group 27). Membership in that group is the standard way a Debian system grants an ordinary account the right to run commands as root. The full account record comes from the name service switch:

$ getent passwd john
john:x:1001:1001::/home/john:/bin/bash

getent queries the name service switch, not just /etc/passwd, so a directory service can supply the same entry; that makes getent a better check than reading the file directly. The fields are login name, password placeholder, uid, gid, GECOS information, home directory, and login shell.

The sudo options used in this chapter are:

sudo option Effect
-l List the invoking user's allowed commands and defaults.
-n Do not prompt for a password; fail if one is required.
-i Start a login shell as the target user, root by default.
-u user Run the command as user instead of root.

Whether the account can actually elevate is worth verifying rather than assuming. The following command is expected to fail, because -n forbids the password prompt and no credential is cached yet:

$ sudo -n -l
sudo: a password is required

The message goes to standard error, and the command exits with status 1. Without -n, sudo asks for john's password before doing anything else: the prompt is written directly to the terminal, and the password is not echoed while it is typed. After the correct password, the same query prints the policy:

$ sudo -l
Matching Defaults entries for john on trixie:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty

User john may run the following commands on trixie:
    (ALL : ALL) ALL

The policy entry (ALL : ALL) ALL means john may run any command as any user and group, after authenticating with his password; that is the standard policy granted by membership in the sudo group. Prebuilt images and automation sometimes configure NOPASSWD entries so sudo never asks; that is a deliberate local policy choice, not a Debian default. The Defaults line names environment handling: env_reset clears most of the invoking user's environment, secure_path sets the PATH used for elevated commands, and use_pty runs the command on a pseudo-terminal so terminal-based programs behave normally.

The policy listing by itself does not prove that elevation works, so verify it with a command whose output identifies the executing user:

$ sudo id -u
0

id -u prints the user ID of the invoking user; run through sudo, that user is root, and uid 0 is root's user ID. sudo remembers a successful authentication for a short period, fifteen minutes by default, so a second sudo command within that window does not ask for the password again.

To work in a root shell rather than elevating one command at a time, use sudo -i from the ordinary account, or su - if the root password is known; leave either shell with exit. In a root shell, HOME is /root and ~ expands there, so keep workspace paths explicit across the privilege change rather than relying on tilde. During installation, Debian asks whether to set a root password. If it is left blank, the first user is normally able to use sudo; if one is set, root is available with that password and the first user is not automatically granted sudo. Check the arrangement after first boot rather than assuming either one. Account and group management is covered in Chapter 5, and server hardening in Chapter 26.

Administrative decision What to record Why it matters
First user and sudo Account name, sudo policy, root password choice Determines who can repair the system
SSH access Keys, allowed users, port, source restrictions Remote recovery depends on it
Console access Provider console, serial, or physical console Network changes can lock you out
Backups What, where, retention, restore test A backup that has not been restored is unproven
Time and logs Time source, log retention, monitoring Correlate events and detect failures
Inventory Disk serials, addresses, encryption headers Rebuild and recovery depend on it