Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 418385 - genkernel, initramfs: How to enter single user mode is not documented
Summary: genkernel, initramfs: How to enter single user mode is not documented
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs on www.gentoo.org
Classification: Unclassified
Component: Installation Handbook (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sven Vermeulen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-31 15:35 UTC by Timothy Miller
Modified: 2012-06-29 19:21 UTC (History)
2 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 Timothy Miller 2012-05-31 15:35:34 UTC
I use genkernel, which produces an initrd.  None of the standard kernel parameters for entering single user mode seem to work.  I tried researching this, and one out-dated wiki (http://www.gentoo-wiki.info/TIP_Booting_into_single_user_mode), suggested adding init_opts=1 instead.  That doesn't work either.

One of Gentoo's strengths is its extensive documentation, but this rather important detail is missing.  Please add it to the manual somewhere.

Thanks.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-05-31 16:11:08 UTC
Gentoo Linux does not define a single user mode. There is the boot, default and the usual administrative runlevels.

The usual way that works on (probably) all Linux distros is to set init=/path/to/some/binary, usually init=/bin/bash or =/bin/bb, which serves as sort of a rescue system.
Comment 2 Wormo (RETIRED) gentoo-dev 2012-06-01 07:10:35 UTC
I don't use genkernel, but it seems like 'init_opts=single' is supposed to work. Did you set up /etc/runlevel/single with a suitable subset of your normal boot services? 

Note that if you use this 'init=/bin/bash' technique, filesystems will still be mounted read-only so they need to be remounted writable before fixing anything, e.g.

mount / -o remount,rw
Comment 3 Timothy Miller 2012-06-01 12:00:04 UTC
All I'm saying is that whatever your recovery mode is, it needs to be documented.  It's been years since I built my Gentoo box, so I don't remember what I did.  Whatever was in the manual in 2008.  If the base layout or instructions included something about level S, then it's there.

Note that I did indeed want to boot in read-only mode.  Instead, I booted up normally, and there's no way I can fully assess the damage as a result.  I really needed to get this right the first time.

And it's also interesting that 'init_opts=single' is yet another option for single user mode that I haven't seen elsewhere, although it is a recombination of other things I've seen.  We need to figure out what is the TRUTH and include that in the docs, key-worded in such a way the if someone googles "gentoo single user mode" they'll get that page.
Comment 4 nm (RETIRED) gentoo-dev 2012-06-04 10:31:32 UTC
(In reply to comment #1)
> Gentoo Linux does not define a single user mode. There is the boot, default
> and the usual administrative runlevels.
> 
> The usual way that works on (probably) all Linux distros is to set
> init=/path/to/some/binary, usually init=/bin/bash or =/bin/bb, which serves
> as sort of a rescue system.

this.

if someone really wants single user mode, googling is probably the best way of figuring it out, as there doesn't seem to be a real standard. me, i just edit grub.conf and change my kernel line to append "single" after the usual /vmlinuz stuff. but then, i don't use genkernel.
Comment 5 Timothy Miller 2012-06-22 19:54:45 UTC
These docs are also wrong about how to get into single user mode:

http://www.gentoo.org/doc/en/handbook/draft/complete/handbook.xml?part=2&chap=7

My bug report was about missing/incorrect documentation.  That still stands.  Unless you're saying that docs on gentoo.org are not official.
Comment 6 Timothy Miller 2012-06-22 20:02:33 UTC
I tried adding "init=/bin/bash" to the kernel command line.  That doesn't work at all.  It just boots up normally.  Since I am using genkernel which makes an initrd (and no one is saying that I shouldn't be using genkernel), I tried "real_init=/bin/bash".  That gives me a kernel panic after a statement that /bin/bash doesn't exist.  

Bottom line:  So far, I have not found any way to get into a single-user or recovery mode for Gentoo using genkernel.  I've also looked through your bug database and found plenty of other complaints pertaining to single-user mode being unavailable.  Why is something so important being overlooked?
Comment 7 Timothy Miller 2012-06-22 20:10:05 UTC
I've also tried "init=/bin/bb" and "real_init=/bin/bb".  The former has no effect, while the latter panics after /bin/bb reports that it "can't open ''".
Comment 8 Sven Vermeulen (RETIRED) gentoo-dev 2012-06-28 20:04:57 UTC
If I boot my genkernel-powered VMs with the additional option "init_opts=S" then openrc goes to the recovery mode (i.e. asking for the root password and giving a system with minimal amount of running services).

Using "real_init=/bin/bash" should work, but it's quite difficult to debug why it doesn't. I guess that bash has some dependencies (dynamic) that can't be properly resolved. I tried with a static-built dash, and it returns just "0: cannot open", but that might be SELinux playing with me.

In general, if you use an initramfs, you should use the "rescue" options that the initramfs provides; genkernel doesn't provide any yet (dracut does).

Where would you suggest that we put this kind of information? There's some blurb about recover in the gentoo FAQ, so I'm inclined to put information there.
Comment 9 Sven Vermeulen (RETIRED) gentoo-dev 2012-06-29 19:21:02 UTC
Changes committed to genkernel guide