Determining the version of FreeBSD

I have a network appliance whose OS and shell is based on FreeBSD. I am unable to determine which version of FreeBSD it is. The uname -a command only returns the name and version of the appliance. The FreeBSD copyright strings I have found do not indicate the version. I do not have the source code for the appliance.

Is there a way to discover the major/minor release of FreeBSD by looking at the file system? Unique changes in the size and presence of files and directory structure as FreeBSD has evolved should give definite clues to the identity of each release. Has anyone compiled this type of information?
 
Tricky. I do believe if you change the name it also changes those sysctl's.

Looking at binaries probably isn't helpful either. Different compiler options will result in different binaries making a straight comparison rather difficult.

I thought looking at the version of libc would be a good way but 9.0 and 8.x have the same version. So that's not good either.
 
jdmurray said:
Is there a way to discover the major/minor release of FreeBSD by looking at the file system? Unique changes in the size and presence of files and directory structure as FreeBSD has evolved should give definite clues to the identity of each release. Has anyone compiled this type of information?
If you have access to the include files and they haven't had all useful information stripped out, you may find something like this, from /usr/include/sys/syscall.h:

Code:
/*
 * System call numbers.
 *
 * DO NOT EDIT-- this file is automatically generated.
 * $FreeBSD: src/sys/sys/syscall.h,v 1.233.2.6 2012/01/06 19:33:27 jhb Exp $
 * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb 
 */

If that isn't useful, try doing a [cmd=""]ident /boot/kernel/kernel[/cmd] which will give you the version header info for everything compiled into the kernel, including datestamps. It should also show you the FreeBSD CVS version number and committer name - the first will help you compare version numbers to the FreeBSD CVS repository. As long as the appliance vendor hasn't wholesale-renumbered the versions, this info should be useful.

To give you an example, my kernel starts off like this:
Code:
(141:118) node:/tmp# ident /boot/kernel/kernel | more
/boot/kernel/kernel:
     $FreeBSD: src/sys/cam/cam.c,v 1.13.2.5 2010/08/05 10:45:27 bcr Exp $
     $FreeBSD: src/sys/cam/cam_periph.c,v 1.80.2.14 2012/01/31 23:09:27 ken Exp $
     $FreeBSD: src/sys/cam/cam_queue.c,v 1.9.22.3 2009/12/02 10:10:37 mav Exp $
     $FreeBSD: src/sys/cam/cam_sim.c,v 1.13.2.2 2010/02/14 19:38:27 mav Exp $
     $FreeBSD: src/sys/cam/cam_xpt.c,v 1.217.2.37 2012/01/31 23:09:27 ken Exp $
 
SirDice said:
Tricky. I do believe if you change the name it also changes those sysctl's.
This is true. The [cmd=]sysctl -n kern.osrelease kern.ostype[/cmd] command suggested by pelmen only displays the appliance's version and OS name.

Terry_Kennedy said:
If you have access to the include files and they haven't had all useful information stripped out, you may find something like this, from /usr/include/sys/syscall.h:
Nope, no /usr/include or /include on this device.

Terry_Kennedy said:
If that isn't useful, try doing a
ident /boot/kernel/kernel
Nope, no 'ident' command on this box.


This is a tough one.
 
jdmurray , I think what you're looking for is either, or both of freebsd-version(1), and uname(1)-U.
freebsd-version(1) returns the equivalent of uname -r eg; 12.0-CURRENT (osrelease), whereas uname -U returns the equivalent of uname -K eg; 1200054 (osreldate). These values are returned from the jail(8), or "guest"; as opposed to from the host. If the (jail/guest) $base, and kernel were both cut from the same source revision. It's a safe bet the results returned are correct.

HTH!

EDIT
Just to appease the gods that be;
Yes. I know this post is ancient. But hey; I was looking for an answer to this very same question, and DuckDuck brought me here. Turns out this question had no answer. But a little experimentation, and man(1) page reading enlightened me. So I thought I'd be gracious enough to "share the knowledge". Please don't beat me with a stick, for trying to help. :rolleyes:

--Chris
 
Last edited:
Yes indeed. But I felt it was still worth replying. Because should anyone else have the same question. A simple search of the Forums will provide an answer, rather than make yet another (same) question. :)

--Chris
 
For what it's worth, if I answer a very old thread, I give the reason, e.g, Google brought me here and even though it's 5 years old, the problem persists, and so on. Of course, on Arch, they'll close it anyway, but they are an extremely busy forum and while I often disagree with them closing, I've sometimes email the mod who did it and said, Hey, google brought me here, the problem persists, it might be worth adding a note to the closing post, and they will sometimes add such a note.
But it is always good to mention that a) you've noticed a post is very old, and b) why you are posting to it, best reason, IMHO, because searching your question brought you to the thread. Of course, and I'm sure it's happened to many people, sometimes one finds a solution, gets excited about it, and doesn't realize they're posting to a several year old post too. :)
 
OK I edited my reply, above. Technically speaking I didn't have the same question. But was interested in my jail(8) environment, and wanting to make it reflect the actual osrelease, and osreldate;
11.1-STABLE, and 1101506, respectively. The answer to my needs, also answered the question here -- bonus. :)
Oh, and speaking of; for bonus points, here's how I managed to adjust my jail(8) environment to reflect it's actual release:
Code:
# uname -r, freebsd-version
osrelease = 11.1-STABLE;
# /usr/obj/usr/src/include/osreldate -- uname -K, uname -U
osreldate = 1101506;
Commented for better understanding, for inquiring minds, that need to know. Entered in the jail.conf(5) that reflects the jail(8) I was working in.

Are we good now? :D

