FreeBSD version

Is there any way to determine which version of FreeBSD is installed by looking at the filesystem?

I have a strange situation where uname -a shows 11.1-RELEASE but the timestamp of most files is 2014/07/11 which definitely is not 11.1
 
I get my FreeBSD microSD cards confused and forget what OS is on what card.
So I mount the microSD card and read the first few lines of /var/run/dmesg.boot
It shows not only version last booted, but also the architecture.
 
Try using freebsd-version, optionally using the -u parameter.

This is actually a good answer.

Unrelated, I have discovered a way to see which compiler was used to build the kernel.

strings /boot/kernel/kernel | grep -i version

The last line of the output gave me this:

Code:
FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0)
 
Thanks for the suggestions, but it sounds as though I didn't make myself clear. I'm looking for a way of identifying the version from the filesystem.... ie something like the existance of a freebsd-version.
 
You probably can't tell the difference just by looking at the filesystems or the files it contains (the basic file structure today is basically still the same as it was 20 years ago). You'll have to really look into a few files (like the kernel file) to figure that out.

There are some things you could look for, pkg_add for example. This tool disappeared from 10.0 and onward. So if it exists you know it has to be a 9.x or even older. But doing it this way will only get you a rough version.
 
Several files will have a revision ID at the top. You could look at those.
 
As explained in this post, file /bin/sh will tell you what major release and OSVERSION binaries are installed. Is this what you are trying to accomplish ?
 
balanga is probably looking for FreeBSD equivalent of file that exists in (if I remember correctly) Debian /etc/debian_version or /etc/issue or /etc/os-release.
On Live Linux Mint 18.3 there, in /etc is a symlink to /usr/lib/os-release that says:

Code:
NAME="Linux Mint"
VERSION="18.3 (Sylvia)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.3"
VERSION_ID="18.3"
HOME_URL="http://www.linuxmint.com/"
SUPPORT_URL="http://forums.linuxmint.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/"
VERSION_CODENAME=sylvia
UBUNTU_CODENAME=xenial
 
balanga is probably looking for FreeBSD equivalent of file that exists in (if I remember correctly) Debian /etc/debian_version or /etc/issue or /etc/os-release.
On Live Linux Mint 18.3 there, in /etc is a symlink to /usr/lib/os-release that says:

I kind of assumed that something like this existed in FreeBSD.
 
As explained in this post, file /bin/sh will tell you what major release and OSVERSION binaries are installed. Is this what you are trying to accomplish ?

Thanks for that... Here's what I got:-
Code:
sh: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 9.3, stripped

This is inside a jail. I can't imagine how things got into this state.
 
You ran uname -a inside the jail ? If yes, you should probably read the entire thread related to the link I gave you and more particularly the post of acheron. This command is not giving you information on the jail but rather on the host. That would explain what you see (i.e. your jail is still running FreeBSD 9.3).
 
Should I run
freebsd-update -r 11.1-RELEASE upgrade
to get this uptodate?

Or maybe it would be easier to backup all the files newer than the base system, and create the jail from scratch...
 
IIRC, you cannot skip a major upgrade so you would need first to upgrade to 10.4-RELEASE and only then to 11.1-RELEASE. The way to upgrade your jail depends very much on the tool you used to create it. As for the choice between upgrading and starting from scratch, only you can make that call.
 
IIRC, you cannot skip a major upgrade so you would need first to upgrade to 10.4-RELEASE and only then to 11.1-RELEASE.
No need for that, you can jump straight to 11.1. Do make sure you have the latest patch version of 9.3-RELEASE before doing the upgrade though.
 
Back
Top