Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95876 - New sys-apps/sysvinit-2.86 don't like single user
Summary: New sys-apps/sysvinit-2.86 don't like single user
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 96071 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-12 09:33 UTC by Petr Lanc
Modified: 2006-10-05 18:55 UTC (History)
13 users (show)

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


Attachments
Patch correcting the single mode on sysvinit 2.86 (sysvinit-2.86-single.patch,451 bytes, patch)
2006-03-31 08:45 UTC, Arnaud Launay
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Lanc 2005-06-12 09:33:44 UTC
Hi, when I upgrade baselayout with new sysvinit package, I can't go to single
user mode from grub kernel-cmd line (kernel /vmlinuz single), nor shell (#
telinit S)
I try it on gentoo with old baselayout-1.9.4-r6 and it works well (both methods).
If I run # telinit S, it stop all services from default runlevel, but instead of
run root shell, it  go back, to runlevel 3, and start all services form default
runlevel.
Keyword 'single' from kernel command line is ignored.
If i try init 1 instead of S, it start softlevel single, but with login prompt,
not shell.

Reproducible: Always
Steps to Reproduce:
1. 'telinit S' or append 'single' word to kernel line 
2.
3.

Actual Results:  
Boot mutli-user runlevel (default form /etc/inittab)

Expected Results:  
Boot single-user with root shell without login/password.

Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r9 i686)
=================================================================
System uname: 2.6.11-gentoo-r9 i686 Pentium III (Coppermine)
Gentoo Base System version 1.6.12
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May  1 2005, 15:34:04)]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.8.5-r3, 1.7.9-r1, 1.6.3, 1.4_p6, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -funroll-loops -mfpmath=sse -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -funroll-loops -mfpmath=sse -fomit-frame-pointer
-pipe"
DISTDIR="/var/tmp/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
ftp://mirror.switch.ch/mirror/gentoo/ http://mirror.switch.ch/mirror/gentoo/
ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo
ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LANG="POSIX"
LINGUAS="cs"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X acl alsa apm avi bash-completion berkdb bitmap-fonts bzip2 cdparanoia
crypt emboss encode esd foomaticdb fortran gdbm gif gpm gtk gtk2 imlib jpeg
libg++ libwww maildir mikmod mmx motif mp3 mpeg ncurses network nls nptl ogg
oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl slang
spell sse ssl tcpd tiff truetype truetype-fonts type1-fonts usb vorbis xml2 xmms
xv zlib linguas_cs userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LC_ALL, LDFLAGS, PORTDIR_OVERLAY
Comment 1 Horace Ip 2005-06-12 10:55:32 UTC
I want to confirm that I am getting the same behavior.


Kernel command line: root=/dev/hda7 ro single


even dmesg showing that I called single, init still boots into level 3.
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2005-06-14 07:01:03 UTC
*** Bug 96071 has been marked as a duplicate of this bug. ***
Comment 3 kevin 2005-06-18 19:12:43 UTC
Note that placing:
emergency

on the kernel command line DOES work. You can use that as a workaround.
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2005-06-23 04:58:46 UTC
Hi,

I had the same problem as described in the initial report. I fiddled a bit
around with /etc/inittab and found out that you can make init going (and stay)
into singleusermode when you change this line in /etc/inittab
l1:S1:wait:/sbin/rc single
into
l1:s1:wait:/sbin/rc single
("S" changed into "s")
and run "init s". But then I stombled about the next error:
When /sbin/sulogin is being invoked and you are asked for the root-pw you are
still logged into a shell-session and when you type in the root-pw you get the
message "bash: ${root-pw}: command not found" (replace ${root-pw} with your root
password). After pressing return several times one is again asked for a root-pw
by sulogin. But pressing return again and again will always bring you back to
the shell-session you invoked "init s".

Poly
Comment 5 Horace Ip 2005-07-20 18:08:14 UTC
The latest stable release
sys-apps/baselayout-1.11.13
still exhibits the same problem.
Comment 6 kfm 2005-07-24 22:35:51 UTC
Just a note to say that appending "S" as a kernel parameter (as is now suggested
for recent kernels in Documentation/kernel-parameters.txt) does not work either
when booting. I hope a solution transpires soon; the issues described in this
bug are rather annoying :/
Comment 7 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2005-08-06 05:38:27 UTC
Hi,

additional note to comment #4:
after changing S into s in /etc/inittab "init s" won't stop any services from
other runlevels. It just sends a TERM and a KILL signal then asks for the
root-pw. On the other hand when keeping the S in inittab all services from other
runlevels are shut down before init re-enters the default-runlevel again :-/

Poly
Comment 8 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2005-08-06 07:03:04 UTC
Hi again,

sorry for the dumb stuff I wrote in my two previous posts...
Of course the capital s (S) in inittab is the correct way to define
singleuser-mode. The small s (s) is not necessary, one can get the same effect
by completely removing the S from the above mentioned line in inittab. As far as
I can say this is a bug that was introduced by bryan@kadzban.is-a-geek.net as
mentioned in doc/Changelog of the source-package. I'll contact the author of
sysvinit and ask him to take a look at this bugreport...

