Bug 258320

Summary: etc/rc.d/powerd: powerd_flags apparently vanished
Product: Documentation Reporter: Michael <michael.hmich>
Component: Manual PagesAssignee: Guangyuan Yang <ygy>
Status: Closed FIXED    
Severity: Affects Some People CC: doc, fbsdbugs4, felix.the.red, jamie, nate, pstef, ygy
Priority: --- Keywords: easy, patch
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
powerd(8) patch none

Description Michael 2021-09-06 18:19:31 UTC
I looked for it but haven't found it, neither on Freebsd'd online dos and man pages

then I set like in "old times" and powerd_flags in rc.conf are still working as expected 

probably worse to have a look at it

thanks
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-09-07 02:12:19 UTC
Thank you for your report Michael.

It appears 'powerd_flags' was removed from the /etc/rc.d/powerd rc script in 2005: 

  https://github.com/freebsd/freebsd-src/commit/7f19cfc0addb24319a4c7789c07546c720070637

If you have reason to believe or recent evidence to suggest that powerd_flags existed in other forms in currently supported (non-EoL) FreeBSD version branches, and/or that powerd_flags was inadvertently removed, please re-open this issue with additional information
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2021-09-07 02:13:01 UTC
*** Bug 258321 has been marked as a duplicate of this bug. ***
Comment 3 Jamie Landeg-Jones 2021-09-07 15:04:55 UTC
powerd_flags are still used.

The line: command_args="${powerd_flags}"

was removed as it's redundant - The rc subsystem automatically sets command_args to {progname}_args

You only need to use this if setting the args from another program, eg:

/etc/rc.d/ypbind:command_args="${nis_client_flags}"

# uname -a
FreeBSD catflap.dyslexicfish.net 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
# 
# grep powerd /etc/rc.conf
powerd_flags="-b boo"
powerd_enable=YES
# 
# service powerd start
Starting powerd.
powerd: bad option: -b boo
/etc/rc.d/powerd: WARNING: failed to start powerd
#

Cheers Jamie
Comment 4 Michael 2021-09-08 10:06:19 UTC
(In reply to Jamie Landeg-Jones from comment #3)

obviously it fails because -b boo doesn't exist ...

but works with real options, without options powerd is running blank, apparently there are no default options hardcoded 

I got curious because my pc run constantly on full power 

after setting

powerd_enable="YES"
powerd_flags="-n adp"

it is working now as it should
Comment 5 Jamie Landeg-Jones 2021-09-08 12:13:11 UTC
Um, I know that!

I was replying to Kubilay who said that powerd_flags area no longer used, and then closed this ticket!

I intentionally set the flags in my example to something invalid to show they are still being processed!

Incidentally (and I'm not mentioning this as a resolution to your reported issue, but just for info), I found /usr/ports/sysutils/powerdxx/ (a drop in replacement for powerd) better as in addition to lowering CPU speed when idle, it monitors CPU temperature, and will throttle if that gets too high.

By the way, this ticket is still closed - you should reopen it!

Cheers
Comment 6 Michael 2021-09-08 14:41:47 UTC
(In reply to Jamie Landeg-Jones from comment #5)

ok! I see and will check this powerdxx, thanks for the tip
Comment 7 Piotr Pawel Stefaniak freebsd_committer freebsd_triage 2021-09-20 18:00:59 UTC
powerd_flags is mentioned in RC.CONF(5).
Comment 8 Michael 2021-09-21 13:40:31 UTC
well, still you need a wizzard at your side ...

     powerd_flags
                 (str) If powerd_enable is set to “YES”, these are the flags
                 to pass to the powerd(8) daemon.


the wizzard then solves the riddle "these" for you :)
Comment 9 Piotr Pawel Stefaniak freebsd_committer freebsd_triage 2021-09-21 14:54:40 UTC
It just means that whatever you put into the variable, will be passed to powerd. So you do `man 8 powerd` and pick whatever you want.
Comment 10 Michael 2021-09-21 20:45:41 UTC
well doesn't help so much when we both are tingling around, when you think that it is all right, ok, who am I ...

in any case, in man powerd is not one word about rc.conf, it also doesn't talk about flags, it tells us that are options to call the daemon with

in resume, it is not about me, I can help myself, but a new average user, in this case, can not figure out what and how to do
Comment 11 Trev 2021-09-21 22:13:05 UTC
How about resolving this by adding rc.conf(5) to the powerd man page SEE ALSO
Comment 12 Felix Johnson freebsd_triage 2021-10-01 06:39:21 UTC
Created attachment 228304 [details]
powerd(8) patch

Include reference to rc.conf(5) in SEE ALSO.
Comment 13 commit-hook freebsd_committer freebsd_triage 2021-11-07 02:45:08 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ec071430a7822997619fe6d99853d8f49ea10b20

commit ec071430a7822997619fe6d99853d8f49ea10b20
Author:     Felix Johnson <felix.the.red@gmail.com>
AuthorDate: 2021-11-07 02:39:23 +0000
Commit:     Guangyuan Yang <ygy@FreeBSD.org>
CommitDate: 2021-11-07 02:43:30 +0000

    powerd(8): Add rc.conf(5) to see also

    powerd_flags is mentioned in rc.conf(5) and can be set there and pass to
    powerd.

    PR:             258320
    MFC after:      3 days
    Reported by:    Michael <michael.hmich@gmail.com>

 usr.sbin/powerd/powerd.8 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Comment 14 commit-hook freebsd_committer freebsd_triage 2021-11-10 19:14:15 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e8e8c6c2bf3279d2e12f6a89dfbe9452824a3cb3

commit e8e8c6c2bf3279d2e12f6a89dfbe9452824a3cb3
Author:     Felix Johnson <felix.the.red@gmail.com>
AuthorDate: 2021-11-07 02:39:23 +0000
Commit:     Guangyuan Yang <ygy@FreeBSD.org>
CommitDate: 2021-11-10 19:12:59 +0000

    powerd(8): Add rc.conf(5) to see also

    powerd_flags is mentioned in rc.conf(5) and can be set there and pass to
    powerd.

    PR:             258320
    Reported by:    Michael <michael.hmich@gmail.com>

    (cherry picked from commit ec071430a7822997619fe6d99853d8f49ea10b20)

 usr.sbin/powerd/powerd.8 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Comment 15 Michael 2021-11-10 20:38:39 UTC
cool, thanks :)