الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

معمل 18.1RHCSA 10, الفصل 18

Break and repair the boot

المستوى
صعب
45 دقيقة
الأجهزة
server1
الحالة
لم يبدأ

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

الهدف

Practice the three repairs that matter most: a lost root password, a broken fstab, and a damaged initramfs.

قبل أن تبدأ

  • Take a VM snapshot of server1 first. You need console access (not SSH).
  • You need the file system /data from lab 14.1 (or any extra fstab line you can break).

المهام

  1. Reset the root password to redhat without knowing the old one.
  2. Add a wrong line to /etc/fstab (for example a mount of a UUID that does not exist, without nofail) and reboot. Repair the system from emergency mode so it boots normally.
  3. Boot into rescue mode once with a kernel argument, check which units run, and continue to the normal target.
  4. Make a backup of the initramfs of the running kernel, delete the original, and rebuild it with dracut. Check that the system still boots.

تحقّق من عملك

su - root
findmnt --verify
lsinitrd | head -5
ls -l /boot/initramfs-$(uname -r).img
  • You can log in as root with redhat (and SELinux is enforcing: getenforce).
  • The system boots to the default target without errors; findmnt --verify is clean.
  • The initramfs exists again and the system boots.

تلميحات

اعرض التلميحات

الحل

اعرض الحل
  1. Root password (at the GRUB menu: e, add rd.break to the linux line, Ctrl+X).
    mount -o remount,rw /sysroot
    chroot /sysroot
    echo redhat | passwd --stdin root
    touch /.autorelabel
    exit
    exit
  2. Break and fix fstab.
    echo "UUID=00000000-1111-2222-3333-444444444444 /broken xfs defaults 0 0" >> /etc/fstab
    systemctl reboot

    In emergency mode (log in as root):

    mount -o remount,rw /
    sed -i '/\/broken/d' /etc/fstab
    systemctl daemon-reload
    mount -a
    systemctl reboot
  3. Rescue mode (at GRUB add systemd.unit=rescue.target).
    systemctl list-units -t service --state=running
    systemctl default
  4. Rebuild the initramfs.
    cp /boot/initramfs-$(uname -r).img /root/initramfs.bak
    rm /boot/initramfs-$(uname -r).img
    dracut -f
    lsinitrd | head -5
    systemctl reboot

ملاحظاتي

لا توجد ملاحظات بعد.

دروس هذا المعمل

الأوامر في هذا المعمل