2.5. Completing First Boot

The first boot is the first opportunity to check the installed system rather than the installer's view of it. Check the overall system state, the account and privilege path, the network, the clock, available updates, firmware update capability, and remote access before exposing the machine to untrusted networks. Record the results so a later failure can be compared with a known state.

2.5.1. Checking Accounts, Privileges, Network Access, and Clock Settings

systemctl reports the system manager's state and the units it supervises. The subcommands used here are read-only.

Subcommand or option Description
is-system-running Print running, degraded, starting, or another state.
--failed List units that are in a failed state.
get-default Show the target the system boots into by default.
status unit Show one unit's state, recent log lines, and dependencies.
is-enabled unit Show whether a unit is enabled at boot.
is-active unit Show whether a unit is currently active.
$ systemctl is-system-running
running

running means the manager reached its default target with no failed units; degraded means at least one unit failed. The state is a summary, so list the failures it would report:

$ systemctl --failed --no-pager
  UNIT LOAD ACTIVE SUB DESCRIPTION

0 loaded units listed.

No unit is failed. That covers units systemd knows about, not services that were never enabled or application-level errors. The default boot target is a separate fact:

$ systemctl get-default
graphical.target

The example image carries the Xfce desktop task, so it boots toward the graphical target; a server installed with no desktop task normally uses multi-user.target, and a desktop installation uses graphical.target. Check the target rather than inferring it from the package list.

The session identity and the account's groups are the first-boot counterpart of the account checks in Section 2.3.1:

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

john's session is the one expected, and the sudo group is still present. Repeat the privilege check with sudo id -u as well; the first boot is when a wrong account arrangement is cheapest to fix. The network checks from Section 2.2.3 - ip -br addr, ip route, the resolver file, getent hosts, and the gateway ping - are the same checks to repeat after the reboot. A boot that reaches a login prompt does not prove the installed system's network configuration survived, especially if the installer used DHCP and the address changed.

The clock is worth checking before anything that depends on time: TLS certificate validation, authentication protocols, and scheduled jobs.

Subcommand or option Description
status (default) Show local time, UTC, RTC, time zone, and NTP state.
show -p PROPERTY Print one property, such as NTPSynchronized.
set-timezone ZONE Set the system time zone.
set-ntp true Enable (true) or disable (false) network time synchronization.
$ timedatectl
               Local time: Wed 2026-11-18 07:00:24 UTC
           Universal time: Wed 2026-11-18 07:00:24 UTC
                 RTC time: Wed 2026-11-18 07:00:24
                Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

The system clock is synchronized, the NTP service is active, and the hardware clock stores UTC - the right combination for a Linux-only machine. A machine that dual-boots with Windows may need the hardware clock in local time, because Windows traditionally writes local time; that is what the installer's UTC question in Section 2.4.3 was about. The synchronization state can be read on its own:

$ timedatectl show -p NTPSynchronized --value
yes

NTPSynchronized=yes means the clock has been synchronized at least once; it does not guarantee the source is reachable at this moment. Chapter 10 covers time sources and zones. The machine's identity and firmware environment are summarized by hostnamectl:

$ hostnamectl
 Static hostname: trixie
       Icon name: computer-vm
      Machine ID: 05f8a682837b4296a896777273ecd659
         Boot ID: c057bdce14a04461beb04f3e8206b620
  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 line between the icon and machine ID is omitted. The static hostname matches /etc/hostname, the operating system is Debian 13, and the virtualization is KVM. The kernel line says 6.12.86, while /boot in Section 2.4.3 held a newer 6.12.117: an update has already been installed, and the new kernel runs only after the next reboot. That difference is the practical reminder that an updated kernel is not a running kernel. The firmware vendor and date describe the emulated BIOS, not a physical vendor's firmware.

2.5.2. Applying Initial Updates and Checking Firmware Availability

A new installation is current at the moment the image was built, not necessarily at the moment it boots. Refresh the package indexes with the sudo apt-get update command from Section 2.2.3, then list the packages that have newer candidates. apt list is intended for interactive use:

$ apt list --upgradable
Listing...

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

The warning is written to standard error and means the human-readable format may change between APT versions; scripts should use apt-get with -s or query the package database directly. At the moment of the example no package line followed Listing...: the system's candidates were all current. When updates are listed, review what would happen before applying them:

$ apt-get -s full-upgrade
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

