Founding prices until 15 December: 30% off Pro, locked for life. See pricing

RHCSA practice: what to do in the browser, what needs a VM, and the root password reset

Which RHCSA objectives you can practise in BrokenCluster's Rocky Linux labs, how to set up a free practice VM for the rest, and the root reset.

LinuxUpdated 27 November 20263 min read

The RHCSA is a hands-on exam: you get two servers and a list of tasks, and the result is checked after a reboot. You get ready by doing the tasks until they are routine. This guide says where to do each part, how to build a practice VM for the parts a browser lab can't reach, and walks through the boot tasks on that VM.

What runs in the browser

BrokenCluster's RHCSA labs open a Rocky Linux 9 machine (binary-compatible with RHEL 9). These run there for real:

  • Software: dnf with signed repositories on an internal mirror, installing and removing packages.
  • Services: systemctl, unit files, Restart=, the default target, the journal.
  • Firewall: the real firewalld daemon and firewall-cmd, runtime and permanent.
  • Users: groups, password ageing, sudo rules, shared directories with setgid and the sticky bit.
  • Scheduling, time and tuning: cron and at, chronyd, tuned.
  • SSH and the basics: SSH keys and sshd_config, archives, find, scripts.

Start with Point dnf at the offline repositories, Open one port, close an unused service and Turn a script into a service.

What needs a VM, and why

A lab machine is a container: it shares the server's kernel and has no disks or bootloader of its own. So these objectives need a VM:

  • SELinux: labels, booleans, ports. The kernel decides, and the lab servers don't run SELinux. See the SELinux guide.
  • Partitions, LVM, swap, fstab: these need block devices. See the storage guide.
  • Boot targets for real, GRUB, the root password reset: these need a real boot. They are below.
  • Containers with podman, NFS and autofs: these need the kernel's namespaces and mounts. See the containers and NFS guide.

Build the practice VM (about 20 minutes)

  1. Download the Rocky Linux 9 minimal ISO (rockylinux.org), or AlmaLinux 9.
  2. In VirtualBox, VMware Workstation or KVM (virt-manager), create a VM with 2 CPUs, 2 GB of RAM and a 20 GB disk. Then add two more empty disks of 5 GB each: they become /dev/sdb and /dev/sdc (or vdb, vdc on KVM) for the storage tasks.
  3. Install with the "Minimal Install" software choice, set a root password, and create a user who is an administrator.
  4. After the first boot, take a snapshot called clean. Rolling back to it in seconds is what makes it safe to break the VM on purpose.

A second VM made the same way (or a clone) gives you the exam's two-server setup for NFS and SSH tasks.

Reset the root password

On the VM (it can't be done in a container), reboot and interrupt GRUB:

  1. At the GRUB menu, press e on the default entry.
  2. At the end of the line that starts with linux, add rd.break, then press Ctrl-x to boot.
  3. At the switch_root:/# prompt:
mount -o remount,rw /sysroot
chroot /sysroot
passwd root
touch /.autorelabel
exit
exit

The machine relabels its files (a minute or two on a small VM) and reboots on its own. Log in with the new password.

  • Forgetting remount,rw: passwd fails with "Authentication token manipulation error", because /sysroot is read-only.
  • Forgetting /.autorelabel: the new /etc/shadow has no SELinux label, and every login fails after the reboot. Reset again, and this time relabel.

Boot targets for real

systemctl get-default
sudo systemctl set-default multi-user.target     # the next boot
sudo systemctl isolate rescue.target             # now: drops to a root maintenance shell

To boot into a different target once, press e in GRUB and add systemd.unit=rescue.target (or emergency.target) to the linux line. Practise getting back to multi-user.target from each.

Then

Take the timed RHCSA mock exam on the Rocky Linux machine when single labs feel routine, and do one full pass of the VM tasks the week before your exam.

Questions

Can I practise the whole RHCSA in a browser?
Most of it. Users, permissions, services, firewalld, dnf repositories, scheduling, time sync, tuning and SSH run for real in BrokenCluster's Rocky Linux labs. SELinux, partitions, LVM, swap, booting and root recovery need a kernel and disks of your own, so practise those on a free VM.
Which Linux should the practice VM run?
Rocky Linux 9 or AlmaLinux 9: both are free and binary-compatible with RHEL 9, so commands, package names and file paths match the exam. A free Red Hat Developer subscription gives you real RHEL 9 too.
Why do I need touch /.autorelabel after resetting the root password?
passwd rewrote /etc/shadow while SELinux was not running, so the new file has no SELinux label. Without a relabel at the next boot, nobody can log in, root included.
rd.break or init=/bin/bash?
Both work on RHEL 9. rd.break stops in the initramfs with the real root at /sysroot (read-only); init=/bin/bash starts a shell on the real root, also read-only. Either way: remount read-write, change the password, relabel.

More guides