LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2012, 03:49 PM   #1
jbennett
Member
 
Registered: Apr 2012
Distribution: CentOS 6.2
Posts: 45

Rep: Reputation: Disabled
Cannot Log in - Cent OS 5


This all started with an accidential unplugging of the box.

Upon reboot, I was getting errors:

Code:
unmounting old /dev
        unmounting old /proc
        unmounting old /sys
        switchroot: mount failed: No such file or directory
        Kernel panic - not syncing: Attempted to kill init!
I utilized a live USB key I had and ran:

Code:
fsck.ext3 -y /dev/VolGroup00/LogVol01
After a while, the disk check completed. Upon reboot, I am presented with the log-in prompt. Normally, I would log into this box under root. When I try to log in as root this time around, the prompt clears and nothing else happens (that I can see).

I have tried booting to single-user mode, but when I try 'passwd', I am told that the system can not identify me. If I try to view /etc/passwd, I am told that I don't have permission. Durring the process of booting to single-user mode, I see the following:

Code:
id: cannot find name for user ID 0
However, i can mount this drive and view /etc/passwd as well as /etc/shadow through the live usb.

Under /etc/passwd, root is listed as follows:

Code:
root:x:0.:0:root:/root:/bin/bash
Under /etc/shadow, I have the following:

Code:
root::15324:0:99999:7:::
I'm not sure where to go next as everything I've Googled seems to be solved well before this point.

Any further assistance would be greatly appreciated!!

Last edited by jbennett; 07-12-2012 at 04:10 PM. Reason: additional information
 
Old 07-12-2012, 04:12 PM   #2
camorri
LQ Guru
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,158

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
As far as I know, the password would be between the first colon, and the second colon in the /etc/shadow file. It would appear to me there is no password set for root. Try logging in, and just press enter as a response to the password.

The passwords are encrypted, so you do not see your password there, just a string of characters.

If you can log in with no password, then you can change it after you're in.
 
Old 07-12-2012, 04:15 PM   #3
jbennett
Member
 
Registered: Apr 2012
Distribution: CentOS 6.2
Posts: 45

Original Poster
Rep: Reputation: Disabled
Unfortunately, it's not at the password prompt that I'm stuck, it's at the user prompt. Where you would normally type in the user that you want to log in as, I type 'root' and press enter. It just clears out and comes back to the same prompt.
 
Old 07-12-2012, 04:25 PM   #4
camorri
LQ Guru
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,158

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
Try to log as root from one of the TTY's. Press ctrl+ alt+ F1 to F6. One of those F keys and the others should get you a command line. User - root, and just press enter when it prompts for the password.
 
Old 07-12-2012, 04:28 PM   #5
camorri
LQ Guru
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,158

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
If that fails, have a look here -->http://itsystemsadmin.wordpress.com/...how-to-fix-it/

This may help.
 
1 members found this post helpful.
Old 07-12-2012, 04:39 PM   #6
jbennett
Member
 
Registered: Apr 2012
Distribution: CentOS 6.2
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by camorri View Post
Try to log as root from one of the TTY's. Press ctrl+ alt+ F1 to F6. One of those F keys and the others should get you a command line. User - root, and just press enter when it prompts for the password.
I tried this at the log in prompt, but nothing happened. Reading up about it, it seems that I need to be logged in in order to access TTY? I am not using a GUI on this box, it is command line only.
 
Old 07-12-2012, 04:43 PM   #7
camorri
LQ Guru
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,158

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
Quote:
I need to be logged in in order to access TTY?
No, the tty's need only to be running. It would appear you have more wrong than the password.

Did you have a look at the how-to I posted? Can you get into single user mode?
 
1 members found this post helpful.
Old 07-12-2012, 04:50 PM   #8
jbennett
Member
 
Registered: Apr 2012
Distribution: CentOS 6.2
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by camorri View Post
If that fails, have a look here -->http://itsystemsadmin.wordpress.com/...how-to-fix-it/

This may help.
When I try option #1 and try to boot to run level 1, I get the following:

Code:
INIT: Entering runlevel 1:
INIT: no more processes left in this runlevel
I am trying to boot using SystemRescueCD, and am at the prompt, but typing 'linux rescue' doesn't work (command not found), so I suppose I need to read a bit further.
 