-s prints the plan - which packages would be upgraded, installed, or removed - without changing anything; run it as the ordinary user, since the simulation needs no privileges. After reviewing the plan, apply the real upgrade with sudo apt full-upgrade and answer the download prompt. If the upgrade includes the kernel, systemd, or the C library, reboot afterwards so the running system matches the installed one; the kernel difference noted in Section 2.5.1 is exactly that situation. Chapter 6 covers upgrade policy and the difference between upgrade and full-upgrade, and Chapter 29 covers moving to the next major release.

Firmware updates are separate from package updates. fwupdmgr asks the fwupd daemon which devices it can update and which updates are available. The env NO_COLOR=1 prefix disables colored output so the transcript shows plain text.

Subcommand Description
get-devices List devices with firmware update capability.
get-updates Check for available firmware updates.
update Install available firmware updates.
refresh Refresh metadata from configured remotes.
$ sudo env NO_COLOR=1 fwupdmgr get-devices
Idle…: 0%
WARNING: UEFI ESP partition not detected or configured
See https://github.com/fwupd/fwupd/wiki/PluginFlag:esp-not-found for more information.
No hardware detected with firmware update capability

The report goes to standard error. In this run no update-capable hardware was found, and the warning about the EFI system partition is consistent with BIOS boot; the command's exit status varies with the fwupd version and terminal, so read the message rather than trusting one status. This result means the virtual machine has nothing for fwupd to do - physical laptops and servers with supported firmware controllers can list devices and updates here.

The installer and fwupd use the word firmware for two different things. The installer loads firmware a device driver needs, usually from a firmware package or a FAT stick, as described in Section 2.2.2. fwupdmgr updates firmware stored on the device itself, such as a system BIOS or a storage controller. A machine can need the first without supporting the second. Which firmware packages are available from the configured archive is worth checking while the subject is open:

$ apt-cache policy firmware-linux-free firmware-iwlwifi
firmware-linux-free:
  Installed: (none)
  Candidate: 20241210-2
  Version table:
     20241210-2 500
        500 https://deb.debian.org/debian trixie/main amd64 Packages
firmware-iwlwifi:
  Installed: (none)
  Candidate: (none)
  Version table:

firmware-linux-free, which carries firmware DFSG-free enough for main, has a candidate. firmware-iwlwifi, the Intel wireless firmware, has none, because the non-free-firmware component is not enabled in this image's sources. An installation that loaded firmware from a package during installation has the component enabled already, as Section 2.2.2 described. Chapter 6 explains how to add the component, and Chapter 7 covers firmware packages and CPU microcode in the boot and hardware context.

2.5.3. Establishing Remote Administration and Recording the System Layout

Remote administration should be deliberate: confirm the service is running, decide which authentication methods are allowed, verify the effective configuration, place a user key, and test access before closing the console. The examples use two roles:

Role Machine Address
Server (installed system) trixie 192.168.121.39/24
Client (administrator's workstation) trixie, playing both roles connects to 127.0.0.1

On a real deployment the client is a separate workstation; the sequence and the outputs are the same, and using the loopback address means the examples need only one machine. Every block below names the role and the privilege context before the command.

On trixie, as john, confirm which SSH implementation is present. The version line is written to standard error:

$ ssh -V
OpenSSH_10.0p2 Debian-7+deb13u4, OpenSSL 3.5.7 9 Jun 2026

The SSH server is a systemd service. is-enabled reports boot-time behavior and is-active the current state; both are read-only:

$ systemctl is-enabled ssh
enabled
$ systemctl is-active ssh
active

An enabled, active service should also be listening. ss lists sockets; -l selects listening sockets, -t TCP, -n keeps numeric addresses, and -p names the process, which needs privilege for other users' daemons.

Option Description
-l Show listening sockets only.
-n Do not resolve service names or addresses.
-t Show TCP sockets.
-p Show the process using each socket; requires privilege for other users' processes.
$ sudo ss -lntp | grep ":22"
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=589,fd=6))    
LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=589,fd=7))    

The daemon listens on IPv4 0.0.0.0:22 and IPv6 [::]:22, which accepts connections on every address of every interface. A machine with several interfaces should restrict that exposure with a firewall or an SSH ListenAddress; Chapter 20 covers the server configuration and Chapter 18 the firewall. The pipe keeps the port-22 lines from the longer listing.

The configuration file is not necessarily the effective configuration: Include directives and drop-in files change the result. sshd -T prints the effective configuration after parsing every source, and a pipe selects the authentication lines.

Option Description
-T Print the effective configuration and exit.
-C spec Show the configuration for a hypothetical connection.
-f file Use an alternative configuration file.
$ sudo sshd -T | grep -E "^(permitrootlogin|passwordauthentication|pubkeyauthentication|usepam)"
usepam yes
permitrootlogin without-password
pubkeyauthentication yes
passwordauthentication no

