Author Topic: Forgot root password [SOLVED]  (Read 1698 times)

Offline Tony

  • Hero Member
  • *****
  • Posts: 1744
  • Reason_able ;)
Forgot root password [SOLVED]
« on: October 12, 2012, 05:39:33 AM »
I've just booted a Computer I had returned a few weeks ago, and I can remember the Login Pass, however I've forgotten the root password.
Have looked in all my notebooks, but no luck.
Searched the Forum, http://www.pclinuxos.com/forum/index.php/topic,73444.0.html
Code: [Select]
$ mkdir /mnt/system
$ mount /dev/sda1 /mnt/system

Now, do a chroot and reset the password:

$ chroot /mnt/system
$ passwd

Which didn't work, even said, "Have to be root to do that"

It's my computer: PCLinuxOS KDE 4.6.5 2012.02.
Pentium 4 Desktop, RAM 768MB's shared with Graphics, that's about it, 40 GB HDD. Perfect 'offline machine.'
Although it would happily go online, but sorry I digress.  :-[

It isn't online, and probably wont be; I set it up in my bedroom to listen to music, and watch the odd video in bed  ;) The nights can be cold and lonely  ::)

Daylight savings started earlier in the week so after I set it all up with all the bits and pieces, Monitor, keyboard, Mouse, etc., got the screen resolution setup,etc. thought, "Better put the time forward an hour" which was when I realised to my horror I don't have the root password.  :'(   :'(  

I've looked everywhere, my son who I had lent it to has no idea either as I rang him (Damn teenagers).

Is there a way around this ? Please ? Anyone  ???
« Last Edit: October 13, 2012, 04:05:11 AM by Tony »
*PCLOS 3.2.18-pclos2 - MiniMe 2013.x - KDE 4.10.1 - Intel(R) Pentium(R) 4 CPU 3.00GHz - 1GiB DIMM DDR 533 MHz RAM  = SHABANG ! ;) *Software Updates

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1628
  • UK MLU
Re: Forgot root password
« Reply #1 on: October 12, 2012, 06:34:33 AM »
Boot into safemode

  • enter passwd
  • enter the new password
  • confirm the new password
  • enter reboot

Regards


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11595
  • ----IOFLU----
Re: Forgot root password
« Reply #2 on: October 12, 2012, 06:41:15 AM »
I've just booted a Computer I had returned a few weeks ago, and I can remember the Login Pass, however I've forgotten the root password.
Have looked in all my notebooks, but no luck.
Searched the Forum, http://www.pclinuxos.com/forum/index.php/topic,73444.0.html
Code: [Select]
$ mkdir /mnt/system
$ mount /dev/sda1 /mnt/system

Now, do a chroot and reset the password:

$ chroot /mnt/system
$ passwd

Which didn't work, even said, "Have to be root to do that"

It's my computer: PCLinuxOS KDE 4.6.5 2012.02.
Pentium 4 Desktop, RAM 768MB's shared with Graphics, that's about it, 40 GB HDD. Perfect 'offline machine.'
Although it would happily go online, but sorry I digress.  :-[

It isn't online, and probably wont be; I set it up in my bedroom to listen to music, and watch the odd video in bed  ;) The nights can be cold and lonely  ::)

Daylight savings started earlier in the week so after I set it all up with all the bits and pieces, Monitor, keyboard, Mouse, etc., got the screen resolution setup,etc. thought, "Better put the time forward an hour" which was when I realised to my horror I don't have the root password.  :'(   :'(  

I've looked everywhere, my son who I had lent it to has no idea either as I rang him (Damn teenagers).

Is there a way around this ? Please ? Anyone  ???


Do the same thing you already did, but first su to root on the liveCD, where you know the password is root. Then do the chroot, and enter the passwd command, press the Enter key, then type the new root password at the prompt, once more press the Enter key, then repeat the new root password again to verify it, and finally  press the Enter key again.

After being returned to the root prompt, enter the exit command, to leave the chroot environment, press the Enter key, then reboot. The new root password should now work on the installed system.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Tony

  • Hero Member
  • *****
  • Posts: 1744
  • Reason_able ;)
Re: Forgot root password
« Reply #3 on: October 12, 2012, 10:57:08 AM »
OK. Using the PCLinuxOS MiniMe 2012.02 Live CD, which is same as on the installed System.

Code: [Select]
$ mkdir /mnt/system
$ mount /dev/sda1 /mnt/system

Now, do a chroot and reset the password:

$ chroot /mnt/system
$ passwd

I tried the first 3 of 4 commands in the code box: ( Using Live CD )

system didn't want to create /mnt/system   -  No such file or directory.
mount: mount point doesn't exist
chroot: cannot change root directory to /mnt/system: no suchfile or directory. (obviously  ;) )
Gave up here.
 
I went through the latter two commands:  (wrote on scrap of paper, so may be a bit rough)
su
Password:
(root@localhost ~)#chroot /mnt/system
chroot:cannot change root directory to  /mnt/system: No such file or directory
(root@localhost ~)#passwd
changing password for user root
New Password: xxxx
Bad too short
passwd: all authentications updated successfully
exit      > Enter

I reboot, take out liveCD, Enter to continue.

Login, let everything 'settle', try opening "Configure your Computer", password isn't accepted.

Will leave it go till tomorrow, (  :D ) thinking it may be best to install LXDE .06, or PCLinuxOS MiniMe 2012.02  :)

