Debian Mint Ubuntu Linux Server Password Forgotten Reset Password Solution Centos 7 8 Root Password Reset Recovery

This guide will work for most modern Linux versions like Centos RHEL 7, Debian, Mint, Ubuntu etc...

In Centos 7 the days of editing the "kernel" line and adding "single" are gone.  On top of that sometimes after a new install passwords do not work, maybe you forgot your password or for some other reason you need to break in or fix your system?  It could also be because you can't mount your root / or some other /etc/fstab error and many other errors.

Step 1.) Enter GRUB Boot Menu

Reboot your server/computer and keep hitting the "Left Shift" key until you get the GRUB screen like this.

Hit "e" to Edit on the screen below.

 

Step 2.) Edit GRUB Boot Options

Navigate to the first line that starts with "linux" as shown in red.

Move your cursor to the "ro" portion.

 

For CentOS/RHEL based do this:

Replace "ro" with "rw init=/sysroot/bin/sh" and boot as below and hit "Ctrl+X"

 

With CentOS you need to chroot to /sysroot, then you can work as you need and expect in the root of the mounted filesystem.

For Debian/Mint/Ubuntu based do this:

rw init=/bin/bash

*Be sure to erase the $vt_handoff or it will not boot into bash

The boot line should look like this below.

 

With Mint/Debian/Ubuntu it mounts the root filesystem as you'd expect.  With CentOS you need to chroot to /sysroot

 

Short Version:

1. Edit your grub settings and find the linux16 /vmlinuz and then the "ro" portion.

2. Replace "ro" with "rw init=/sysroot/bin/sh" and boot.

3. Type chroot /sysroot to enter your OS environment to fix/change things.


Long Version:

  1. 1.) On bootup edit the bootline by entering GRUB.
  2. Type e
  3. Find the line that says "linux16 /vmlinuz"
  4. Edit the part that says "ro" and change with "rw init=/sysroot/bin/sh"
  5. Hit "Ctrl-X"
  6. Upon bootup type "chroot /sysroot"
  7. password
  8. touch ./autorelabel
  9. exit
  10. reboot

 


Tags:

centos, password, resetin, editing, quot, kernel, adding, install, passwords, requirements, installer, bootup, edit, bootline, grub, linux, vmlinuz, ro, rw, init, sysroot, bin, sh, ctrl, chroot, autorelabel, reboot,

Latest Articles

  • Convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/413. convert-im6.q16: no images defined `pts-time.jpg' @ error/convert.c/ConvertImageCommand/3258. solution ImageMagick P
  • Apache PHP sending expires header solution cannot use cache with CDN
  • How to install virt-manager in Mint 22/Ubuntu 22
  • Infiniband Guide
  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format