# RH342 Flashcards Quick Q&A format. Cover the answer column to test yourself. ## Logs | Question | Answer | |----------|--------| | View current boot logs | `journalctl -b` | | View logs for httpd service | `journalctl -u httpd` | | Follow logs live | `journalctl -f` | | View kernel messages | `journalctl -k` or `dmesg` | | Search SELinux denials | `ausearch -m avc -ts today` | | Enable persistent journal | `mkdir /var/log/journal`, set `Storage=persistent` | | Security log location | `/var/log/secure` | | General syslog location | `/var/log/messages` | ## Boot/GRUB | Question | Answer | |----------|--------| | Show default kernel | `grubby --default-kernel` | | Set default kernel | `grubby --set-default /boot/vmlinuz-xxx` | | List all boot entries | `grubby --info=ALL` | | Add kernel argument | `grubby --update-kernel=ALL --args="xxx"` | | GRUB config (BIOS) | `/boot/grub2/grub.cfg` | | GRUB config (UEFI) | `/boot/efi/EFI/redhat/grub.cfg` | | Regenerate GRUB (BIOS) | `grub2-mkconfig -o /boot/grub2/grub.cfg` | | Boot to rescue mode | `systemd.unit=rescue.target` | | Break to initramfs | `rd.break` | | List UEFI boot entries | `efibootmgr` | ## Hardware | Question | Answer | |----------|--------| | CPU info | `lscpu` | | Memory info | `dmidecode -t memory` | | Kernel messages | `dmesg -T` | | PCI devices | `lspci` | | USB devices | `lsusb` | | SCSI/storage devices | `lsscsi` | | Hardware error summary | `ras-mc-ctl --summary` | ## Storage | Question | Answer | |----------|--------| | List LVs | `lvs` | | List VGs | `vgs` | | List PVs | `pvs` | | Extend LV by 5G | `lvextend -L +5G /dev/vg/lv` | | Repair XFS | `xfs_repair /dev/xxx` (unmount first) | | List block devices | `lsblk -f` | | Check disk scheduler | `cat /sys/block/sda/queue/scheduler` | | Device mapper list | `dmsetup ls` | | Wipe disk signatures | `wipefs --all /dev/xxx` | | Create Stratis pool | `stratis pool create name /dev/xxx` | ## Network | Question | Answer | |----------|--------| | List connections | `nmcli connection show` | | List devices | `nmcli device status` | | Bring up connection | `nmcli connection up "name"` | | Show listening ports | `ss -tuln` | | Show ports with processes | `ss -tunlp` | | List firewall rules | `firewall-cmd --list-all` | | Add firewall service | `firewall-cmd --add-service=http --permanent` | | Reload firewall | `firewall-cmd --reload` | | Scan network for hosts | `nmap -sn 192.168.1.0/24` | | Show IP addresses | `ip addr show` | ## SELinux | Question | Answer | |----------|--------| | Check mode | `getenforce` | | Set permissive (temp) | `setenforce 0` | | Set enforcing (temp) | `setenforce 1` | | Search AVC denials | `ausearch -m avc -ts recent` | | View file context | `ls -Z /path` | | Add file context rule | `semanage fcontext -a -t type_t '/path(/.*)?'` | | Apply contexts | `restorecon -Rv /path` | | Add port label | `semanage port -a -t type_t -p tcp port` | | Set boolean (persistent) | `setsebool -P boolname on` | | List booleans | `getsebool -a` | | Analyze denial | `sealert -a /var/log/audit/audit.log` | | Force relabel | `touch /.autorelabel && reboot` | | Web content type | `httpd_sys_content_t` | ## Kdump | Question | Answer | |----------|--------| | Check kdump status | `kdumpctl status` | | Show reserved memory | `kdumpctl showmem` | | Crash dump location | `/var/crash/` | | Kdump config file | `/etc/kdump.conf` | | Kernel param for kdump | `crashkernel=auto` | | Enable SysRq | `echo 1 > /proc/sys/kernel/sysrq` | | Trigger test crash | `echo c > /proc/sysrq-trigger` | | Panic on OOM | `vm.panic_on_oom=1` in sysctl.conf | | Analyze vmcore | `crash vmlinux vmcore` | | Quick crash info file | `vmcore-dmesg.txt` | ## Common File Paths | What | Path | |------|------| | GRUB defaults | `/etc/default/grub` | | Kdump config | `/etc/kdump.conf` | | SELinux config | `/etc/selinux/config` | | rsyslog config | `/etc/rsyslog.conf` | | Journal config | `/etc/systemd/journald.conf` | | Audit log | `/var/log/audit/audit.log` | | Crash dumps | `/var/crash/` | | Persistent journal | `/var/log/journal/` | ## Troubleshooting Checklist | Issue | First Commands | |-------|----------------| | Service won't start | `systemctl status svc`, `journalctl -u svc` | | SELinux denial | `ausearch -m avc -ts recent`, `ls -Z` | | Boot failure | Boot previous kernel, `grubby --info=ALL` | | Network unreachable | `ip addr`, `ping gateway`, `firewall-cmd --list-all` | | Disk full | `df -h`, `df -i`, `du -sh /*` | | Permission denied | Check `ls -l`, then `ls -Z` for SELinux | | Kernel crash | Check `/var/crash/`, analyze `vmcore-dmesg.txt` |