Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 227207 - attempt to boot into single user mode with real_init 1 on the kernel line ends with kernel panick
Summary: attempt to boot into single user mode with real_init 1 on the kernel line end...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-15 14:44 UTC by Peter Wood
Modified: 2010-12-17 01:14 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Wood 2008-06-15 14:44:14 UTC
I am using a kernel generated with genkernel. In order to boot into single user mode, I tried adding the following on the kernel line in my grub.conf file:
real_init 1 (substituting single or S1 for 1 gives the same results)
The boot process is halted after a few seconds with the following error: 
switch_root Bad init '1' (single or S1)
Attempt to kill init 
kernel panik.
If I do not use the initramfs and substitute real_root by root, real_init 1 by 1 and delete the ramdisk entry, the system boots into single mode fine.
However, I need to be able to use the initrd image as I am using lvm and luks.

Reproducible: Always

Steps to Reproduce:
1.add real_root 1 on the kernel line in grub.conf
2.reboot
3.

Actual Results:  
kernel panik

Expected Results:  
system boots into single user mode

Searching for information on the use of real_init I get mixed results: 
a) some references seem to indicate that it defines the runlevel to boot into
b) others seem to indicate that it defines a program used as init
Comment 1 Chris Gianelloni (RETIRED) gentoo-dev 2008-06-28 07:40:54 UTC
You used real_init 1 and not real_init=1 ?
Comment 2 Peter Wood 2008-07-06 15:39:07 UTC
Sorry,
I used real_init=1, and got the results outlined above.

Comment 3 Reuben Farrelly 2008-08-17 04:26:27 UTC
+1, happening here too, using real_init=1 appended to my kernel boot line in grub.  Damn annoying as there's no other way to get into single user mode :-(
Comment 4 Icepick 2008-09-28 17:15:42 UTC
I tracked this down to:
/usr/share/genkernel/generic/linuxrc e.g. the genkernel command line parser.


Line 627
exec switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" "${INIT_OPTS}"

"real_init" is just that, where is the real init script?
The kernel option we should use is init_opts=1 to set single user run level.

Comment 5 Andrew Gaffney (RETIRED) gentoo-dev 2008-11-15 07:08:39 UTC
Has anyone tried to boot with 'single', 'softlevel=single', or something like that?
Comment 6 Icepick 2008-11-18 20:35:12 UTC
(In reply to comment #5)
> Has anyone tried to boot with 'single', 'softlevel=single', or something like
> that?

Yes, and I was not able to get it to work with the grub initrd startup.
Comment 7 Javier Miqueleiz 2009-04-20 19:54:48 UTC
Have tried booting with some init_opts= options. And most work for me. My test
system had sys-kernel/genkernel-3.4.10-r1 BTW. Here is what I got:

Single user mode:
  init_opts=s >>> OK
  init_opts=S >>> OK
  init_opts=single  >>> OK

Emergency mode (init spawns sulogin, no checkfs, mount, ...)
  init_opts=emergency >>> OK
  init_opts=-b >>> Doesn't work (Suppose some problem with the "-". Maybe an
issue with switch_root from busybox).


BTW, genkernel uses a different scheme for cmdline options than any other
initramfs/initrd out there. I think this has been the root of confusion.
Comment 8 Jake Magee 2009-10-12 04:02:05 UTC
I had the same problem.  "real_init", "softlevel", and "1" did not work for me.  However, adding "emergency" to the end of my grub options did.

Seeing how old this ticket is (and I believe it now has a solution), should it be closed?
Comment 9 Javier Miqueleiz 2009-10-12 16:52:48 UTC
Could someone confirm that the cmdline options in comment #7 work?
Comment 10 Jake Magee 2009-10-18 16:39:24 UTC
I am running a vanilla kernel (not genkernel), however here are my results:
Note: These options were simply appended to my grub command (no "init_opts=" used).

emergency = works
-b = works
s = works
S = works
single = works

Please mark this bug as resolved.
Comment 11 Javier Miqueleiz 2009-10-26 20:52:42 UTC
You don't use an initramfs/initrd, so in your test case the kernel runs directly the init process. This process is passed all the non-filtered cmdline parameters. The filtered ones are all that have the "=" sign and the ones interpreted by the kernel (for example: noht, nosmp, noapic,...). So all the usual init arguments (s, S, emergency, ...) work for you ;).

This bug is about genkernel. In this case, the kernel runs first the init from genkernel. Afterwards, the real init is started. With the arguments supplied as init_opts.

I tried all the init arguments and commented my results. They should be similar for other people. But before closing the bug, it should be better someone confirm they are in fact the same.
Comment 12 Kayvan Sylvan 2010-05-27 21:06:03 UTC
I think this bug can be closed.

I use genkernel to generate my kernel and I had to reboot my Gentoo single-user (to extend and resize the LVM filesystem that houses my /usr partition) and could not get it to work by appending "single" to the kernel grub line on boot.

I searched and ran across this bug, which provided the solution.

Adding init_opts=single to the grub boot line worked for me.
Comment 13 Erik Hvatum 2010-12-04 21:52:33 UTC
> I think this bug can be closed.
> ...
> Adding init_opts=single to the grub boot line worked for me.

I am using genkernel with initrd and this also works for me.  However, I only knew to try it after reading every message attached to this bug report!

This is going to remain a problem until the Bootloader Configuration section of the Gentoo Linux Genkernel Guide describes the init_opts parameter.  It already has info on the real_root parameter, so this seems like an appropriate place to me.
Comment 14 Erik Hvatum 2010-12-17 01:14:42 UTC
Please reassign this bug to the documentation project.

I see now that the Genkernel Guide is no longer maintained.  The Gentoo Handbook, which is maintained, has example grub.conf files for users booting without initrd and also for genkernel users booting with initrd.

The non-initrd non-genkernel example (code listing 2.3) includes a rescue option while the genkernel initrd example (code listing 2.4) does not.  Genkernel users occasionally require single user mode and there is _no_ documentation available describing how to enter single user mode with genkernel w/ initrd.

Therefore, I request that a rescue or single user option be added to Gentoo Handbook code listing 2.4.  This option should use either real_init=/bin/bb or init_opts=single.