Service Management and Boot Troubleshooting Flashcards
How can the status of a service be viewed with ‘systemctl’?
■ systemctl status .
How are ‘systemd’ loaded units listed by type?
■ systemctl {–type=unittype}
■ systemctl list-units {–type=unittype}
How can loaded units for ‘systemd’ be listed?
■ systemctl {–type=unittype}
■ systemctl list-units
How can installed units for ‘systemd’ be listed?
■ systemctl list-unit-files {–type=unittype}
How can a service be prevented from starting?
■ By masking the configuration directories used in starting the service.
■ systemctl mask network - prevent network command usage
What is the difference between a disabled service vs. a masked service?
■ A disabled service will not be started automatically at boot or by other unit files, but can be started manually. A masked service can not be started manually or automatically.
What ‘systemd’ target supports multiple users, graphical and text-based logins?
■ graphical.target
■ systemctl isolate graphical.target
What ‘systemd’ target supports multiple users, text-based logins only?
■ multi-user.target
■ systemctl isolate multi-user.target
What ‘systemd’ target presents ‘sulogin’ prompt and basic system initialization?
■ rescue.target
■ systemctl isolate rescue.target
What ‘systemd’ target presents ‘sulogin’ prompt, initramfs pivot complete and system root mounted on / read-only?
■ emergency.target
■ systemctl isolate emergency.target
How is the default ‘systemd’ target set?
■ systemctl set-default {target}
How is the default ‘systemd’ target listed?
■ systemctl get-default {target}
What steps are required to change the boot time ‘systemd’ target?
- Interrupt the boot loader menu countdown by pressing any key
- Move the cursor to the entry to be started
- Press ‘e’ to edit the current entry
- Move to the line that starts with ‘linux16’
- Append ‘systemd.unit={desired.target}’
- Press Ctrl+x to boot with these changes.
What line must be edited with the ‘systemd’ target and how?
■ The line that starts with ‘linux16’
■ ‘systemd.unit={desired.target}’ must be appended to the end
How are the different available of ‘systemd’ listed?
■ systemctl -t help
What steps are required to change a lost root password?
- Interrupt the boot loader menu countdown by pressing any key
- Move the cursor to the entry to be started
- Press ‘e’ to edit the current entry
- Move to the line that starts with ‘linux16’
- Append ‘rd.break’
- Remount the file system as read-write
mount -oremount,rw /sysroot - Switch to chroot jail, where /sysroot is seen as root of the system tree
chroot /sysroot - Change the root password
passwd root - Set file system for relabeling
touch /.autorelabel - Exit twice, the reboot
How is ‘journald’ logging made persistent?
- Make a directory to hold persistent logs
]# mkdir -p -m2775 /var/log/journal - Change group ownership to ‘systemd-journal’
]# chown :systemd-journal /var/log/journal - Tell ‘systemd-journald’ to reopen its logs
]# killall -USR1 systemd-journald
How can logs from previous system boots be read?
■ journalctl -b-[number] -p [message level]
■ -b = boot logs
■ -[number] = boot ID
■ -p = message priority level
■ [message level] = (0)emerg,(1)alert,(2)crit,(3)err,(4)warning,(5)notice,(6)info,(7)debug
■ EX: journalctl -b-1 -p err
What’s the difference between ‘emergency.target’ and ‘rescue.target’?
■ emergency.target keeps the root file system mounted read-only
■ rescue.target waits for ‘sysinit.target’ to complete first so that more of a system will be initialized
How is the ‘early debug shell’ enabled?
■ systemctl enable debug-shell.service
■ Starts a root shell on TTY9 (Ctrl+Alt+F9). Root is automatically logged in; remember to disable it.
What must be done after editing /etc/fstab?
■ Reload the systemd daemon
■ systemctl daemon-reload
How is the emergency target used to fix boot problems?
- Interrupt the boot loader menu countdown by pressing any key
- Move the cursor to the entry to be started
- Press ‘e’ to edit the current entry
- Move to the line that starts with ‘linux16’
- Append ‘emergency’
- Press ‘Crtl+x’ to boot with these changes
- Enter root password
- Check if / file system is mounted read-only
- Diagnose problem from here
What grub2 file should not be edited manually by administrators? What tool is used to edit it?
■ /boot/grub2/grub.cfg
■ grub2-mkconfig
Where can the grub menu timeout and other options be set before running grub2-mkconfig?
■ /etc/default/grub
What command reinstalls the boot loader?
■ grub2-install