On this system password authentication is disabled, so the login path is a key; permitrootlogin without-password lets root use a key but not a password, which does not mean root has one installed; usepam yes routes account and session policy through PAM. A default installation may still allow password authentication - check your own effective configuration the same way rather than assuming either state.

Because the login path is a key, the first setup is the server's own host key. A client that connects for the first time has no record of the server's key and cannot tell a genuine server from an impostor without comparing the key out of band. Obtain the fingerprint on the server itself, in a session you already trust - sitting at the machine's console, or through a channel whose security is already established. On trixie, as john:

$ ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
256 SHA256:JgkpuCwzlfFHX2BC73pcFwcaoe6wu/NkIszx3f1gkf4 root@trixie (ED25519)

ssh-keygen -lf reads a public key file and prints its type, fingerprint, and comment; the public host key is world-readable, so no privilege is needed. The root@trixie comment records who generated the key when the system was installed. Write the fingerprint down - it is the value the client must see on first connection.

On the client, create the user key pair:

$ ssh-keygen -t ed25519

The command asks where to save the key - pressing Enter accepts the default ~/.ssh/id_ed25519, which the later examples assume - and then asks twice for a passphrase. An empty passphrase creates an unprotected key: anyone who obtains the file can authenticate with it. For a long-lived administrative key, enter a real passphrase; ssh asks for it on use and an agent can cache it for a session. The command is interactive, so its prompts are not shown here; it reports where it wrote the private key, the public key, and the key's fingerprint, and it creates ~/.ssh with mode 700 if the directory does not exist. Confirm the files and their permissions:

$ ls -l ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub
-rw------- 1 john john 399 Nov 18 07:09 /home/john/.ssh/id_ed25519
-rw-r--r-- 1 john john  93 Nov 18 07:09 /home/john/.ssh/id_ed25519.pub

The private key is readable only by john; the public key can be copied anywhere. Install the public key on the server so the account can authenticate with the matching private key. With password authentication available, the usual tool is ssh-copy-id john@trixie, which copies the key over an SSH connection. This server has password authentication disabled, so the examples place the file directly - the loopback exercise makes that a local operation, and on a real server the same append is done from the trusted console session. On trixie, as john:

$ cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys

The redirection appends the public key to the account's authorized-key file; the command prints nothing. Restrict the file's permissions, because sshd refuses an authorized_keys that other users can write:

$ chmod 600 ~/.ssh/authorized_keys

This command is also silent.

From the client, connect for the first time. Because the server's key is not yet recorded, ssh prints a warning that the host's authenticity cannot be established, shows the key type and fingerprint, and asks whether to continue. Compare that fingerprint with the one read on the server - they must match. Answer yes, the full word, and ssh records the key in ~/.ssh/known_hosts, which is what makes later connections verify the same identity silently. A connection that runs a single remote command instead of opening a shell is a compact way to check the whole path. On the client:

$ ssh john@127.0.0.1 'id -un; hostname; pwd; id -nG'
john
trixie
/home/john
john sudo

The remote shell ran the four commands as john on trixie: the account name, the host, the home directory, and the account's groups. If the key has a passphrase, ssh asks for it before the connection proceeds. To open an interactive session instead, omit the command - ssh john@127.0.0.1 - and a shell prompt appears; leave it with exit. The files the connection used are now in place:

$ ls -l ~/.ssh
total 20
-rw------- 1 john john  93 Nov 18 07:09 authorized_keys
-rw------- 1 john john 399 Nov 18 07:09 id_ed25519
-rw-r--r-- 1 john john  93 Nov 18 07:09 id_ed25519.pub
-rw------- 1 john john 939 Nov 18 07:09 known_hosts
-rw-rw-r-- 1 john john 103 Nov 18 07:09 known_hosts.old

The private key and authorized_keys are mode 600. known_hosts holds the recorded host key; after authentication the client also learned the server's other host keys, which is why the file is larger than one key line and why ssh keeps the backup copy known_hosts.old when it updates the file.

Two failures are worth recognizing before they happen in earnest, and both can be practiced safely on the loopback setup. First, a key the server does not know. On the client, create a second key that is never installed:

$ ssh-keygen -q -t ed25519 -N "" -f ~/debian-handbook/installation/id_ed25519.notinstalled

With the passphrase and file given on the command line the command is noninteractive, and -q makes it produce no output. Try it, restricting the attempt to that one key so the test is unambiguous:

