Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 413267

Summary: sys-apps/openrc: invalid runlevel switching from single user runlevel
Product: Gentoo Hosted Projects Reporter: Alexey Prokopchuk <alexpro>
Component: OpenRCAssignee: OpenRC Team <openrc>
Status: IN_PROGRESS ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Alexey Prokopchuk 2012-04-23 15:29:04 UTC
When I going back to non-default multiuser runlevel from single user runlevel, openrc always runs services from default runlevel. For example: on my desktop system I created runlevel 4 and named it "nogui". In this runlevel xdm, cupsd etc. should not be started. Issuing 'init 4' in single user runlevel switches to runlevel 4 (nogui), but openrc runs services from default runlevel, instead of 'nogui'. RC_RUNLEVEL variable is set to 'default' when switching from runlevel 1 to 4.

If I switch to nogui from default runlevel or boot to nogui, all processed as usual.
Comment 1 William Hubbs gentoo-dev 2012-05-26 19:55:52 UTC
(In reply to comment #0)
> When I going back to non-default multiuser runlevel from single user
> runlevel, openrc always runs services from default runlevel. For example: on
> my desktop system I created runlevel 4 and named it "nogui". In this
> runlevel xdm, cupsd etc. should not be started. Issuing 'init 4' in single
> user runlevel switches to runlevel 4 (nogui), but openrc runs services from
> default runlevel, instead of 'nogui'. RC_RUNLEVEL variable is set to
> 'default' when switching from runlevel 1 to 4.
> 
> If I switch to nogui from default runlevel or boot to nogui, all processed
> as usual.

1. On the line for runlevel 4 in your /etc/inittab, did you change "default" to "nogui"?

2. You should not be using init to switch runlevels. Instead, use "rc nogui" and "rc default".

Let me know if this works for you.
Comment 2 Alexey Prokopchuk 2012-05-28 13:18:17 UTC
(In reply to comment #1)

> 1. On the line for runlevel 4 in your /etc/inittab, did you change "default"
> to "nogui"?
> 
> 2. You should not be using init to switch runlevels. Instead, use "rc nogui"
> and "rc default".
> 
> Let me know if this works for you.

1. Of course I did it. :) 
Quote from inittab:
l4:4:wait:/sbin/rc nogui

2. But there is nothing in documentation about mandatory using '/sbin/rc' for switching runlevels. Also, init perfectly copes with this task previously, why now can not? About question itself: 'rc nogui' doesn't work quite right. Issuing 'rc nogui' from single runlevel first time fails with message "rc: failed to create stopping dir '/lib64/rc/init.d/rc.stopping': file exists". Issuing second time works properly and switches to nogui runlevel. But, if I use '/sbin/rc' for switching runlevels at least once, issuing 'reboot' command produces warning "Could not determine runlevel - doing soft reboot'.

There is someting wrong in openrc when using it for change runlevels...
Comment 3 Benda Xu gentoo-dev 2012-07-04 04:04:38 UTC
Reproduced in my box.

But cannot reproduce in a lxc container. Maybe it is related to some scripts with "keyword -lxc"?
Comment 4 Benda Xu gentoo-dev 2012-07-04 05:59:06 UTC
Hmm... I can eliminate this error with my box now, some conditions should be met to reproduce this.

1. rc single executed by a normal user via sudo, and the tty gets kill during switching
2. kernel do not have cgroups support.

go on to look for the root cause
Comment 5 Benda Xu gentoo-dev 2012-07-04 07:15:48 UTC
correction:

no relation with kernel cgroups.

This problem seems to be triggered when the "rc single" issuing shell (and tty) is killed during the runlevel transition, and leaves the rest in a intermediate state. The remaining rc.stopping confuses the next runlevel transition.

Alexey, is the situation on your side the same?
Comment 6 Alexey Prokopchuk 2012-11-17 15:02:02 UTC
Few days ago I update openrc to 11.0.5. In this version all works fine with runlevel switching, regardless of method (init <numeric runlevel> or rc <name runlevel>). So, works for me. Thanks! :)