Bug 296315 - reboot(8): LOG_CONS passed as facility instead of logopt in openlog(3)
Summary: reboot(8): LOG_CONS passed as facility instead of logopt in openlog(3)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-06-27 10:04 UTC by Ricardo Branco
Modified: 2026-07-08 05:17 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ricardo Branco 2026-06-27 10:04:23 UTC
reboot(8) is buggy on a Dell laptop and a GMKtec Nucbox while `shutdown -r` works.  While trying to debug this I came across this issue:

reboot(8), halt(8), etc. all call openlog(3) with LOG_CONS OR'd into the facility argument instead of logopt.

shutdown(8) and init(8) both use the correct form:
    openlog("shutdown", LOG_CONS, LOG_AUTH);
Comment 1 Ricardo Branco 2026-06-27 10:06:12 UTC
Fix: https://github.com/freebsd/freebsd-src/pull/2300
Comment 2 Ricardo Branco 2026-06-27 11:53:42 UTC
Unrelated to this specific bug but:

> reboot(8) is buggy on a Dell laptop and a GMKtec Nucbox while `shutdown -r` works.

I forgot to mention that this happens only on 15-STABLE.  I compiled the version from 16-CURRENT and it works.  This commit should have been MFC'ed to 15-STABLE months ago:

https://github.com/freebsd/freebsd-src/commit/4453ec5b8716bc465ff5192986099dc75d1f2ce7
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2026-06-27 11:58:51 UTC
^Triage: Cc: original committer.
Comment 4 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-06-30 11:53:39 UTC
If by “buggy” you mean “does not behave like its GNU counterpart” then allow me to point out that ours predates yours by at least a decade.  We've reluctantly changed ours because the world has become accustomed to your buggy copy, but we will not merge that change to a stable branch.
Comment 5 Ricardo Branco 2026-06-30 12:40:47 UTC
(In reply to Dag-Erling Smørgrav from comment #4)

> If by “buggy” you mean “does not behave like its GNU counterpart” then allow me to point out that ours predates yours by at least a decade.  We've reluctantly changed ours because the world has become accustomed to your buggy copy

WDYM by "ours" & "yours"?  Please don't pay attention to any part of the string after the "@" in my e-mail.  I speak only for myself.  I like *BSD as much as Linux.

By "buggy" I mean that it hangs and never finishes the reboot.

> but we will not merge that change to a stable branch.

What's wrong with that?  Why keep it in the -CURRENT branch then?
Comment 6 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-07-06 08:04:33 UTC
(In reply to Ricardo Branco from comment #5)
> By "buggy" I mean that it hangs and never finishes the reboot.

And how exactly was I supposed to deduce that from your report?

Please read this: https://www.chiark.greenend.org.uk/~sgtatham/bugs.html
Comment 7 Ricardo Branco 2026-07-06 08:26:20 UTC
(In reply to Dag-Erling Smørgrav from comment #6)
> And how exactly was I supposed to deduce that from your report?

By reading it in full before jumping to wild "us vs. them" claims. That part was vague because I didn't know what was happening yet, but then I found out and added a new comment which is #2. 

But anyway, this is irrelevant now.

Why do you think it shouldn't be MFC'ed to -STABLE?
Comment 8 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-07-06 08:57:11 UTC
(In reply to Ricardo Branco from comment #7)
> I didn't know what was happening yet, but then I found out and added a new comment which is #2.

There is no useful information in comment #2.  It comes across as “I think reboot should do what shutdown -r does”.

If reboot(8) is failing to behave the way it is documented to behave, please file a separate ticket with something more substantial than “it doesn't work”.  Preferably _after_ you've read the article I linked to.

> Why do you think it shouldn't be MFC'ed to -STABLE?

We try not to break compatibility on stable branches.
Comment 9 Ricardo Branco 2026-07-06 09:13:53 UTC
(In reply to Dag-Erling Smørgrav from comment #8)

Then what does this mean?

MFC after:	1 month

https://github.com/freebsd/freebsd-src/commit/4453ec5b8716bc465ff5192986099dc75d1f2ce7

dag-erling committed on Dec 10, 2025
Comment 10 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-07-06 11:36:58 UTC
(In reply to Ricardo Branco from comment #9)

It means I originally intended to MFC but was persuaded not to.

Can we please stay on topic?
Comment 11 Ricardo Branco 2026-07-06 11:51:36 UTC
(In reply to Dag-Erling Smørgrav from comment #10)

I had to ask.  How was I supposed to know the answer to that question?

And there's no topic now.  I found 2 issues and submitted the fix for one and found that the other is already fixed in -CURRENT.

I didn't ask for a BSD vs GNU flame war.  I'm too old for that even in my mid 40s.
Comment 12 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-07-06 12:16:29 UTC
(In reply to Ricardo Branco from comment #11)
> I found 2 issues and submitted the fix for one and found that the other is already fixed in -CURRENT.

No, it is not.  Please file another ticket describing in detail what happens when you try to reboot your FreeBSD 15 machine with its original reboot(8) command.
Comment 13 commit-hook freebsd_committer freebsd_triage 2026-07-08 05:17:26 UTC
A commit in branch main references this bug:

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

commit f723b28c9663b70045e6db07f9fe72422a609c16
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2026-06-27 10:04:48 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-07-08 05:16:01 +0000

    reboot: fix openlog(3) calls

    LOG_CONS was OR'd into the facility argument instead of logopt, leaving
    logopt as 0.  The correct call is openlog(ident, LOG_CONS, LOG_AUTH),
    as shutdown(8) and init(8) already do.

    PR:     296315
    Signed-off-by: Ricardo Branco <rbranco@suse.de>
    Reviewed by: imp, des
    Pull Request: https://github.com/freebsd/freebsd-src/pull/2300

 sbin/reboot/reboot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)