initctl problem

Casey Dahlin cdahlin at redhat.com
Sun Aug 3 18:21:55 BST 2008


Violent Tempest wrote:
> Hi,
>
> I'm trying to convert Fedora 9 init scripts to Upstart 0.5 jobs. I
> installed bazaar.launchpad.net/~cjdahlin/upstart/dbus-userspace/ in
> /usr/local/, and added some path fixes to the scripts
>
> diff --git a/jobs.d/rcS b/jobs.d/rcS
> index dca6939..8a71b86 100644
> --- a/jobs.d/rcS
> +++ b/jobs.d/rcS
> @@ -11,13 +11,13 @@ stop on runlevel
>  # without information so that it defaults to previous=N runlevel=S.
>  console output
>  script
> -	runlevel --set S >/dev/null || true
> +	/usr/local/sbin/runlevel --set S >/dev/null || true
>
>  	/usr/local/etc/init/rc.sysinit
> -	runlevel --reboot || true
> +	/usr/local/sbin/runlevel --reboot || true
>  end script
>  post-stop script
> -	if [ "$UPSTART_EVENT" == "startup" ]; then
> +	if [ "$UPSTART_EVENTS" == "startup" ]; then
>  		runlevel=$(/bin/awk -F ':' '$3 == "initdefault" { print $2 }' /etc/inittab)
>  		[ -z "$runlevel" ] && runlevel="3"
>  		for t in $(cat /proc/cmdline); do
> @@ -26,6 +26,6 @@ post-stop script
>  				[1-9])       runlevel="$t" ;;
>  			esac
>  		done
> -		exec telinit $runlevel
> +		exec /usr/local/sbin/telinit $runlevel
>  	fi
>  end script
> diff --git a/jobs.d/serial b/jobs.d/serial
> index 6869090..fc714be 100644
> --- a/jobs.d/serial
> +++ b/jobs.d/serial
> @@ -5,14 +5,14 @@ stop on runlevel [016]
>  instance
>  pre-start script
>  	while /bin/true ; do
> -		LANG=C /sbin/initctl status rcS | grep -wq "rcS (stop) waiting" && break
> +		LANG=C /usr/local/sbin/initctl status rcS | grep -wq "rcS (stop)
> waiting" && break
>  		sleep 1
>  	done
>  	while /bin/true ; do
> -		runlevel=$(/sbin/runlevel | /bin/awk '{ print $2 }')
> +		runlevel=$(/usr/local/sbin/runlevel | /bin/awk '{ print $2 }')
>  		case "$runlevel" in
>  			2|3|4|5)
> -				LANG=C /sbin/initctl status rc$runlevel | grep -wq "rc$runlevel
> (stop) waiting" && break
> +				LANG=C /usr/local/sbin/initctl status rc$runlevel | grep -wq
> "rc$runlevel (stop) waiting" && break
>  				;;
>  			*)
>  				;;
> @@ -23,7 +23,7 @@ pre-start script
>  end script
>  exec /sbin/agetty /dev/$1 $2 vt100-nav
>  post-stop script
> -	if [ "$UPSTART_EVENT" !=
> "${UPSTART_EVENT##fedora.serial-console-available}" ]; then
> -		initctl emit --no-wait fedora.serial-console-available $1 $2
> +	if [ "$UPSTART_EVENTS" !=
> "${UPSTART_EVENTS##fedora.serial-console-available}" ]; then
> +		/usr/local/sbin/initctl emit --no-wait fedora.serial-console-available $1 $2
>  	fi
>  end script
>
> (I'm not brave enough to replace stable Upstart shipped with distro ;)).
>
> When I try to boot the system I see a lot of "initctl: Unable to send
> message: Connection refused" errors. I suppose that these are dbus
> errors. Do I need to start dbus very early?
>
> TIA.
>
> Regards
>
> P.S. For SELinux developers created reference policy. Maybe we should
> create reference init script for Upstart? I volunteer for this task.
>
>   
Most likely you installed incorrectly, and the old init process is still 
running. The initctl program uses a private connection and doesn't need 
the actual system bus. It should always be able to get to upstart.

There's already a trunk specfile in fedora CVS, its just not been tagged 
for build yet. You should use that.

--CJD



More information about the upstart-devel mailing list