Skill 2 in course 2.2: Operating System
Services, Targets and Boot
Control services and boot targets, edit the boot loader, and regain access to a system you cannot log in to.
You will be able to
- Start, stop, enable, disable and mask services, and check why one failed.
- Read and set the default target, switch targets on a running system, and boot into a chosen target once.
- Change kernel parameters temporarily at boot and permanently with grubby.
- Reset a forgotten root password by interrupting the boot process, and restore SELinux labels afterwards.
Lessons
- 01Controlling services with systemctlStart, stop, restart and reload services, decide what starts at boot, and find out why a service failed.
systemctlsystemctl statussystemctl enable --nowsystemctl masksystemctl --failedsystemctl edit0/5 exercises - 02Targets, the default target and power controlUnderstand what a target is, set the default one, switch on a running system, and shut down or reboot safely.
systemctl get-defaultsystemctl set-defaultsystemctl isolatesystemctl list-dependenciesrebootpoweroff0/5 exercises - 03The boot process and the GRUB boot loaderFollow a boot from firmware to target, boot once into a chosen target from the GRUB menu, and change boot loader settings permanently.
grubbygrub2-mkconfig/etc/default/grub/proc/cmdlinegrub2-setpasswordsystemd.unit=0/5 exercises - 04Recovering root access: rd.break and SELinux relabelInterrupt the boot before the real system starts, set a new root password, and make sure SELinux still lets you log in.
rd.breakmount -o remount,rw /sysrootchroot /sysrootpasswdtouch /.autorelabelrestorecon0/4 exercises