LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Runit dbus and hald (https://www.linuxquestions.org/questions/debian-26/runit-dbus-and-hald-598942/)

xaos5 11-12-2007 12:32 AM

Runit dbus and hald
 
I need to get dbus and hald working under runit.

I'm using debian etch


I created /etc/sv/hald/run :
Code:

#!/bin/bash
1>&2
exec hald daemon=yes &

but when I go to check status it shows this:
Code:

# sv status hald
down: hald: 0s, normally up, want up

# sv status hald
down: hald: 1s, normally up, want up

# sv status hald
down: hald: 0s, normally up, want up

trying to manually start it:
Code:

# sv start hald
timeout: down: hald: 0s, normally up, want up

It looks like I might be missing something?

Code:

# ls -l /var/service/
total 0
lrwxrwxrwx 1 root root 12 2007-11-12 00:56 gdm -> /etc/sv/gdm/
lrwxrwxrwx 1 root root 15 2007-11-12 00:40 getty-1 -> /etc/sv/getty-1
lrwxrwxrwx 1 root root 15 2007-11-12 00:40 getty-2 -> /etc/sv/getty-2
lrwxrwxrwx 1 root root 15 2007-11-12 00:40 getty-3 -> /etc/sv/getty-3
lrwxrwxrwx 1 root root 15 2007-11-12 00:40 getty-4 -> /etc/sv/getty-4
lrwxrwxrwx 1 root root 15 2007-11-12 00:40 getty-5 -> /etc/sv/getty-5
lrwxrwxrwx 1 root root 13 2007-11-12 01:15 hald -> /etc/sv/hald/
lrwxrwxrwx 1 root root 20 2007-11-12 00:40 socklog-klog -> /etc/sv/socklog-klog
lrwxrwxrwx 1 root root 20 2007-11-12 00:40 socklog-unix -> /etc/sv/socklog-unix

Code:

# ls -l /etc/sv/*
lrwxrwxrwx 1 root root  36 2007-11-12 00:55 /etc/sv/README -> /usr/share/doc/runit-services/README

/etc/sv/apache:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 env
-rwxr-xr-x 1 root root  98 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  18 2007-11-12 00:55 supervise -> /var/run/sv.apache

/etc/sv/chrony:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 log
-rwxr-xr-x 1 root root  52 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  18 2007-11-12 00:55 supervise -> /var/run/sv.chrony

/etc/sv/cron:
total 4
-rwxr-xr-x 1 root root 119 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  16 2007-11-12 00:55 supervise -> /var/run/sv.cron

/etc/sv/dbus:
total 4
-rw-r--r-- 1 root root 42 2007-11-12 01:09 run

/etc/sv/dhclient:
total 16
-rwxr-xr-x 1 root root  118 2006-06-29 04:25 check
-rw-r--r-- 1 root root  16 2006-06-29 04:25 interfaces
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 log
-rwxr-xr-x 1 root root  95 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  20 2007-11-12 00:55 supervise -> /var/run/sv.dhclient

/etc/sv/dhcp:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 log
-rwxr-xr-x 1 root root  66 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  16 2007-11-12 00:55 supervise -> /var/run/sv.dhcp

/etc/sv/exim:
total 8
drwxr-xr-x 2 root root 4096 2006-06-29 04:25 peers
-rwxr-xr-x 1 root root  132 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  16 2007-11-12 00:55 supervise -> /var/run/sv.exim

/etc/sv/gdm:
total 4
-rwxr-xr-x 1 root root 39 2006-06-29 04:25 run
lrwxrwxrwx 1 root root 15 2007-11-12 00:55 supervise -> /var/run/sv.gdm

/etc/sv/getty-1:
total 8
-rwxr-xr-x 1 root root 31 2006-11-04 14:33 finish
-rwxr-xr-x 1 root root 97 2006-11-04 14:33 run
lrwxrwxrwx 1 root root 19 2007-11-12 00:40 supervise -> /var/run/sv.getty-1

/etc/sv/getty-2:
total 8
-rwxr-xr-x 1 root root 31 2006-11-04 14:33 finish
-rwxr-xr-x 1 root root 97 2006-11-04 14:33 run
lrwxrwxrwx 1 root root 19 2007-11-12 00:40 supervise -> /var/run/sv.getty-2

/etc/sv/getty-3:
total 8
-rwxr-xr-x 1 root root 31 2006-11-04 14:33 finish
-rwxr-xr-x 1 root root 97 2006-11-04 14:33 run
lrwxrwxrwx 1 root root 19 2007-11-12 00:40 supervise -> /var/run/sv.getty-3

/etc/sv/getty-4:
total 8
-rwxr-xr-x 1 root root 31 2006-11-04 14:33 finish
-rwxr-xr-x 1 root root 97 2006-11-04 14:33 run
lrwxrwxrwx 1 root root 19 2007-11-12 00:40 supervise -> /var/run/sv.getty-4

/etc/sv/getty-5:
total 8
-rwxr-xr-x 1 root root 31 2006-11-21 17:40 finish
-rwxr-xr-x 1 root root 97 2006-11-21 17:40 run
lrwxrwxrwx 1 root root 19 2007-11-12 00:38 supervise -> /var/run/sv.getty-5

/etc/sv/hald:
total 8
-rw-r--r-- 1 root root  41 2007-11-12 01:08 run
drwx------ 2 root root 4096 2007-11-12 01:31 supervise

/etc/sv/nfs-kernel-server:
total 12
-rwxr-xr-x 1 root root  126 2006-06-29 04:25 finish
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 log
-rwxr-xr-x 1 root root  154 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  29 2007-11-12 00:55 supervise -> /var/run/sv.nfs-kernel-server

/etc/sv/portmap:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 log
-rwxr-xr-x 1 root root  36 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  19 2007-11-12 00:55 supervise -> /var/run/sv.portmap

/etc/sv/postfix:
total 4
-rwxr-xr-x 1 root root 277 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  19 2007-11-12 00:55 supervise -> /var/run/sv.postfix

/etc/sv/socklog-inet:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:40 log
-rwxr-xr-x 1 root root  59 2006-12-09 05:37 run
lrwxrwxrwx 1 root root  24 2007-11-12 00:40 supervise -> /var/run/sv.socklog-inet

/etc/sv/socklog-klog:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:40 log
-rwxr-xr-x 1 root root  136 2006-12-09 05:37 run
lrwxrwxrwx 1 root root  24 2007-11-12 00:40 supervise -> /var/run/sv.socklog-klog

/etc/sv/socklog-notify:
total 4
-rwxr-xr-x 1 root root 268 2006-12-09 05:37 run
lrwxrwxrwx 1 root root  26 2007-11-12 00:40 supervise -> /var/run/sv.socklog-notify

/etc/sv/socklog-ucspi-tcp:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:40 log
-rwxr-xr-x 1 root root  101 2006-12-09 05:37 run
lrwxrwxrwx 1 root root  29 2007-11-12 00:40 supervise -> /var/run/sv.socklog-ucspi-tcp

/etc/sv/socklog-unix:
total 12
-rwxr-xr-x 1 root root  60 2006-12-09 05:37 check
drwxr-xr-x 2 root root 4096 2007-11-12 00:40 log
-rwxr-xr-x 1 root root  62 2006-12-09 05:37 run
lrwxrwxrwx 1 root root  24 2007-11-12 00:40 supervise -> /var/run/sv.socklog-unix

/etc/sv/squid:
total 4
-rwxr-xr-x 1 root root 407 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  17 2007-11-12 00:55 supervise -> /var/run/sv.squid

/etc/sv/ssh:
total 8
drwxr-xr-x 2 root root 4096 2007-11-12 00:55 log
-rwxr-xr-x 1 root root  247 2006-06-29 04:25 run
lrwxrwxrwx 1 root root  15 2007-11-12 00:55 supervise -> /var/run/sv.ssh

/etc/sv/xdm:
total 4
-rwxr-xr-x 1 root root 39 2006-06-29 04:25 run
lrwxrwxrwx 1 root root 15 2007-11-12 00:55 supervise -> /var/run/sv.xdm


xaos5 11-15-2007 03:46 PM

bump, anybody?

I noticed its still running /etc/init.d/rcS in /etc/runit/1 which I think is why its still taking a while to bootup. I might spend some time in the future to try and "runit-tize" rcS. I'm going to try putting /etc/init.d/dbus start inside here also and see if it does anything for now.

edit: that worked, here is what my /etc/runit/1 looks like for reference:

Code:

#!/bin/sh
# system one time tasks

PATH=/sbin:/bin:/usr/sbin:/usr/bin

/etc/init.d/rcS
/etc/init.d/rmnologin start

# user added:
/etc/init.d/dbus start

rm -f /sbin/runit.old
touch /etc/runit/stopit
chmod 0 /etc/runit/stopit


JackieBrown 11-15-2007 09:16 PM

No help here, but wanted to acknoledge you.

I had no problems with dbus or anything else besides kdm.

Did you install runit-run and runit-services?

rasker 11-22-2007 04:21 AM

Runit works differently to normal init type scripts. Init type scripts usually spend much time and effort identifying the service they have started and writing it down somewhere (for the init scripts to read later). Runit does a lot of this for you.

This basically means that you have to try and make sure the daemon you are trying to run does not fork itself (use exec), change the user it run's under (use chpst) or background itself (this is your problem).

Instead of :
exec hald daemon=yes &

Use:

exec hald daemon=no &

I am using :

exec chpst -u haldaemon:haldaemon hald --daemon=no 2>&1. At this point (very early stages of migrating Fedora sysv to runit) this may or may not work. You do need to run it under it's own user name. If you don't do this it will fork itself and try and run itself under the right user name and then runit get mightily confused because all the pids are wrong.--demon=no tells hald not to fork.

I have found that it is a good idea to use your existing init scripts and remove anything that does what runit is supposed to do (start/stop, supervision, process id, changing users etc.). Thus you are tracking the requirements for your distro. You should be left with the sanity checks that ensure your service knows where everything is and the actual command to start the service. If any variables are required during runtime make sure they are EXPORTed so that any exec's inherit them.

Any special commands to stop the service should go in service/finish (i.e anything thats not killing the process) and any special commands to check the status should go in service/check (i.e anything that doesn't check the pid to decide if the service is up or down). The same rules apply if you are going to do custom logging (using the service/log directory).

I still haven't found a way to reliably fire off onetime scripts (e.g. network startup, irqbalance oneshot) so any help here would be appreciated.

R


All times are GMT -5. The time now is 07:29 PM.