Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
systemd service file for cpufreqd and other
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Mon Feb 27, 2012 3:29 pm    Post subject: systemd service file for cpufreqd and other Reply with quote

Hi, even though I am not new to gentoo, it's the first time i write in this forum, sorry for my mistakes with English!

I was searching and googling for a while and... maybe i'm a bit dumb... but I couldn't find the right way to get cpufreqd, and other daemons working with systemd.

I found in http://aur.archlinux.org/packages.php?ID=54252 a package with a service file and a shell script, and i'm trying to adapt it from Arch linux to Gentoo. But, is there any overlay or something where i can get a "gentoo way" for this??

I'm also trying to find a way to get ureadahead, laptop-mode-tools, etc., and it is hard to find documentation. Does anyone know about this?

Thanks!
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Mon Feb 27, 2012 4:23 pm    Post subject: Reply with quote

You can usually just use service files from other distributions - cross-distro compatibility that's one of the ideas of systemd. For instance, here's a unit for laptop_mode (if google is second-guessing you, put "systemd" in quotes when you search). And if you really can't find a unit you're looking for, it's usually pretty easy to write your own - systemd has excellent manpages and you can also read Lennart's "systemd for Administrators" series for some explanations, such as this one.

I can't find units for cpufreqd probably because nowadays most people just use the ondemand, and you don't need ureadahead since systemd already comes with its own readahead service.
_________________
“And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Tue Feb 28, 2012 12:16 pm    Post subject: Reply with quote

Hi! Thank you very much for your response. At the moment, I've got lm_sensors, syslog-ng, laptop-mode, gdm and cpufrequtils service files working as spected.

But I'm still stucked with cpufreqd... I was trying hundred times, and the best result I've got was this:

"cpufreqd[1304]: segfault at 8 ip 00007fdeb07c51c1 sp 00007fff68213298 error 4 in libc-2.13.so[7fdeb0745000+181000]"

If I set "systemd.log_level=debug" in the kernel command line, it doesn't help me at all cause it gives me no new information about that error... Searching in google, there are millions of possible causes... Could anyone help me? This is the last service file that I found in http://aur.archlinux.org/packages.php?ID=43484 and is giving me this error.

### cpufreqd.service
[Unit]
Description=Cpufreqd daemon
After=acpid.service lm_sensors.service cpufrequtils.service

[Service]
ExecStart=/usr/sbin/cpufreqd -D
ExecStop=/bin/kill -INT $MAINPID

[Install]
WantedBy=multi-user.target
#### End Of File

Thanks!!
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Tue Feb 28, 2012 3:14 pm    Post subject: Reply with quote

Does it work if you run "/usr/sbin/cpufreqd -D" from command-line?

You can also try running it with out the "-D" but with Type=forking (but then you might have to also change how you stop it)
_________________
“And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Tue Feb 28, 2012 5:02 pm    Post subject: Reply with quote

Hi!

When I run /usr/sbin/cpufreqd -D -V 7 from command-line, it works fine. Without -D and -V params it is also working fine... but still doesn't work from systemd service file! Arghghghgh!!! :x

I tried Type=forking, oneshot, RemainAfterExit=yes ... No way. Also with/without -D, -V flags...

This is the last cpufreqd.service:

[Unit]
Description=Cpufreqd daemon

[Service]
Type=forking
ExecStart=/usr/sbin/cpufreqd
ExecStop=/bin/kill `ps -C cpufreqd -o pid= `

[Install]
WantedBy=multi-user.target

BTW, my pc is a Dell Vostro laptop, proc. core2 duo 1.8ghz with enough RAM, and updated gentoo amd64 (multilib)... Maybe it is useful! :)

Thanks, cheers!
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Wed Feb 29, 2012 12:10 am    Post subject: Reply with quote

I just emerged cpufreqd and tried your first service file, and it works fine for me 8O

