Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Solved: Lost root password - no method works

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
20 posts • Page 1 of 1
Author
Message
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

Solved: Lost root password - no method works

  • Quote

Post by apeshansky » Wed Jul 14, 2010 5:33 pm

Hi,
I am trying to reset root password on Gentoo box (that I did not setup). I tried adding

Code: Select all

real_init=single
to GRUB kernel line, but then I get

Code: Select all

Give root password for maintenance (or type Control-D to continue):
I also tried adding
real_init=/bin/bash (/bin/sh is a symlink to /bin/bash), real_init=/bin/bb and real_init=/bin/busybox (these are the only shells I see in /bin), but this just is ignored and system starts with runlevel 3. I also tried init=, but this is simply ignored.
I tried to boot from LiveCD (minimal CD), but any attempt to

Code: Select all

chroot /mnt/gentoo /bin/bash
gives

Code: Select all

chroot: cannot run command '/bin/bash': No such file or directory
I suspect this is because the computer has (misconfigured) RAID and so cannot mount /root. When I tried to manually mount /dev/sda3, I get
mount: unknown filesystem type 'linux_raid_member'
message, also fdisk shows /dev/sd[ab] all different sizes and type 83 Linux instead of expected fd raid autodetect. When the system boots, I do see messages about RAID (with some complains about degradation; I'll address these once I can get root access).

As I see it, I have a couple of options left (unless some kind soul here will help me to get it boot single w/out root password :D ):
  • Try to mount RAID in live CD and edit /etc/passwd
  • Try to copy all custom PHP/shell script code and Postgres database (backups? What backups? :o ) using user-level account, reinstall Gentoo, recreate custom software
So any wise words?
Last edited by apeshansky on Wed Jul 28, 2010 1:17 am, edited 1 time in total.
Alex Peshansky
Top
xaviermiller
Bodhisattva
Bodhisattva
User avatar
Posts: 8738
Joined: Fri Jul 23, 2004 6:49 pm
Location: ~Brussels - Belgique
Contact:
Contact xaviermiller
Website

  • Quote

Post by xaviermiller » Wed Jul 14, 2010 5:54 pm

Hello,

Did you tried booting an other linux (liveCD/USB), then chroot that partition, then change the password ?
Kind regards,
Xavier Miller
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Wed Jul 14, 2010 6:07 pm

XavierMiller wrote:Hello,

Did you tried booting an other linux (liveCD/USB), then chroot that partition, then change the password ?
Yes, I did - same problem: cannot mount existing / with message
mount: unknown filesystem type 'linux_raid_member'

I also forgot to mention that there is no sudo on the box.
Alex Peshansky
Top
rh1
Guru
Guru
User avatar
Posts: 501
Joined: Sat Apr 10, 2010 8:22 am

  • Quote

Post by rh1 » Wed Jul 14, 2010 8:18 pm

What LiveCd did you try? Maybe it doesn't have raid support? How about using systemrescuecd which i'm sure has raid/lvm,ect.. support on it.
Top
jburns
Veteran
Veteran
Posts: 1255
Joined: Thu Jan 18, 2007 4:44 am
Location: Massachusetts USA

  • Quote

Post by jburns » Wed Jul 14, 2010 8:25 pm

Did you try adding the word single to the end of the kernel line instead of real_init=single.
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Wed Jul 14, 2010 8:27 pm

rh1 wrote:What LiveCd did you try? Maybe it doesn't have raid support? How about using systemrescuecd which i'm sure has raid/lvm,ect.. support on it.
I used Gentoo minimal install CD (and also full Ubuntu desktop CD). Both do have RAID support (I even did

Code: Select all

modprobe raid[01]
to ensure that modules load), but if I understand this correctly, need some information to mount RAID. (But what do I know - I am just a n00b, so I am asking my betters :oops: )

I do have user-level access to the box I need to get in, so if the information is there somewhere, I'll get it (provided it is world-readable).

Thanks.
Alex Peshansky
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Jul 14, 2010 8:28 pm

apeshansky,

Press e at the grub menu and add

Code: Select all

init=/bin/bash
to the kernel line, or change it to that if there is an init= statement.
Then boot.

It will come up with just the root filesystem, and the kernel and nothing else. You will be root.
run

Code: Select all

/bin/passwd
you need to use full pathnames as there is no environment set.

Shutdown with

Code: Select all

/sbin/shutdown -h now
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Wed Jul 14, 2010 8:29 pm

jburns wrote:Did you try adding the word single to the end of the kernel line instead of real_init=single.
Yes; it is ignored, and the box boots into runlevel 3.

Thanks.
Alex Peshansky
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Wed Jul 14, 2010 8:33 pm

NeddySeagoon wrote:apeshansky,

Press e at the grub menu and add

Code: Select all

init=/bin/bash
to the kernel line, or change it to that if there is an init= statement.
A-ha! There was

Code: Select all

init=linuxrc
(or some such - the box is at the different location) parameter, but I did not touch it, hoping additional init= down the line will override it. I'll try this.
Thank you.
Alex Peshansky
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Jul 14, 2010 8:38 pm

apeshansky,

Oh dear, you need to be at the console to do that, as no services are started.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Wed Jul 14, 2010 8:53 pm

NeddySeagoon wrote:apeshansky,

Oh dear, you need to be at the console to do that, as no services are started.
Yes, of course. I meant "as soon as I get my hands on this sucker :D "
Alex Peshansky
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Thu Jul 15, 2010 7:20 pm

NeddySeagoon wrote:apeshansky,

Press e at the grub menu and add

Code: Select all

init=/bin/bash
to the kernel line, or change it to that if there is an init= statement.
Then boot.

It will come up with just the root filesystem, and the kernel and nothing else. You will be root.
run

Code: Select all

/bin/passwd
you need to use full pathnames as there is no environment set.

Shutdown with

Code: Select all

/sbin/shutdown -h now
Well, what would you know: this did not work either. :(
Caveat: I was not at the console, but I believe the guy I talked to did everything properly. I had him to do it twice with written keypress-by-keypress instructions and me on the phone.

The system started at runlevel 3 with normal login prompt.

The original grub parameters are:

Code: Select all

kernel /kernel-genkernel-x86_64-2.6.17-gentoo-r8 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/evms/root doscsi doevms2
initrd /initramfs-genkernel-x86_64-2.6.17-gentoo-r8
Any ideas? Please? Pretty please with sugar on top? :P
Alex Peshansky
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jul 15, 2010 8:20 pm

apeshansky,

Ah, ok - passing parameters to the initrd is doomed to fail. It won't have bash.

Using init=/bin/bb or init=/bin/busybox will get you a root shell in the initrd.
What you can do from there is fairly limited. You should be able to mount root but its much harder.

Its easier to boot a CD that hass all the bits you need to miunt the root filesystem.
Boot normally then

Code: Select all

df -T
will tell you the filesystems in use, in case you have a rare one, like rieser4.

Oh ... you have root on evms. (real_root=/dev/evms/root), so its not simple at all
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Thu Jul 15, 2010 8:48 pm

NeddySeagoon wrote:apeshansky,

Ah, ok - passing parameters to the initrd is doomed to fail. It won't have bash.

Using init=/bin/bb or init=/bin/busybox will get you a root shell in the initrd.
Sorry, this did not work either (see my original message). Unless I need to add

Code: Select all

init=/bin/bb
to initrd line? I only tried parameters in kernel line.
NeddySeagoon wrote:What you can do from there is fairly limited. You should be able to mount root but its much harder.

Its easier to boot a CD that has all the bits you need to mount the root filesystem.
Boot normally then

Code: Select all

df -T
will tell you the filesystems in use, in case you have a rare one, like rieser4.

Oh ... you have root on evms. (real_root=/dev/evms/root), so its not simple at all
Don't I know that!
I think the only way short of reinstalling is to manually enter commands needed to mount root from liveCD prompt, but where are these commands? Some configuration file on the box?
I suspect that just adding "doscsi doevms2" to liveCD boot won't help - will it?
Alex Peshansky
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56077
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Thu Jul 15, 2010 9:08 pm

apeshansky,

It might. look at the help on the liveCD boot screen. I don't remember if the liveCDs ever supported evms.

It looks like they did/do. This wiki page looks useful.
Be careful you do not do any steps that are destructive to your data.

Googling for

Code: Select all

 evms +gentoo
finds other hits too. I have never used evms myself.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

Solved: Lost root password - no method works

  • Quote

Post by apeshansky » Wed Jul 28, 2010 1:25 am

NeddySeagoon wrote:apeshansky,

It might. look at the help on the liveCD boot screen. I don't remember if the liveCDs ever supported evms.

It looks like they did/do. This wiki page looks useful.
Be careful you do not do any steps that are destructive to your data.

Googling for

Code: Select all

 evms +gentoo
finds other hits too. I have never used evms myself.
OK, I did it!
For the posterity:
1. Boot from live CD; select

Code: Select all

gentoo-nofb doscsi doevms2
to activate evms.
2. Once in, start evms in command mode

Code: Select all

evms
3. Answer "no" (default) to the question about volume <something>
4. Give evms command to mount your root volume (in my case /dev/evms/root) as

Code: Select all

Mount: /dev/evms/root, /mnt/gentoo
5. Exit evms with exit or quit.
6. Do

Code: Select all

chroot /mnt/evms /bin/bash
and change root password.
That did it!
Alex Peshansky
Top
mokia
n00b
n00b
Posts: 63
Joined: Mon Feb 01, 2010 5:11 pm
Location: Hungary

  • Quote

Post by mokia » Wed Jul 28, 2010 3:01 pm

I know. The topic is masked as solved, but I have the same problem for a while.
kernel hanged, and asked the root password.

Code: Select all

Give root password for maintenance (or type Control-D to continue):
type root password, and its not working.

It was a keymap problem.
kernel used the en qwerty
and my system default was hu qwertz
so z y numbers and special characters are not on the right place.
After typing root password in qwery-s geometry the system let me in.
Top
apeshansky
n00b
n00b
User avatar
Posts: 10
Joined: Wed Jul 14, 2010 4:47 pm

  • Quote

Post by apeshansky » Wed Jul 28, 2010 4:45 pm

mokia wrote:I know. The topic is masked as solved, but I have the same problem for a while.
kernel hanged, and asked the root password.

Code: Select all

Give root password for maintenance (or type Control-D to continue):
type root password, and its not working.

It was a keymap problem.
kernel used the en qwerty
and my system default was hu qwertz
so z y numbers and special characters are not on the right place.
After typing root password in qwery-s geometry the system let me in.
Well, I am pretty sure my problem was quite different. To recap: root password unknown, boot used initframs, so all

Code: Select all

init=/bin/bash
(or other shell) parameters in grub where ignored,

Code: Select all

real_init=/bin/bash
brought same prompt for root password, and attempts to mount existing root while booted from CD were rejected because of use of evms (LVM).
I am pretty sure I saw another thread with the same problem the quoted poster was having.
Alex Peshansky
Top
mokia
n00b
n00b
Posts: 63
Joined: Mon Feb 01, 2010 5:11 pm
Location: Hungary

  • Quote

Post by mokia » Wed Jul 28, 2010 5:41 pm

Well i'm only replied to this topic
GPL wrote:in the hope that it will be useful
In future for someone.
For gogling and searching users. :D

So sorry, but my attention was fixed on "Give root password for maintenance (or type Control-D to continue):"
And simply swapped in my mind "unknown" wit "not working"
Pls excuse my mistake.
Top
cwr
Veteran
Veteran
Posts: 1969
Joined: Sat Dec 17, 2005 11:17 am

  • Quote

Post by cwr » Wed Jul 28, 2010 6:30 pm

The easiest way I've found to reset the root password is to boot off a CD,
mount the / partition, and edit the relevant /etc/passwd to remove the
first 'x' in root's entry. Then boot normally and log in _without_ a root
password, and reset the password from there.

Will
Top
Post Reply

20 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic