Seleting the runlevel at kernel boot time: Hardy

Mumia W. paduille.4062.mumia.w+nospam at earthlink.net
Mon Jun 30 04:24:35 UTC 2008


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.





More information about the ubuntu-users mailing list