Code:
# systemctl start cpufreqd.service
# systemctl status cpufreqd.service
cpufreqd.service - Cpufreqd daemon
     Loaded: loaded (/etc/systemd/system/cpufreqd.service; disabled)
     Active: active (running) since Tue, 28 Feb 2012 19:03:30 -0500; 1s ago
   Main PID: 31555 (cpufreqd)
     CGroup: name=systemd:/system/cpufreqd.service
        └ 31555 /usr/sbin/cpufreqd -D

# systemctl --version
systemd 43
gentoo
+PAM +LIBWRAP -AUDIT -SELINUX -SYSVINIT -LIBCRYPTSETUP


I'm guessing maybe you're using version 29, and maybe it had some bug that was fixed?
_________________
“And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Wed Feb 29, 2012 2:52 am    Post subject: Reply with quote

You are right! I'm using version 29 of systemd.

The thing is that I tried to unmask udev >171 (actually I don't like to install masked packages at all (just in cases)), and I found it very 'tricky'... Is it really necessary to do all this changes below in package.keywords and package.unmask??

package.keywords:

sys-libs/libnih ~amd64
sys-fs/udev **
sys-fs/udev-init-scripts **
sys-apps/kmod **
sys-apps/systemd ~amd64

package.unmask:

~sys-fs/udev-172
~sys-fs/systemd-43

Cheers!
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Wed Feb 29, 2012 5:50 pm    Post subject: Reply with quote

Unfortunately, yes. Those packages are masked until the Gentoo devs come up with a satisfactory solution for people with separate /usr partitions - since udev (and systemd) no longer support booting without /usr available (they'll need an initrd). This of course means that these new packages are not as well tested, since less people use them, so beware! ;)

erTrabubu wrote:
sys-fs/udev **
sys-fs/udev-init-scripts **
sys-apps/kmod **


Don't do this - use "~amd64" instead since the packages have the keywords, they're just masked.
_________________
“And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Wed Feb 29, 2012 5:52 pm    Post subject: Reply with quote

Hi! I'm still trying to make cpufreqd work. I made changes in portage package.* files, emerged systemd-43 (and also udev-181, etc)... And still cpufreqd doesn't work.

I should tell you, my laptop has portage tree up to date and also packages and (I think) /etc directory, but gentoo was installed about 2 years ago... That way my /etc/portage is a bit messed up.

At the moment I'm re-installing glibc-2.13... Maybe the problem is something related to this...
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Tue Mar 06, 2012 11:30 am    Post subject: Reply with quote

Ok, so, I'm getting mad with this. After some days working with cpufreqd, I can say "I have no idea why is not working for me"... Even after a fresh install of gentoo (yes, I formatted my laptop just for make cpufreqd work... and I got NOTHING!!)

I was trying to get it running as always: emerge -v cpufreqd. With portage version, cpufreqd compiles, but then when i start the service:

/etc/init.d/cpufreqd start gives me a buffer overflow --> this is solved by keywording cpufreqd, and emerging 2.4.2-r1 version. After that, cpufreqd seems to start and I can read "[ OK ]", but cpufreqd isn't working... ?¿?!!!?¿

If I start from command-line with #cpufreqd -D -V 7 it tells me something like "invalid pointer reference... invalid free() instruction...blablabla Aborted.". Searching in internet I can't find anything for make it work (again, maybe I'm a bit dumb with 'uncle google'): everybody says that is working perfectly, and the last bug report is always older than 2005.

So, anybody knows something???? I'm getting mad!!!

Thanks

PS: Some years ago, someone spilt coffee on my dear laptop, so my battery is totally missing (15 min o so) and also, my cpu sometimes gets burning and the laptop suddenly shuts down... that way I really need cpufreqd... Maybe, I should give up... but then laptops's life will decrease very hard.
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Tue Mar 06, 2012 3:17 pm    Post subject: Reply with quote

Etal, could you post your kernel config file (grep FREQ and grep ACPI)??? I think my kernel has a missing option for cpufreqd... but i have no idea which of them...

I have noticed that cpufreqd is crashing when handling cpufreqd_acpi.so plugin. :idea: Maybe, I am missing something related to deprecated /proc/acpi files in kernel config, right?

At the moment I'm using another computer... my laptop is compiling X and KDE (with powersave governor :( ), so it is easier to write here in this forum from another computer! that way I can't post my kernel config :)

Thank you very much
Back to top
View user's profile Send private message
MetalGod
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 816
Location: Portugal

PostPosted: Tue Mar 06, 2012 3:52 pm    Post subject: Reply with quote

After you have your issue fixed please submit the systemd unit to the bugzilla so the maintainers can add the unit to the ebuild. This way all systemd users will benefit (like me).
_________________
ex: Gentoo Linux Developer: amd64 media-optical sound gnome
ex: Portuguese Moderator
------------------------------------------------------------------------------
God Doesn't Play Dice
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Wed Mar 07, 2012 12:04 pm    Post subject: Reply with quote

Quote:
After you have your issue fixed please submit the systemd unit to the bugzilla so the maintainers can add the unit to the ebuild. This way all systemd users will benefit (like me)


Yes, of course. At the moment, I have a working lm_sensors service file, a cpufrequtils.service, a laptop_mode.service, a couple of syslog-ng.service, gdm@.service and a kdm@.service

I have a bugzilla user, and I think it would be interesting to upload all my (working and tested) service files, and other's users files as well, to make like a "systemd service files database" or something, isn't it?

Also, could you help me (or tell me how) to open a new bugzilla report for this?

------------

My issue with cpufreqd is STILL NOT solved. I have to make a couple of test... And maybe I need to open a new thread on this forum (or a bug in bugzilla), cause originally this thread was for get a working cpufreqd.service and other files for systemd... But now, all related stuff and problems are exclusively from cpufreqd... and nothing to do with systemd...
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Wed Mar 07, 2012 8:51 pm    Post subject: Reply with quote

Hi! Today I wrote some service files for cpufrequtils (based on arch's one and the gentoo init script), microcode-ctl (keeping behaviour of gentoo's init script), hwclock (also keeping behaviour of init script), lm_sensors and also I got some more from other distros or packages. (arch linux distro, syslog-ng package, etc)

Should I upload them here? or, is there a better place for upload them? I think my hwclock service file is thousand times better than the one in gentoo's wiki :P

Thanks!
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1931

PostPosted: Thu Mar 08, 2012 4:21 pm    Post subject: Reply with quote

Here's my config parts that you requested.

Code:
$ zgrep -e ACPI -e FREQ /proc/config.gz
# Power management and ACPI options
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
# CONFIG_ACPI_PROCFS is not set
# CONFIG_ACPI_PROCFS_POWER is not set
# CONFIG_ACPI_EC_DEBUGFS is not set
# CONFIG_ACPI_PROC_EVENT is not set
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_FAN=y
# CONFIG_ACPI_DOCK is not set
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_PROCESSOR_AGGREGATOR=y
CONFIG_ACPI_THERMAL=y
# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_ACPI_CONTAINER=y
CONFIG_ACPI_SBS=y
CONFIG_ACPI_HED=y
CONFIG_ACPI_APEI=y
CONFIG_ACPI_APEI_GHES=y
CONFIG_ACPI_APEI_PCIEAER=y
# CONFIG_ACPI_APEI_ERST_DEBUG is not set
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
# CONFIG_X86_PCC_CPUFREQ is not set
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_PNPACPI=y
CONFIG_ATA_ACPI=y
# ACPI drivers
# ACPI drivers
# CONFIG_SENSORS_ACPI_POWER is not set
CONFIG_THINKPAD_ACPI=y
CONFIG_THINKPAD_ACPI_ALSA_SUPPORT=y
# CONFIG_THINKPAD_ACPI_DEBUGFACILITIES is not set
# CONFIG_THINKPAD_ACPI_DEBUG is not set
# CONFIG_THINKPAD_ACPI_UNSAFE_LEDS is not set
# CONFIG_THINKPAD_ACPI_VIDEO is not set
# CONFIG_THINKPAD_ACPI_HOTKEY_POLL is not set
# CONFIG_ACPI_WMI is not set
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_TOSHIBA is not set
# CONFIG_ACPI_CMPC is not set
CONFIG_PM_DEVFREQ=y
# DEVFREQ Governors
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set
# CONFIG_DEVFREQ_GOV_POWERSAVE is not set
# CONFIG_DEVFREQ_GOV_USERSPACE is not set
# DEVFREQ Drivers


If it crashes from command-line, you can make a backtrace and file a bug report. Add "-ggdb" to your CFLAGS and re-emerge the package (don't forget to remove the flag otherwise your binaries will take tons of disk space). Then, run it with gdb (emerge it if you don't have it):

Code:
$ gdb cpufreqd
Enable logging:
(gdb) set logging file backtrace.log
(gdb) set logging on
Run with the arguments:
(gdb) run -D -V 7
once it crashed:
(gdb) bt
...
(gdb) quit


After that, upload attach backtrace.txt to bugzilla.


And as for unit files, you can also post them on the old wiki.
_________________
“And even in authoritarian countries, information networks are helping people discover new facts and making governments more accountable.”– Hillary Clinton, Jan. 21, 2010
Back to top
View user's profile Send private message
erTrabubu
n00b
n00b


Joined: 27 Feb 2012
Posts: 10
Location: Sevilla, Spain

PostPosted: Thu Mar 22, 2012 10:55 am    Post subject: Reply with quote

Hi! After some days working with my laptop... finally I solved heat problem by disassembing my laptop and cleaning it. Now it does not burn anymore!! :D

BUT cpufreqd still does not work. It crashes only when it is started with systemd service file. Otherwise it does work!! 8O

Now, after format, reinstall, reconfigure everything, etc... next step is gdb...

My 'working' service files are in https://bugs.gentoo.org/show_bug.cgi?id=318365 I hope they are useful for you all.


Cheers!
Back to top
View user's profile Send private message
s_j_newbury
n00b
n00b


Joined: 05 Apr 2007
Posts: 56
Location: UK

PostPosted: Wed Mar 28, 2012 4:18 pm    Post subject: Reply with quote

erTrabubu wrote:
Hi! After some days working with my laptop... finally I solved heat problem by disassembing my laptop and cleaning it. Now it does not burn anymore!! :D

BUT cpufreqd still does not work. It crashes only when it is started with systemd service file. Otherwise it does work!! 8O

Now, after format, reinstall, reconfigure everything, etc... next step is gdb...

My 'working' service files are in https://bugs.gentoo.org/show_bug.cgi?id=318365 I hope they are useful for you all.


Cheers!

I've been fixing bugs in cpufreqd today:

o Segfault on failed reading of battery attributes

o Parser bug for support for independent CPU profiles

Will create/update bugzilla.... any other bugs..? ;-)
Back to top
View user's profile Send private message
s_j_newbury
n00b
n00b


