Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to change my cpu speed using runlevel 1 on Ubuntu 8.10: the problem is when I try to run cpufreq_selector -f 2330000 (for instance), the following message appears:

Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory.

Then I figured out why, its because system_bus_socket runs as a daemon. and in Runlevel 1 mod all daemons are killed.

So my question is: is there a way to not kill this daemon? (so that i'll be able to select my CPU freq in runlevel 1)

Thank you for any answer!

NB: for those who're wondering why I must use Runlevel 1, the answer is that I need my OS to have less running tasks as possible, in order to performe some performance benching on my system.

share|improve this question
    
Could you change the title of the post to "Start a service by default in a runlevel" or something similar, since that's what you're effectively asking? –  nagul Oct 25 '09 at 10:40
add comment

1 Answer

You can certainly set the daemon to run during runlevel 1. You can also start a daemon by running its /etc/init.d/foo start if you just need it once and not started every time.

Assuming dbus is the name of the service you're wanting to run, use one of these commands to start it during runlevel 1.

Ubuntu's "native" tool for this is update-rc.d (manpage). Check when the service is currently run and killed; on my Debian system, dbus is started at 12 and killed at 88. You'll want to substitute numbers from your own system:

sudo update-rc.d dbus start 12 1 2 3 4 5 . stop 88 0 6
                   ^        ^   ^^^^^^^         ^   ^^
                   |        |      |            |    |
                   |        |      |            |    --- kill at these runlevels
                   |        |      |            -------- ordering for stopping service
                   |        |      --- start at these runlevels    
                   |        ---------- ordering for start
                   --- service name

You could also use chkconfig (manpage), available in Ubuntu's universe repositories. It's a little simpler for just enabling a service on a new runlevel:

sudo chkconfig --level 1 dbus on

Here's a good reference for managing services and runlevels on Ubuntu. Also see this related question: How do I set a Unix process to autorun in a particular run level?.

share|improve this answer
1  
+1 Excellent answer. I wish I could up vote it twice just for the ascii art –  DaveParillo Oct 23 '09 at 15:10
    
@DaveParillo: thx, but the format's shamelessly stolen from other posts on this site. too many arguments to that command not to explain it somehow. :) –  quack quixote Oct 23 '09 at 15:16
    
chkconfig shouldn't be used on Debian/Ubuntu; it won't work when some leftover startup scripts aren't purged. Use sysv-rc-conf instead. See help.ubuntu.com/community/SwitchingToUbuntu/… and bugs.launchpad.net/ubuntu/+source/chkconfig/+bug/450517 –  Tobu Jun 11 '10 at 12:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.