This tutorial guides you through recovering your forgotten Fedora root password using a Fedora Live USB. This method is useful if the single-user mode approach fails.
Step 1: Prepare a Bootable Fedora Live USB
Download the Fedora Workstation Live image from the official Fedora website. Create a bootable USB drive using a tool like Fedora Media Writer or Ventoy.
Step 2: Boot from the Live USB
Insert the USB drive and boot your system from it. You may need to adjust your BIOS/UEFI settings to prioritize USB boot.
Step 3: Locate and Mount Your System's Root Partition
Open a terminal in the Live environment. Use lsblk
or fdisk -l
to identify your Fedora root partition (often marked with a filesystem type like ext4). Remember, the Live environment's root partition is separate from your installed system's root partition.
To find your installed system's root partition:
lsblk
to list all block devices. Identify partitions on your hard drive (e.g., /dev/sda1
, /dev/sda2
).$ lsblk
Example output (your partition will vary):
<code>NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 1.9G 1 loop loop1 7:1 0 7.6G 1 loop ├─live-rw 253:0 0 7.6G 0 dm / └─live-base 253:1 0 7.6G 1 dm loop2 7:2 0 32G 0 loop └─live-rw 253:0 0 7.6G 0 dm / sda 8:0 0 50G 0 disk ├─sda1 8:1 0 1M 0 part ├─sda2 8:2 0 1G 0 part └─sda3 8:3 0 49G 0 part sr0 11:0 1 2G 0 rom /run/initramfs/live zram0 252:0 0 7.7G 0 disk [SWAP]</code>
/dev/sda3
with your partition):$ sudo mkdir /mnt/myroot $ sudo mount /dev/sda3 /mnt/myroot
df -h
:$ df -h /mnt/myroot
$ cd /mnt/myroot $ ls
You should see directories like bin
, etc
, home
, usr
.
Step 4: Enter the Chroot Environment
Change root into your system:
$ sudo chroot /mnt/myroot
Step 5: Reset the Root Password
Reset the root password:
# passwd
Enter and confirm your new password.
Step 6: Unmount and Reboot
Exit the chroot environment and unmount the partition:
# exit $ sudo umount /mnt/myroot
Remove the Live USB and reboot your system.
Step 7: Log In with the New Password
Boot into Fedora and log in using your new root password.
This advanced method avoids single-user mode. Remember to exercise caution and back up important data before attempting these steps. If unsure, seek assistance from a Linux expert.
The above is the detailed content of Reset Root Password In Fedora 39 Using Live USB: A Practical Guide. For more information, please follow other related articles on the PHP Chinese website!