Seleting the runlevel at kernel boot time: Hardy

Rashkae ubuntu at tigershaunt.com
Mon Jun 30 13:18:28 UTC 2008


Mumia W. wrote:
> Rashkae wrote:
>> Mumia W. wrote:
>>> Mumia W. wrote:
>>>> I'm running Ubuntu Hardy. In Debian Etch, I'm always able to select my 
>>>> desired runlevel by appending a number onto the kernel boot command line 
>>>> in Grub, e.g. "... root=/dev/sda1 ro 3"
>>>>
>>>> Three would be my desired runlevel. However, Ubuntu Hardy ignores this, 
>>>> and it always sends me into runlevel two. How do I use the kernel 
>>>> command line to tell Ubuntu what runlevel I desire?
>>>>
>>>>
>>> Does anyone have any ideas at all?
>>>
>> This is what you want..
>>
>> I vote this change be made to Ubuntu itself, someone bug Upstart devs!
>>
>> http://caulfield.info/emmet/2008/03/add-a-textonly-runlevel-to-ubu.html
>>
>>
> 
> Thank you very much. I'm going to test this out right now.
> 
> ...
> 
> It made the system non-bootable. Inspired by the script on the site you 
> linked to, I created a working version of the script for my Hardy 
> installation (watch out for word-wrap):
> 
> # rc - runlevel compatibility
> #
> # This task guesses what the "default runlevel" should be and starts the
> # appropriate script.
> 
> start on stopped rcS
> 
> script
> 	runlevel --reboot || true
> 
> 	RL="$(sed -ne 's/.*init \([2-5S]\).*/\1/p' /proc/cmdline || true)"
> 
> 	if grep -q -w -- "-s\|single\|S" /proc/cmdline; then
> 	    telinit S
> 	elif [ -n "$RL" ]; then
> 	    telinit $RL
> 	elif [ -r /etc/inittab ]; then
> 	    RL="$(sed -n -e "/^id:[0-9]*:initdefault:/{s/^id://;s/:.*//;p}" 
> /etc/inittab || true)"
> 	    if [ -n "$RL" ]; then
> 		telinit $RL
> 	    else
> 		telinit 2
> 	    fi
> 	else
> 	    telinit 2
> 	fi
> end script
> # vim: sts=4
> 
> 
> Thank you very much Rashkae. I'll try to vote for this bug too.
> 
> 

In the grander scheme of things, I don't think we'll really get
attention to this.  The whole point of Upstart is to ditch sysV init
runlevels entirely.  I don't think any changes that regresses reliance
on them will be welcome.

But thank you for the corrected script..I didn't really like the way the
original one was supposed to work, but I like yours.




More information about the ubuntu-users mailing list