The System works fine, it's obviously not good to be unable to use the root password though.
Plus I don't know what my Son may have done to the system over the months he used it.

Installing the latest PCLinuxOS KDE 4.8.3 2012.08 could be problematic.

Installing MiniMe can be problematic also with Dependencies...

Always so much fun, unbelievable  ;)
« Last Edit: October 12, 2012, 11:03:15 AM by Tony »
*PCLOS 3.2.18-pclos2 - MiniMe 2013.x - KDE 4.10.1 - Intel(R) Pentium(R) 4 CPU 3.00GHz - 1GiB DIMM DDR 533 MHz RAM  = SHABANG ! ;) *Software Updates

Offline Tony

  • Hero Member
  • *****
  • Posts: 1744
  • Reason_able ;)
Re: Forgot root password
« Reply #4 on: October 12, 2012, 12:22:17 PM »
Boot into safemode

  • enter passwd
  • enter the new password
  • confirm the new password
  • enter reboot

Regards
I tried SafeMode 7272andy, thanyou for your help.

I ended up at an 'odd' prompt, some letters and numbers; tried typing 'passwd', but nothing actuated.
However typing "poweroff" shut down the Comp.  ???
*PCLOS 3.2.18-pclos2 - MiniMe 2013.x - KDE 4.10.1 - Intel(R) Pentium(R) 4 CPU 3.00GHz - 1GiB DIMM DDR 533 MHz RAM  = SHABANG ! ;) *Software Updates

Online Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6390
  • I'm going South
Re: Forgot root password
« Reply #5 on: October 12, 2012, 12:31:04 PM »
OK. Using the PCLinuxOS MiniMe 2012.02 Live CD, which is same as on the installed System.

Code: [Select]
$ mkdir /mnt/system
$ mount /dev/sda1 /mnt/system

Now, do a chroot and reset the password:

$ chroot /mnt/system
$ passwd

I tried the first 3 of 4 commands in the code box: ( Using Live CD )

system didn't want to create /mnt/system   -  No such file or directory.

The reason is simple. Not so long ago all systems came with a default /mnt directory. Not so anymore. On live CDs (and live USBs) created from newer isos /mnt may be missing, so you'd have to use the -p option with mkdir to create not only the subdirectory system but also its paren't directory /mnt:
Code: [Select]
mkdir  -p  /mnt/system(Or alternatively you could do it in two steps: first create /mnt and only after that /mnt/system.)

Quote
mount: mount point doesn't exist

Obviously not, as the command given failed to create it.

« Last Edit: October 12, 2012, 01:17:07 PM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Online Vorteggs

  • Hero Member
  • *****
  • Posts: 2419
