Fix Initramfs file and forget root password solution

Source: Internet
Author: User

One, repair Initramfs files (take CentOS 6 as an example)

Friendship Tip : Do a snapshot before the experiment, avoid the wrong operation and cause the machine not to start normally

Introduction to Startup files:

Core file:/boot/vmlinuz-version-release

RAMDisk: Auxiliary pseudo-root system

CentOS 5:/boot/initrd-version-release.img

centos6,7:/boot/initramfs-version-release.img

Module file:/lib/modules/version-release


Experimental steps:

1. Delete the initramfs-version.img file under/boot

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/87/0A/wKiom1fSHrCglsvrAAASG-hc5ts280.png "title=" Qq20160908215059.png "alt=" Wkiom1fshrcglsvraaasg-hc5ts280.png "/>


2, restart the system, when you see the progress bar quickly press the ESC key to enter the boot menu interface

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/87/0A/wKiom1fSII-z10sMAAANi_G-9hA219.png "style=" float: none; "title=" Qq20160908215221.png "alt=" Wkiom1fsii-z10smaaani_g-9ha219.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/08/wKioL1fSIJDC6kGyAAFWPajduj8020.png "style=" float: none; "title=" Qq20160908215301.png "alt=" Wkiol1fsijdc6kgyaafwpajduj8020.png "/>


4, press the [Enter] key directly

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/0A/wKiom1fSIJCCC8k8AAAP0a0jcIs072.png "style=" float: none; "title=" Qq20160908215425.png "alt=" Wkiom1fsijccc8k8aaap0a0jcis072.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/0A/wKioL1fSOrTCjg4uAAAMHY3YK0M163.png "title=" Qq20160909122926.png "alt=" Wkiol1fsortcjg4uaaamhy3yk0m163.png "/>


5, press the TAB key, and when the cursor jumps to No, press the [Enter] key

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/87/08/wKioL1fSIJDQXViRAAAHTtrYOjY685.png "style=" float: none; "title=" Qq20160909082720.png "alt=" Wkiol1fsijdqxviraaahttryojy685.png "/>


6, select Continue

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/08/wKioL1fSIJHiG59YAAAhCAEMYuw219.png "style=" float: none; "title=" Qq20160908215719.png "alt=" Wkiol1fsijhig59yaaahcaemyuw219.png "/>


7, press [Enter]

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/09/wKioL1fSIVDB4IoiAAARtp_MQHQ154.png "style=" float: none; "title=" Qq20160908215748.png "alt=" Wkiol1fsivdb4ioiaaartp_mqhq154.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/87/09/wKioL1fSIVDD_uV_AAAGtWHq7KM667.png "style=" float: none; "title=" Qq20160908215812.png "alt=" Wkiol1fsivdd_uv_aaagtwhq7km667.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/0A/wKiom1fSIVCQiB77AAAEEjwkdBU559.png "style=" float: none; "title=" Qq20160908215910.png "alt=" Wkiom1fsivcqib77aaaeejwkdbu559.png "/>


8. Open the Shell interface and enter rescue mode

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/0A/wKioL1fSLcnyBANmAABYrE90PfM800.png "title=" Qq20160909113419.png "alt=" Wkiol1fslcnybanmaabyre90pfm800.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/0B/wKiom1fSJv_x4IGiAAAqTOUiMtI963.png "style=" float: none; "title=" Qq20160909110506.png "alt=" Wkiom1fsjv_x4igiaaaqtouimti963.png "/>


9, restart the system, and the familiar interface, to congratulate you, repair success

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/09/wKioL1fSIZOCk5WCAAAEJvebJJA579.png "style=" float: none; "title=" Qq20160908221159.png "alt=" Wkiol1fsizock5wcaaaejvebjja579.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/0A/wKiom1fSIZPxtia4AAAFvyhByj4236.png "style=" float: none; "title=" Qq20160909081150.png "alt=" Wkiom1fsizpxtia4aaafvyhbyj4236.png "/>


Second, the solution of forgetting root password

As long as you can enter and mount/, and then reset the root password, you can save back. This is because in the startup process, if the kernel is forced to enter Runleverl 1, the default is no need for a password to get a root shell to rescue

Operation Flow:

1. Reboot the system

2. After booting into the Grub menu, press ' E ' on the menu you want to enter to enter the detailed settings, move the cursor over the kernel and press ' a ' key to enter the editing interface, then the following interface will be processed:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/04/wKioL1fRaSKzUx5lAAAGc_n8xiE406.png "title=" Qq20160908213442.png "alt=" Wkiol1fraskzux5laaagc_n8xie406.png "/>


Description of the key:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/06/wKiom1fRaE3TUaJAAAAKdGIuWIg753.png "style=" float: none; "title=" Qq20160908210010.png "alt=" Wkiom1frae3tuajaaaakdgiuwig753.png "/>


The point is that the special font (plus 1, S, S, and single on the RHGB) press [Enter] to launch into one-user maintenance mode.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/06/wKiom1fRaTihviBXAAASZQ6ndr8183.png "title=" Qq20160908213407.png "alt=" Wkiom1fratihvibxaaaszq6ndr8183.png "/>


3, after entering the single-user maintenance mode, the system will give you a shell directly with root privileges, at which point you will be able to execute the "passwd" command to reset the root password. Then directly execute "Init 5" can be switched to the X window or "Init 3" into the pure character interface or direct "reboot".

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/87/06/wKiom1fRaXLxXjxfAAAUydZiHhs360.png "title=" Qq20160908211151.png "alt=" Wkiom1fraxlxxjxfaaauydzihhs360.png "/>


4, and return to the familiar interface:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/87/0A/wKioL1fSOjzxTXgYAAAFvyhByj4590.png "title=" Qq20160909081150.png "alt=" Wkiol1fsojzxtxgyaaafvyhbyj4590.png "/>


Fix Initramfs file and forget root password solution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.