LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 10-15-2015, 04:19 PM   #1
sumncguy
Member
 
Registered: Jun 2013
Posts: 76

Rep: Reputation: Disabled
Grub and Kernel parameters


The admin I class continues. I'm having a problem that I'm trying to figure out.

If Im at the grub menu.
I hit "a" (or p if its configured that way)
then add
"init=/bin/bash" at the end of the kernel boot params.

I am presented with a root prompt.
I run passwd to recover then when I try to reboot. I get an error "Unable to reboot the system"

Is this because something isnt mounted ??

This isnt homework. After I did the lab using the single user option to reset, I did more reading and found init=/bin/bash in Tracys LPCI 1/LINUX+ text. The fact is that in either case I couldnt run reboot or shutdown -r. I had to Reset the guest through VMWorkstations menu.

Also .. I think this might be a little advanced for the newbi section. Whats a good place for this admin ?

Thanks ahead of time .. you guys are aways great !!!
Sum
 
Old 10-16-2015, 06:00 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
This is because the shell you are using is pid 1. And "reboot" attempts to send a signal to init to change run levels/begin a shutdown-restart (and the shell doesn't support those signals).

I get a bit vague about the run levels/shutdown because some init programs don't have run levels... (systemd for instance).

Using "init=/bin/bash" makes bash the init process, and it doesn't support such actions. If you mounted root rw to change a password, then remount it read only, and try the halt utility (it might require "halt -f").

Usually for password changes like this instead of using "init=" option, you put the word "single" on the end of the boot command line. This uses the normal init, but with the direction not to go to multi-user mode, and to start a root shell (it may even call for roots password - depends on the distribution). Since the systems init process is now used, there is support for the normal reboot/shutdown functions as supported by init.

If you are trying things out - watch what happens if you use "init=/bin/bash" and just exit... You should get a "panic - init exited" type of crash (or system just hangs), if you dismounted the root filesystem then there would be no disk corruption due to buffers still in memory. Also try "exit 1" (just exiting is the same as "exit 0"). I believe the "exit 1" generates a "Requested init /bin/bash failed (error 1)" message.

If you have the kernel source, what is happening should be in "init/main.c" in the function "kernel_init".

This kind of experimentation is best done in an "expendable" VM rather than your workstation :-)

Last edited by jpollard; 10-16-2015 at 06:48 AM.
 
1 members found this post helpful.
Old 10-16-2015, 08:49 AM   #3
sumncguy
Member
 
Registered: Jun 2013
Posts: 76

Original Poster
Rep: Reputation: Disabled
Thanks JP, Ill try a few of your suggestions.

I haven't tried the keyword single but have used 1 at the end of the kernel parameters. Is there a difference ? Or do both simply refer to single user ?

.. and yes ... although its all in a "lab" environment, I did/do backup my VMs so I dont have rebuild if I cook it/them. Im and old guy .. 52 and have been in the networking field for about 35 years. Just like the command line and linux. Really going for the cert for myself. .. Anyway.. Ive unfortunately learned the hard way. In fact I had to back up. In class we have been building the server .. different services and configurations. If I do cook the VM without having a backup, it means at least a few hours to restore 1/2 semester of work. So what I do is, complete the labs then immediately save the VM. Then I go ahead and experiment to try to find answers to questions I have, if I blow "it" up... no biggy just delete and copy over the backup. One thing thats nice about VMs.

Thanks again for you help. Ill let you know what I find.
 
Old 10-16-2015, 08:59 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Nope - 1 is the same as single. It is specifying runlevel 1; I think all init systems interpret that as single user mode.
 
  


Reply



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
LXer: How to add kernel boot parameters via GRUB on Linux LXer Syndicated Linux News 0 11-05-2013 06:30 AM
[SOLVED] how to pass kernel parameters with grub legacy? Knightron Linux - General 1 02-26-2012 12:00 AM
Sabayon LiveDVD Loop from USB - Grub kernel parameters manwithaplan Linux - General 0 01-14-2009 01:25 AM
grub / explanation of the kernel (vmlinuz) parameters picticpic Linux - Software 1 08-26-2005 05:55 AM
Grub parameters....??? avols143 Linux - General 3 03-19-2004 10:12 AM

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

All times are GMT -5. The time now is 05:28 AM.

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
Open Source Consulting | Domain Registration