Re: Forgot root password
« Reply #6 on: October 12, 2012, 12:49:45 PM »
Now I am trying this in LiveCD session.
Created /mnt/system:
Quote
[guest@localhost ~]$ su
Password:
[root@localhost guest]# mkdir /mnt/system
mkdir: cannot create directory `/mnt/system': No such file or directory
[root@localhost guest]# mkdir /mnt
[root@localhost guest]# mkdir /mnt/system
[root@localhost guest]# cd /
[root@localhost /]# ls
bin@      dev/   initrd/  mnt/             opt@   sbin@  sys/    usr@
boot@     etc@   lib@     Module.symvers@  proc/  srv@   tmp/    var@
changes/  home@  media/   null@            root@  swap@  union/
[root@localhost /]# cd mnt
[root@localhost mnt]# ls
system/
[root@localhost mnt]#

Online Vorteggs

  • Hero Member
  • *****
  • Posts: 2419
Re: Forgot root password
« Reply #7 on: October 12, 2012, 12:56:21 PM »
Hope I changed the root password of my installed PCLOS FM:
Quote
[root@localhost mnt]# mount /dev/sda1 /mnt/system
[root@localhost mnt]# chroot /mnt/system
[root@localhost /]# passwd
Changing password for user root.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
Sorry, passwords do not match.
New password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost /]#
Going now to it to see...
Cross fingers ;D
« Last Edit: October 12, 2012, 01:12:06 PM by Vortеx »

Online Vorteggs

  • Hero Member
  • *****
  • Posts: 2419
Re: Forgot root password
« Reply #8 on: October 12, 2012, 01:04:25 PM »
Posting now from the root account with the new password that I changed from the LiveCD session 8) 8) 8)
Success!
I 'm happy ;D :D ;)

Going now to change my root password to the previous one.
Quote
[root@thenudiebar ~]# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@thenudiebar ~]#
Success again ;)
« Last Edit: October 12, 2012, 01:08:22 PM by Vortеx »

Online Vorteggs

  • Hero Member
  • *****
  • Posts: 2419
Re: Forgot root password
« Reply #9 on: October 12, 2012, 01:07:09 PM »
But please have in mind that my system partition here is /dev/sda1 and you should type your own system partition.

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 10691
  • MLUs Forever!
Re: Forgot root password
« Reply #10 on: October 12, 2012, 03:46:02 PM »
OK. Using the PCLinuxOS MiniMe 2012.02 Live CD, which is same as on the installed System.

Code: [Select]
$ mkdir /mnt/system
$ mount /dev/sda1 /mnt/system

Now, do a chroot and reset the password:

$ chroot /mnt/system
$ passwd

I tried the first 3 of 4 commands in the code box: ( Using Live CD )



You did so as user not root  :(

« Last Edit: October 12, 2012, 03:48:08 PM by Just17 »
MLUs rule the roost!

Linux XPS 3.4.38-pclos1.bfs  64 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline Tony

  • Hero Member
  • *****
  • Posts: 1744
  • Reason_able ;)
Re: Forgot root password
« Reply #11 on: October 12, 2012, 10:38:17 PM »
Thankyou, Bald Brick, (Love your photo, nothing weird, just a calming presence, honestly  8))  
Advice Noted.
Vortex
; you really "crash tested" the procedure, thanks so much !
I will try again, you know I set this Comp up for Son, this year maybe 3 months ago, the login Password came easy, as is name of the cat  ;D, however I asked what he'd (son) wanted for root, and I'm the type of person who writes everything down, alas cannot find the date, or info. Bottom !  >:(

We do have to measure the time taken to solve a problem, and a new install.

Then again it's a 'bedtime companion', plus had a sinus OPeration (nasty) three weeks back, occassionally need to zombie out in bed, lovely to watch some Music, or listen, even a slideshow, which all happen wonderfully.
Just can't change the clock for Daylight savings, lol, or any 'root required action.'
*MiniMe, is it one of "those moments" ? Dependencies.

I've noted this further info, and will try again, thanks guy's.

OK. Using the PCLinuxOS MiniMe 2012.02 Live CD, which is same as on the installed System.

Code: [Select]
$ mkdir /mnt/system
$ mount /dev/sda1 /mnt/system

Now, do a chroot and reset the password:

$ chroot /mnt/system
$ passwd

I tried the first 3 of 4 commands in the code box: ( Using Live CD )




You did so as user not root
:(

Nope, as O-P said, and we all know, LiveCD passes;  'guest' & 'root'. Is in the body of my posts Juzza, su > password.  ;)
Please excuse, Just 17.

Thankyou all as always for your support. I'll nail this.
« Last Edit: October 12, 2012, 10:40:22 PM by Tony »
*PCLOS 3.2.18-pclos2 - MiniMe 2013.x - KDE 4.10.1 - Intel(R) Pentium(R) 4 CPU 3.00GHz - 1GiB DIMM DDR 533 MHz RAM  = SHABANG ! ;) *Software Updates

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1628
  • UK MLU
Re: Forgot root password
« Reply #12 on: October 13, 2012, 03:25:50 AM »
Boot into safemode

  • enter passwd
  • enter the new password
  • confirm the new password
  • enter reboot

Regards
I tried SafeMode 7272andy, thanyou for your help.


I ended up at an 'odd' prompt, some letters and numbers; tried typing 'passwd', but nothing actuated.
However typing "poweroff" shut down the Comp.  ???

You should have ended up at a root level prompt in single user mode (all my installations do), looking like
Code: [Select]
Telling init to go to single user mode
INIT: Going to single user
sh-4.1#

Any commands issued here are root level. I just tried passwd on my machines and all changed root password.

Good luck whichever way you jump

Regards


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline Tony

  • Hero Member
  • *****
  • Posts: 1744
  • Reason_able ;)
Re: Forgot root password
« Reply #13 on: October 13, 2012, 03:41:34 AM »
Thanks Vortеx, done !

You doing it as a "Dry Run" which takes time, was the trick !
Thanks for taking that time, awesome, you saved me a lot of time.


For others in Future, as Bald Brick pointed out, and Vortex illustrated:

Code: [Select]
[root@localhost guest]# mkdir /mnt/system Doesn't work.
You have to:
Quote
mkdir: cannot create directory `/mnt/system': No such file or directory
[root@localhost guest]# mkdir /mnt
[root@localhost guest]# mkdir /mnt/system
Check that Directory was Created:
Code: [Select]
[root@localhost guest]# cd /
[root@localhost /]# ls
Quote
bin@      dev/   initrd/  mnt/             opt@   sbin@  sys/    usr@
boot@     etc@   lib@     Module.symvers@  proc/  srv@   tmp/    var@
changes/  home@  media/   null@            root@  swap@  union/