--Chris
 
If you are using FreeBSD 13 or higher, you can get from os-release().

# cat /etc/os-release
NAME=FreeBSD
VERSION=13.0-STABLE
VERSION_ID=13.0
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 13.0-STABLE"
CPE_NAME=cpe:/o:freebsd:freebsd:13.0
HOME_URL=https://FreeBSD.org/
BUG_REPORT_URL=https://bugs.FreeBSD.org/
 
Yes indeed. But I felt it was still worth replying. Because should anyone else have the same question. A simple search of the Forums will provide an answer, rather than make yet another (same) question. :)

--Chris
Thanks for your posts in this thread. I need to get version info from a number of FreeBSD versions and this thread is a nice collection of methods to try that will work across versions. I'm sorry your contribution was met with a few less than positive responses.
 
If that isn't useful, try doing a [cmd=""]ident /boot/kernel/kernel[/cmd] which will give you the version header info for everything compiled into the kernel, including datestamps. It should also show you the FreeBSD CVS version number and committer name - the first will help you compare version numbers to the FreeBSD CVS repository. As long as the appliance vendor hasn't wholesale-renumbered the versions, this info should be useful.
Old thread but still top google search hit for me, so worth replying - sorry for the necromancy.

It looks like you may now want what /boot/kernel/kernel rather than ident. I'm sure other people here can fill in few more details on the whens and whys!
 
Hello.

I've installed FreeBSD 15.0-ALPHA2 to the sd card (or its better to say that I dd'ed the img file of FreeBSD 13.0 and then I copied manually the files of the 15.0 there) and now freebsd-version says :

Code:
# freebsd-version -ukr

15.0-ALPHA2
15.0-ALPHA2
13.0-RELEASE-p6

it says r = 13.0-RELEASE-p6. Where does it get this information ? thanks.
 
Hello.

I've installed FreeBSD 15.0-ALPHA2 to the sd card (or its better to say that I dd'ed the img file of FreeBSD 13.0 and then I copied manually the files of the 15.0 there) and now freebsd-version says :

Code:
# freebsd-version -ukr

15.0-ALPHA2
15.0-ALPHA2
13.0-RELEASE-p6

it says r = 13.0-RELEASE-p6. Where does it get this information ? thanks.
Manpage of freebsd-version(1) states as below.
Code:
     The following options are available:

     -k          Print the version and patch level of the installed kernel.
                 Unlike uname(1), if a new kernel has been installed but the
                 system has not yet rebooted, freebsd-version will print the
                 version and patch level of the new kernel.

     -r          Print the version and patch level of the running kernel.
                 Unlike uname(1), this is unaffected by environment variables.

     -u          Print the version and patch level of the installed userland.
                 These are hardcoded into freebsd-version during the build.

     -j jail     Print the version and patch level of the installed userland
                 in the given jail specified by jid or name.  This option can
                 be specified multiple times.

     If several of the above options are specified, freebsd-version will print
     the installed kernel version first, then the running kernel version, next
     the userland version, and finally the userland version of the specified
     jails, on separate lines.  If no option is specified, it will print the
     userland version only.

So the place freebsd-version(1) look into for userland is still of 13.0-RELEASE-p6. Not sure where it is, though.
 
Thanks. But the boot and the usr dirs come from the 15.0 ; I've renamed the boot,the etc and the usr dirs of the 13.0 and I copied the same of the 15.0 to the sd card. That's because I'm not able to figure out where it gets the information.
 
See /bin/freebsd-version.
Code:
USERLAND_VERSION="...
By the way, you once replied to me saying, 'I avoid this form of communication like the plague.'
 
See /bin/freebsd-version.
Code:
USERLAND_VERSION="...
By the way, you once replied to me saying, 'I avoid this form of communication like the plague.'

Hello.

I edited /bin/freebsd-version removing "USERLAND_VERSION="13.0-RELEASE-p6"

adding,instead :

Code:
set -e

USERLAND_VERSION="15.0-ALPHA2"

So,now :

Code:
marietto# freebsd-version -ukr

15.0-ALPHA2
15.0-ALPHA2
15.0-ALPHA2

I hoped to be able to bootstrap the packages of 15,but it didn't happen :

Code:
marietto# pkg update

Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:13:aarch64/quarterly...

It persists assuming that the userland version is 13,but it's not true...

This is my FreeBSD.conf :

Code:
marietto# nano /usr/local/etc/pkg/repos/FreeBSD.conf

url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly"

so,the version 13 is determined by the ABI variable....is this a variable ? Anyway,how is it *really* determined ? At the moment I'm using the original boot,etc,bin,sbin,usr,var of 15,so why ABI is still 13 ? How can I set it to 15 ?
 
Doesn't look like a clean way to me, what do you try to archive?

I want to boot & use FreeBSD 15.0 on the KHADAS-EDGE-V,but the original img does not work well 'cause my monitor flickers. To fix the flickering I've installed the FreeBSD 13.0 image hosted by PersonalBSD.org,taking it from here :


because it uses the correct bootloaders ; 15.0 doesn't... Later I've renamed the directories of the 13 and I've copied the corresponding ones of the 15.0 on the sd card...
 
See pkg.conf(5).
Code:
     ABI: string  The ABI of the package you want to install, for example
                  `FreeBSD:14:amd64'.  This should be set in combination with
                  the OSVERSION option if targeting FreeBSD to specify the
                  exact target version.  Default: derived based on ABI_FILE.

     ABI_FILE: string
                  Set the file used to determine the target ABI.  Default:
                  /usr/bin/uname, or if not found, /bin/sh.
Just read the man page you hate and it'll tell you.
 
Back
Top