Bug 251743 - uname -r shows 12.2-RELEASE-p1 on 12.2-RELEASE-p2
Summary: uname -r shows 12.2-RELEASE-p1 on 12.2-RELEASE-p2
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-10 21:39 UTC by Evilham
Modified: 2022-11-03 15:31 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evilham 2020-12-10 21:39:44 UTC
After upgrading a system to 12.2-RELEASE-p2, I was super confused, and not as innocuously, some automation and provisioning broke due to following:

# uname -r
12.2-RELEASE-p1

# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 12.2-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 12.2-RELEASE-p2.

# freebsd-version 
12.2-RELEASE-p2


Was this a slip on latest patch due to how quickly it had to be prepared? Or is uname -r an unreliable way to get the patch version on FreeBSD?
Comment 1 Yuri Pankov freebsd_committer freebsd_triage 2020-12-10 21:44:22 UTC
Yes, correct way is to use freebsd-version(1), check the man page for options.
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2020-12-10 21:56:25 UTC
https://www.freebsd.org/security/advisories/FreeBSD-SA-20:33.openssl.asc update openssl files, but not kernel.
uname show kernel version only, but not system version.
Comment 3 Evilham 2020-12-10 22:21:19 UTC
Thanks, I have read both freebsd-version(1) and uname(1).

Indeed that, and seeking not to special-case FreeBSD when dealing with multiple BSDs is where confusion comes from.

For comparison, uname(1) in other BSDs:
     -r      print the operating system release.

And from uname(1) in FreeBSD:
     -r      Write the current release level of the operating system to
             standard output.

That description would seem to imply that "12.2-RELEASE-p2" is the expected output on a fully upgraded system.

The replies to this bug report appear to indicate that that's not supposed to be the case, so could we patch uname(1) to reflect what uname -r actually means?

I lack the understanding as to what the slight difference is and what exactly uname -r means, so I don't feel confident proposing the documentation patch.
Comment 4 c.brinkhaus 2020-12-14 18:08:09 UTC
I have the same behaviour on three boxes as below. I have not updated more than this three computers.
freebsd-version -urk
12.2-RELEASE-p1
12.2-RELEASE-p1
12.2-RELEASE-p2
The running kernel is reported as 12.2-RELEASE-p1 and the available as 12.2-RELEASE-p2. I expected to see the running kernel as 12.2-RELEASE-p2 after reboot. But the output of freebsd-version -urk remains the same. I do not think that this is a serious issue. But this behaviour is unexpected for me.
Comment 5 c.brinkhaus 2020-12-14 18:16:00 UTC
I should have read that first:

"If several of the above options are specified, freebsd-version will print    
the installed kernel version first, then the running kernel version, and
finally the userland version, on separate lines.  If neither is speci-
fied, it will print the userland version only."

Both freebsd-version -urk and freebsd-version -kru give the same output and not sorted according to the options. Ten the userland is at 12.2-RELEASE-p2 and the kernel still at 12.2-RELEASE-p1. This clarifies the behaviour.