# Lost root Password

## neutcomp

Hello,

I really dont know how it happend but my root password is or changed or the account is crashed.

Is there a way to recover or set a new root password?

Thanxx

Bjorn   :Cool: 

----------

## adaptr

Reboot the system.

At the boot: prompt enter:

```
gentoo single
```

Substitute the name of your kernel if it's not "gentoo".

This puts you in a shell where you can change the password.

If you can't get to the bootloader prompt you will have to boot with the LiveCD and reset the password from there.

To do this insert the LiveCD and reboot, then at the boot: prompt enter

```
gentoo single root=/dev/hdxy
```

Where hdxy is the location of your root partition.

This will latch onto your Gentoo with the kernel form the LiveCD, and you can again reset the password.

----------

## BlinkEye

yes, that is (unfortunately) very easy - you just reminded me of a thread i still MUST start, thanks.

add the argument "single" to the kernel boot parameter and you'll enter single mode where you may reset your root password with 

```
passwd
```

in grub you may edit with the key 'e' the kernel line and with lilo you simply add "single" after selecting your desired kernel, for example

```
linux-2.6.8-gentoo single
```

another solution is booting your system with a livecd, mount your root partition, chroot into the new environment and typing "passwd".

```
mount /dev/hda1 /mnt/gentoo

chroot /mnt/gentoo

env-update

source /etc/profile

passwd

exit

umount /mnt/gentoo

reboot

```

----------

## gnuageux

And yet another would be booting using the livecd, chrooting in and removing roots pw from /etc/shadow. Then login as root and change the pw.

----------

## neutcomp

Thanxx the first option was allready working for me!

Great, now I can install apache, php and mysql.

Does anybody have a good resource? Something from a step by step tutorial orsomething?

Did you know that the forum, if you search for

lost AND root AND password

there occours an error!   :Shocked: 

Cya

Bjorn   :Cool: 

----------

## Rustylinux

Hey,

Okay so I reset my root password a little while ago on my other gentoo box and forgot what I changed it to.  Is there anyway to reset the root password or recover it without doing a full re-install?

Also that box has 3 diffrent kernel setups on it for testing purposes if I use an older kernel would it still have the pervious root password ?

----------

## occ

boot with a live-cd , chroot your hard-drive installation, change the password....

----------

## valkyrite

or if you are using grub,

at the grub prompt, append 1 to the line 

change the following line 

kernel /boot/bzImage root=/dev/sda3 vga=0x31B video=vesafb:mtrr:3,ywrap

to

kernel /boot/bzImage root=/dev/sda3 vga=0x31B video=vesafb:mtrr:3,ywrap 1

It will boot in runlevel 1

root would already be logged in, you can now change your password.

----------

## d2_racing

 *occ wrote:*   

> boot with a live-cd , chroot your hard-drive installation, change the password....

 

I love the Gentoo-LiveCD for that  :Smile: 

----------

## nixnut

merged above four posts here.

----------

## Rustylinux

Hey,

Okay I have tried all the diffrent options that have been listed but are still having problems reseting this root password.

The system is a duel boot system with windows on 2 sata drives.  Sda is my windows drive and Sdb is my gentoo drive.  The system also has 2 seperate kernel configurations for testing purposes.

I have booted up with the LiveCD and tried Chrooting the drive but it gave an error stating it couldn't root into that directory.  I have also tried all the examples in this thread but still seem to be unable to boot into either kernel configuration.

Whenever I do reset the root password and reset the system then boot into the kernel it doesn't take.

The only example I couldn't get to work was the one with putting 1 at the end of your grub loading string to boot it into level 1.  This did not work.

My kernel is also a genkernel if this helps any.

I am unsure as what I am doing wrong any help would be greatly appricated.Last edited by Rustylinux on Wed Mar 28, 2007 2:33 am; edited 1 time in total

----------

## deface

 *Rustylinux wrote:*   

> Hey,
> 
> Okay I have tried all the diffrent options that have been listed but are still having problems reseting this root password.
> 
> The system is a duel boot system with windows on 2 sata drives.  Sda is my windows drive and Sdb is my gentoo drive.  The system also has 2 seperate kernel configurations for testing purposes.
> ...

 

You are not chrooting to the correct device - 

it may be /dev/sdb3 ?

----------

## Rustylinux

 *deface wrote:*   

>  *Rustylinux wrote:*   Hey,
> 
> Okay I have tried all the diffrent options that have been listed but are still having problems reseting this root password.
> 
> The system is a duel boot system with windows on 2 sata drives.  Sda is my windows drive and Sdb is my gentoo drive.  The system also has 2 seperate kernel configurations for testing purposes.
> ...

 

Hey,

It was /dev/sdb3

I got it working shortly after my post.  Thanks for all your help !

----------

## deface

Awesome, please mark as SOLVED

----------

## AngelKnight

...and overlooked one:

If you have access to grub, and you're reasonably sure the userland is okay, another way is to pass "init=/bin/bash" as a kernel parameter.  This way, it starts "/bin/bash" as process 1.  If you need to alter files, you must of course make sure that the partition where those files live is mounted read-write.

It has one additional problem though: most terminal controls are nonfunctioning, so ctrl-C won't send a SIGINT.  Don't run "ping" without a maximum pings count!

----------

## berns

 *Quote:*   

> Whenever I do reset the root password and reset the system then boot into the kernel it doesn't take. 

 

I'm having very similar difficulties - I set the root password during my installation (amd64) and upon rebooting discovered that the password somehow didnt 'stick', so now I'm stuck with an unknown root password.  :Sad:  Another user I created worked just fine, and the password was exactly what it was supposed to be.

I've tried chrooting in from a live cd, changing the password then rebooting, but again I have the problem where the password change doesnt seem to persist. Using 'single'  or '1' as a boat loader option still requires the root password during the boot sequence, so that doesn't help either.

Any ideas on how to solve this little dilema would be much appreciated. I'm also quite keen for any insight into why the change to the root password doesn't persist when changes to other user passwords do persist, even if such insight doesn't solve the problem   :Smile: 

----------