Old 07-12-2012, 05:29 PM   #9
whizzit
Member
 
Registered: Aug 2004
Location: UK
Distribution: Gentoo, OpenBSD, Debian, FreeBSD, RHEL, CentOS
Posts: 65

Rep: Reputation: 24
It would seem that your system isn't in a very consistent state and you might be better off re-installing in the absence of a backup. However, I have a couple of other points to note.
  1. The dot after the first zero is invalid - which might explain the "cannot find user ID 0" error.

    Quote:
    root:x:0.:0:root:/root:/bin/bash
    You have access to the partition via a USB Linux setup so you can easily edit /etc/passwd to fix that.
  2. pwck(8) is another command to verify the integrity of password files.
  3. Since you can access the partitions you may be able to mount your root file system and chroot(1) to it. I thought I saw reference to a CentOS system, in which case you can use rpm(8) with --verify to check the packages to see which are broken and need re-installing.
  4. If I am correct in thinking this is a CentOS install I would recommend using the rescue option from the installation CD.

The latest INIT error sounds like another problem, implying other files in /etc are also broken. Last of all there could be some PAM configuration files ( /etc/pam.d/ or similar ) that are now broken too and this might also prevent login.

Hope this helps.

Grant

Last edited by whizzit; 07-12-2012 at 05:40 PM.
 
1 members found this post helpful.
Old 07-12-2012, 06:19 PM   #10
camorri
LQ Guru
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,158

Rep: Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510Reputation: 510
This link may help you get into rescue mode.

-->http://www.centos.org/docs/5/html/In...mode-boot.html
 
Old 07-12-2012, 06:19 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
I agree with the pts 1-4 by Whizzit.
You'll also want this http://www.cyberciti.biz/tips/reset-...ermission.html to rest the permissions etc on the files if reqd.
 
1 members found this post helpful.
Old 07-13-2012, 08:32 AM   #12
jbennett
Member
 
Registered: Apr 2012
Distribution: CentOS 6.2
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by whizzit View Post
  • The dot after the first zero is invalid - which might explain the "cannot find user ID 0" error.
Unfortunately, I simply typed this inaccurately on the forum. If only it were that simple!!

Code:
root:x:0:0:root:/root:/bin/bash
Quote:
  • pwck(8) is another command to verify the integrity of password files.
I opened the partition in question in terminal and executed 'pwck'. The result is as follows:

Code:
user 'adm' : directory '/var/adm' does not exist
user 'uucp' : directory '/var/uucp' does not exist
user 'gopher' : directory '/var/gopher' does not exist
user 'ftp' : directory '/var/ftp' does not exist
user 'avahi-autoipd' : directory '/var/lib/avahi-autoipd' does not exist
user 'pulse' : directory '/var/empty/saslauth' does not exist
pwck: no changes
This doesn't seem very promising.

Quote:
  • Since you can access the partitions you may be able to mount your root file system and chroot(1) to it. I thought I saw reference to a CentOS system, in which case you can use rpm(8) with --verify to check the packages to see which are broken and need re-installing.
I'm not familiar with how to do this. I have found the following wiki article describing what I think is my application, but I'm unsure.

When I try to run the following command, I'm told that I must specify the filesystem type. I believe I'm ext3. Does this sound accurate?

Code:
# mount /dev/hda3 /mnt/gentoo
I should note that I'm using a livecd based off of CentOS 6, and am thus using the GUI to mount the drive as I'm more comfortable in this arena.

Quote:
  • If I am correct in thinking this is a CentOS install I would recommend using the rescue option from the installation CD.
I will have to actually make this CD as I don't have one. The guy that built this system before I blindly took it over didn't leave anything behind when he left.

Quote:
The latest INIT error sounds like another problem, implying other files in /etc are also broken. Last of all there could be some PAM configuration files ( /etc/pam.d/ or similar ) that are now broken too and this might also prevent login.
I'm thinking a new install is going to be my best route as well.

Quote:
Hope this helps.
Immensely!! Thank you so much!

Last edited by jbennett; 07-13-2012 at 08:33 AM. Reason: formatting
 
Old 07-13-2012, 10:38 AM   #13
whizzit
Member
 
Registered: Aug 2004
Location: UK
Distribution: Gentoo, OpenBSD, Debian, FreeBSD, RHEL, CentOS
Posts: 65

