- 重新掛載 /sysroot 成可讀可寫。
sh-5.2# mount -oremount,rw /sysroot
- chroot 工作目錄到 /sysroot,這個版本 initramfs 沒有 chroot 命令,所以借用 /sysroot 下的 /usr/sbin/chroot 命令。
sh-5.2# /sysroot/usr/sbin/chroot /sysroot
- 設定新的 root 密碼。
sh-5.2# passwd
-
因為在此情況下,SELinux 並沒有啟動,對所有檔案的變更,可能會造成檔案的 context 不正確,為確保開機時重新設定 SELinux context,必須在根目錄下產生隱藏檔 .autorelabel。
sh-5.2# touch /.autorelabel
- 退出 chroot
sh-5.2# exit
exit
sh-5.2#
- 退出系統,即重新開機。
sh-5.2# exit