$ ssh -o IdentitiesOnly=yes -i ~/debian-handbook/installation/id_ed25519.notinstalled john@127.0.0.1 true
john@127.0.0.1: Permission denied (publickey).

The command exits 255. Permission denied (publickey) means the server rejected every offered key - here the one key that was never authorized. The message does not reveal whether the account exists. The fix is on the server side: the account's authorized_keys must contain the public key that matches the private key being offered.

Second, a changed host key. If a server presents a different key than the one recorded, ssh refuses to connect, because the change is also what a man-in-the-middle attack looks like. The exercise writes a known-hosts record that deliberately holds the wrong key: sed prefixes each line of the unused public key file with the address, which is the record format ssh expects, and the redirection writes the result to a scratch file.

$ sed 's/^/127.0.0.1 /' ~/debian-handbook/installation/id_ed25519.notinstalled.pub > ~/debian-handbook/installation/known-hosts.exercise

Point a connection at that record file - $HOME must be spelled out because ssh option values do not get tilde expansion - and try to connect:

$ ssh -o UserKnownHostsFile=$HOME/debian-handbook/installation/known-hosts.exercise john@127.0.0.1 true
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:JgkpuCwzlfFHX2BC73pcFwcaoe6wu/NkIszx3f1gkf4.
Please contact your system administrator.
Add correct host key in /home/john/debian-handbook/installation/known-hosts.exercise to get rid of this message.
Offending ED25519 key in /home/john/debian-handbook/installation/known-hosts.exercise:1
  remove with:
  ssh-keygen -f '/home/john/debian-handbook/installation/known-hosts.exercise' -R '127.0.0.1'
Host key for 127.0.0.1 has changed and you have requested strict checking.
Host key verification failed.

The command exits 255 and no authentication is attempted - the mismatch was detected before any credentials were offered. Do not silence this warning: accepting an unknown or changed key without verification is exactly the practice the warning exists to prevent. Before removing a stale record, investigate why the key changed - a reinstalled or reimaged server legitimately presents a new key, and it can be verified through the same trusted channel used at first connection. Only then remove the old entry, with the ssh-keygen -R command the warning itself shows, and record the new key at the next connection. In the exercise nothing was wrong with the real key; the scratch record simply held a different one.

The last first-boot task is a record of the system layout, written while the system is healthy and stored outside the disposable exercise workspace at the end. Change into the workspace from Section 2.1.2 so the record's file name can stay short; cd is silent when it succeeds:

$ cd ~/debian-handbook/installation

Build the record with redirections. The first command creates the file; it is silent:

$ hostnamectl > system-layout.txt

The rest append to it; each is silent as well:

$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS >> system-layout.txt
$ ip -br addr >> system-layout.txt
$ findmnt -no SOURCE,FSTYPE,OPTIONS / >> system-layout.txt
$ uname -r >> system-layout.txt

Read the file back - this is its actual content on the example machine:

$ cat system-layout.txt
 Static hostname: trixie
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 05f8a682837b4296a896777273ecd659
         Boot ID: c057bdce14a04461beb04f3e8206b620
  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
NAME    SIZE TYPE FSTYPE MOUNTPOINTS
vda     100G disk        
└─vda1  100G part ext4   /
lo               UNKNOWN        127.0.0.1/8 ::1/128 
eth0             UP             192.168.121.39/24 fe80::5054:ff:fe30:78ce/64 
/dev/vda1 ext4 rw,relatime,discard,errors=remount-ro
6.12.86+deb13-amd64

One file now records the machine identity, the block-device layout, the addresses, the root mount, and the kernel. Add the pieces this chapter already gathered - the blkid UUIDs, /etc/fstab, the effective sshd authentication settings, and the administrative account path - and keep private keys, passwords, and passphrases out of it. A complete record makes a later failure comparable with a known state, which is what recovery needs first.

Keep the record and discard the exercises. Move the record one directory up, out of the workspace; the move is silent:

$ mv ~/debian-handbook/installation/system-layout.txt ~/debian-handbook/system-layout-trixie.txt

The workspace now holds only disposable exercise data - checksum files, the media fixture, the bad-mirror source, the GRUB preview, and the not-installed exercise key with its scratch host-record file. It is john's own scratch directory, so removing it is bounded to the files this chapter created:

$ rm -rf ~/debian-handbook/installation

The command is silent. Confirm that the record remains and the workspace is gone:

$ ls -A ~/debian-handbook
system-layout-trixie.txt

The SSH key material in ~/.ssh is separate from the workspace and remains in place: the private key on the client, the authorized key on the server, and the recorded host key on both.