Joined: 05 Apr 2007
Posts: 56
Location: UK

PostPosted: Wed Mar 28, 2012 4:51 pm    Post subject: Reply with quote

Crash bug: https://bugs.gentoo.org/show_bug.cgi?id=410033

Multi-cpu bug: https://bugs.gentoo.org/show_bug.cgi?id=410037
Back to top
View user's profile Send private message
rozenkno
n00b
n00b


Joined: 01 Sep 2013
Posts: 1

PostPosted: Sun Sep 01, 2013 10:55 am    Post subject: Reply with quote

Hi!
I had the same problem, cpufreqd running from command line but not as a systemd service.
Code:
systemctl --version
systemd 206
+PAM +LIBWRAP -AUDIT -SELINUX +IMA -SYSVINIT -LIBCRYPTSETUP -GCRYPT +ACL -XZ


Calling it with start-stop-daemon seems to solve my problem. Here is my service file /etc/systemd/system/cpufreqd.service :

Code:
[Unit]
Description=CPU overheating control
After=acpid.service

[Service]
ExecStart=/sbin/start-stop-daemon /usr/sbin/cpufreqd -- -f /etc/cpufreqd.conf
Type=forking
PIDFile=/var/run/cpufreqd.pid

[Install]
WantedBy=multi-user.target


(the same pid file is set in /etc/cpufreqd.conf)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum