Change CPUfreq in runlevel 1?

1

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.

Moho

Posted 2009-10-23T12:38:56.397

Reputation:

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? – None – 2009-10-25T10:40:46.340

Answers

4

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?.

quack quixote

Posted 2009-10-23T12:38:56.397

Reputation: 37 382

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 https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux#Services,%20Chkconfig%20and%20Initscripts and https://bugs.launchpad.net/ubuntu/+source/chkconfig/+bug/450517

– Tobu – 2010-06-11T12:06:22.360

1+1 Excellent answer. I wish I could up vote it twice just for the ascii art – DaveParillo – 2009-10-23T15:10:22.557

@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 – 2009-10-23T15:16:44.403