Linux - EnterpriseThis forum is for all items relating to using Linux in the Enterprise.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have just encountered a big problem on my system.
description: I was logged into my system and i used this command:
# usermod -s /sbin/nologin root
the command got executed properly.
now when i logged out and tried to log in as normal user, i could. But when i rebooted the system.....the problem started.
I got this message
Please provide root password for maintenance:
(or press Ctrl+D to continue)
when i entered the root password... the machine rebooted.
so i did the same process again n this time i pressed Ctrl+D. the system rebooted again.
i tried to boot in single mode but still same.
i tried to use rescue disk.
in an option when it says that it will load sysimage in /mnt/sysimage ...........continue or skip or advanced when i selected continue.....i got an unformatted output...with lines distorted....n @ bottom with message: press ctrl+alt+del ot ctrl+C to restart.
i tried this 2-3 times. no use.
in rescue mode when i selected skip in last option, where it ask to load the sysimage, i got a shell prompt:
i tried fcsk but it did not work since there was no /etc/fstab
Hi everyone,
I have just encountered a big problem on my system. description: I was logged into my system and i used this command:
# usermod -s /sbin/nologin root
the command got executed properly. now when i logged out and tried to log in as normal user, i could. But when i rebooted the system.....the problem started.
Why, exactly, would you even CONSIDER doing this?? Did you not know what it was going to do? If not, then why on EARTH would you do it??
Quote:
I got this message
Please provide root password for maintenance:
(or press Ctrl+D to continue)
when i entered the root password... the machine rebooted.
so i did the same process again n this time i pressed Ctrl+D. the system rebooted again. i tried to boot in single mode but still same. i tried to use rescue disk. in an option when it says that it will load sysimage in /mnt/sysimage ...........continue or skip or advanced when i selected continue.....i got an unformatted output...with lines distorted....n @ bottom with message: press ctrl+alt+del ot ctrl+C to restart.
i tried this 2-3 times. no use.
Doing the same thing over and over will not give you different results.
Quote:
in rescue mode when i selected skip in last option, where it ask to load the sysimage, i got a shell prompt: i tried fcsk but it did not work since there was no /etc/fstab i tried to edit /etc/passwd but it was readonly i just cannot use my system. please help.
The "/etc/passwd" file you're trying to edit is likely on the CD/DVD you booted from. You first need to manually mount your hard drive after you get to the prompt, with a command similar to "mount /dev/sdaX /media". Replace the "X" with whatever device number contains your root partition. Then, type in "cd /media/etc" (to go onto your hard drive root partition), then edit the passwd file there with "vi passwd". Change the "nologin" to be "/bin/bash", save the file and reboot.
Why, exactly, would you even CONSIDER doing this?? Did you not know what it was going to do? If not, then why on EARTH would you do it??
Doing the same thing over and over will not give you different results.
The "/etc/passwd" file you're trying to edit is likely on the CD/DVD you booted from. You first need to manually mount your hard drive after you get to the prompt, with a command similar to "mount /dev/sdaX /media". Replace the "X" with whatever device number contains your root partition. Then, type in "cd /media/etc" (to go onto your hard drive root partition), then edit the passwd file there with "vi passwd". Change the "nologin" to be "/bin/bash", save the file and reboot.
Thanks Tbone for your suggestion.
The only problem here is that I cannot login as root. When I open the passwd file without mounting the file system through shell promt I see this in the first line: root:x:/root:/sbin/nologin for root.
Also the lines below like etc,bin has /sbin/nologin.
Actually I am in learning phase. I recently knew about this nologin, n I thought if I disable root login I cannot login as root but still use su -.but I was wrong :-(. I not only cannot login as root but as any other user.
As you said I will try to mount my file system in rescue mode.
if it's successful will let you know.
Thanks.
Last edited by manoj_hanse; 10-05-2013 at 01:21 AM.
1. the rescue mode was useless since sysimage was not able to be mounted.
2. so i did : attached init=/bin/bash to end of the line for kernel boot parameter.
3. used command: (at bash prompt): mount -o remount,rw /
4. changed from /sbin/nologin to /bin/bash for root in /etc/passwd file.
5. ran this command : fsck -y
Problem solved. rebooted the system....and i was able to login as usual.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.