Code: [Select]
[root@localhost /]# cd mnt
[root@localhost mnt]# ls
system/
[root@localhost mnt]#

Then Mount created Directory `/mnt/system' -- ; presuming of course sda1 is your root directory.
By a simple command, "df",  used to get DiskSpace, I determined and find that root was indeed: sda1
Continue then to creating the New root password.
Code: [Select]
[root@localhost mnt]# mount /dev/sda1 /mnt/system
[root@localhost mnt]# chroot /mnt/system
[root@localhost /]# passwd
Changing password for user root.

I may have made a booboo writing that out but that's it basically.

Proud to learn from great people, and be part of such a great community: PCLinuxOS
« Last Edit: October 13, 2012, 04:13:22 AM by Tony »
*PCLOS 3.2.18-pclos2 - MiniMe 2013.x - KDE 4.10.1 - Intel(R) Pentium(R) 4 CPU 3.00GHz - 1GiB DIMM DDR 533 MHz RAM  = SHABANG ! ;) *Software Updates

Offline Tony

  • Hero Member
  • *****
  • Posts: 1744
  • Reason_able ;)
Re: Forgot root password
« Reply #14 on: October 13, 2012, 03:57:46 AM »
Boot into safemode

  • enter passwd
  • enter the new password
  • confirm the new password
  • enter reboot

Regards

I tried SafeMode 7272andy, thanyou for your help.


I ended up at an 'odd' prompt, some letters and numbers; tried typing 'passwd', but nothing actuated.
However typing "poweroff" shut down the Comp.  ???


You should have ended up at a root level prompt in single user mode (all my installations do), looking like
Code: [Select]
Telling init to go to single user mode
INIT: Going to single user
sh-4.1#

Any commands issued here are root level. I just tried passwd on my machines and all changed root password.

Good luck whichever way you jump

Regards

Aha ! Thankyou greatly 7272andy.

I did get to sh-4.1#, but had no idea were I was, Dang !

It's all good stuff to me and very welcome help.  All the best 7272andy !
« Last Edit: October 13, 2012, 04:19:35 AM by Tony »
*PCLOS 3.2.18-pclos2 - MiniMe 2013.x - KDE 4.10.1 - Intel(R) Pentium(R) 4 CPU 3.00GHz - 1GiB DIMM DDR 533 MHz RAM  = SHABANG ! ;) *Software Updates