Poly
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2005-08-24 01:44:44 UTC
It should be fixed with baselayout-1.12.0_pre6-r1 for those brave souls that
want to try it (although note that only with kernel arg 'single' does it work ..
i am wondering if its not a kernel issue for 's' and 'S' ??)
Comment 10 Arkadiusz Miskiewicz 2005-09-04 14:54:48 UTC
The code tests for old->rlevel but for some actions is sets default rlevel which 
contains problematic "S":

        } else {
                strcpy(ch->rlevel, "0123456789");
                if (ISPOWER(ch->action))
                        strcpy(ch->rlevel, "S0123456789");
        }


diff -urN sysvinit-2.86.org/src/init.c sysvinit-2.86/src/init.c
--- sysvinit-2.86.org/src/init.c        2004-07-30 14:16:20.000000000 +0200
+++ sysvinit-2.86/src/init.c    2005-09-04 23:43:54.593827008 +0200
@@ -1151,7 +1151,7 @@
                 *      See if we have a single user entry.
                 */
                for(old = newFamily; old; old = old->next)
-                       if (strpbrk(old->rlevel, "S")) break;
+                       if (strcmp("S0123456789", old->rlevel) && strpbrk(old-
>rlevel, "S")) break;
                if (old == NULL)
                        snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SULOGIN);
                else
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2005-09-22 07:06:38 UTC
(In reply to comment #10)
> The code tests for old->rlevel but for some actions is sets default rlevel which 
> contains problematic "S":
> 
>         } else {
>                 strcpy(ch->rlevel, "0123456789");
>                 if (ISPOWER(ch->action))
>                         strcpy(ch->rlevel, "S0123456789");
>         }
> 
> 
> diff -urN sysvinit-2.86.org/src/init.c sysvinit-2.86/src/init.c
> --- sysvinit-2.86.org/src/init.c        2004-07-30 14:16:20.000000000 +0200
> +++ sysvinit-2.86/src/init.c    2005-09-04 23:43:54.593827008 +0200
> @@ -1151,7 +1151,7 @@
>                  *      See if we have a single user entry.
>                  */
>                 for(old = newFamily; old; old = old->next)
> -                       if (strpbrk(old->rlevel, "S")) break;
> +                       if (strcmp("S0123456789", old->rlevel) && strpbrk(old-
> >rlevel, "S")) break;
>                 if (old == NULL)
>                         snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", SULOGIN);
>                 else
> 

I do not see the logic here?  First check if old->rlevel is on of "S0123456789",
and then check if it contains 'S' ?  What does that do that will make things
different from just checking if it have 'S' from the start like it does now ?

Comment 12 Arkadiusz Miskiewicz 2005-09-22 08:05:34 UTC
strcmp checks if rlevel is _not_ "S0123456789" and contains ,,S''. In previous 
versions strpbrk() thing was strcmp(old->rlevel, "S") == 0.
Comment 13 Martin Schlemmer (RETIRED) gentoo-dev 2005-09-29 22:16:18 UTC
(In reply to comment #12)
> strcmp checks if rlevel is _not_ "S0123456789" and contains ,,S''. In previous 
> versions strpbrk() thing was strcmp(old->rlevel, "S") == 0.

No, that is 'if (strcmp("S0123456789", old->rlevel) == 0)'.  Like its done now,
the return value will be > 0 if RHS is one of the chars of LHS (or any partial
match for that matter) ....

-----
azarah@lycan ~/tmp $ cat strcmp-test.c
#include <stdio.h>
#include <string.h>

int main() {
        int ret = 0;

        ret = strcmp("S0123456789", "S");

        printf("ret = %i\n", ret);
        if (ret)
                printf("Yes!\n");

        return 0;
}
azarah@lycan ~/tmp $ gcc -o strcmp-test strcmp-test.c
azarah@lycan ~/tmp $ ./strcmp-test
ret = 1
Yes!
azarah@lycan ~/tmp $
Comment 14 Arnaud Launay 2006-03-31 08:27:48 UTC
Hm, as far as I know, you can boot into single user mode by adding "1" (without the quote) on the kernel line of grub or lilo. It's also explained here:
http://gentoo-wiki.com/TIP_Booting_into_single_user_mode
Comment 15 Arnaud Launay 2006-03-31 08:45:54 UTC
Created attachment 83522 [details, diff]
Patch correcting the single mode on sysvinit 2.86

By the way, Fedora has a different way of correcting this bug, the patch they use is included.
Comment 16 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2006-10-05 17:19:52 UTC
baselayout-1.12* is stable which fixes this bug. So this can be closed as fixed.
Comment 17 SpanKY gentoo-dev 2006-10-05 18:55:13 UTC
k, thx