Rep: Reputation: 24
Quote:
Originally Posted by jbennett View Post
I opened the partition in question in terminal and executed 'pwck'. The result is as follows:

Code:
user 'adm' : directory '/var/adm' does not exist
user 'uucp' : directory '/var/uucp' does not exist
user 'gopher' : directory '/var/gopher' does not exist
user 'ftp' : directory '/var/ftp' does not exist
user 'avahi-autoipd' : directory '/var/lib/avahi-autoipd' does not exist
user 'pulse' : directory '/var/empty/saslauth' does not exist
pwck: no changes
This doesn't seem very promising.
Those are typical/standard errors that I come across. However, this is probably checking the /etc/passwd of your live CD because I neglected to mention that it would only be useful if already chrooted into your CentOS system; sorry.

Quote:
Originally Posted by jbennett View Post
I'm not familiar with how to do this. I have found the following wiki article describing what I think is my application, but I'm unsure.
Sure - it can be done with a live CD but life is going to be much easier using the rescue function of the original CentOS CD. I am thinking more along the lines of the documented rescue steps on CentOS's website*. It does mean working with the command line (terminal or console) for a bit but I think that is unavoidable right now.

( * credit to camorri for first posting this link in comment #10 )

If you are going to be looking after this system for the foreseeable future it will be worth keeping a rescue CD (install CD) around. Grab an ISO from http://vault.centos.org for your specific 5.x release and architecture if your bandwidth allows. The rescue ability is built in as described the the CentOS documentation in the link above.

( the CentOS LiveCD may have the same rescue features, I don't know, but the bin-1ofX versions will have for sure )

Quote:
Originally Posted by jbennett View Post
When I try to run the following command, I'm told that I must specify the filesystem type. I believe I'm ext3. Does this sound accurate?

Code:
# mount /dev/hda3 /mnt/gentoo
Quite probably ext3 and most likely there will be logical volumes meaning the mount will need to be something more like...

Code:
# mount /dev/VolGroup00/LogVol00 /mnt/sysimage
...assuming LogVol00 is the root file system.

Again, the CentOS rescue feature is your friend here as it will auto-detect which logical volumes or real partitions need mounting and mount them for you

Quote:
Originally Posted by jbennett View Post
I'm thinking a new install is going to be my best route as well.
It seems clear the there are other issues beyond gaining login access to the booted CentOS install. It is a good opportunity to learn from a real world problem to gain some confidence and satisfaction so the choice is yours depending on how you value your time and what pressures you have to make a working system.

Or you might decide that now is a good time to upgrade to a 6.x release.

Quote:
Originally Posted by jbennett View Post
Immensely!! Thank you so much!
You're welcome!

Last edited by whizzit; 07-14-2012 at 08:37 AM. Reason: Adding credit for camorri for CentOS link
 
1 members found this post helpful.
Old 07-17-2012, 10:44 AM   #14
jbennett
Member
 
Registered: Apr 2012
Distribution: CentOS 6.2
Posts: 45

Original Poster
Rep: Reputation: Disabled
Ok - so I've come back to these disks to try and rescue them.

I have downloaded CentOS 6.2 DVD1 iso image.

Upon booting to the DVD, I don't have a rescue option? I have an option to install, and then I can edit the command line, but I don't want to wipe and reinstall on these disks (I've already done a fresh install on another disk).

Did I grab the wrong iso image?? Is there a different one for rescue/recovery and I just missed it?
 
Old 07-17-2012, 10:56 AM   #15
michaelk
Moderator
 
Registered: Aug 2002
Posts: 15,931

Rep: Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825Reputation: 1825
You need to type "linux rescue" at the "boot:" prompt.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cent os vijay mohan Linux - Newbie 2 01-21-2012 11:58 AM
kernel log format in /var/log/kern.log sinu_nayak2001 Linux - Newbie 2 10-07-2009 08:34 AM
In Apache server, How to change log file location and log format for access log fil? since1993 Linux - Server 1 08-19-2009 04:14 PM
Cent OS jolly1702 Linux - Newbie 3 08-24-2008 10:18 PM
Opennms Logs - where are web.log, web_rtc.log and webauth.log referenced? not_much_of_a_guru Linux - Networking 0 07-12-2006 10:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration