# FreeBSD version



## balanga (Feb 25, 2018)

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


----------



## ShelLuser (Feb 25, 2018)

Try using `freebsd-version`, optionally using the -u parameter.


----------



## Phishfry (Feb 25, 2018)

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.


----------



## Maelstorm (Feb 25, 2018)

ShelLuser said:


> 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:


```
FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0)
```


----------



## balanga (Feb 25, 2018)

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.


----------



## SirDice (Feb 25, 2018)

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.


----------



## balanga (Feb 25, 2018)

How about using /COPYRIGHT ?


----------



## SirDice (Feb 25, 2018)

Several files will have a revision ID at the top. You could look at those.


----------



## Maxnix (Feb 25, 2018)

Sorry, balanga, but what do you want to accomplish this way? Why through the filesystem?


----------



## hukadan (Feb 25, 2018)

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 ?


----------



## Handsome Jack (Feb 25, 2018)

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:


```
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 (Feb 25, 2018)

Maxnix said:


> Sorry, balanga, but what do you want to accomplish this way? Why through the filesystem?



See my first post.


----------



## balanga (Feb 25, 2018)

Handsome Jack said:


> 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.


----------



## balanga (Feb 25, 2018)

hukadan said:


> 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:-

```
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.


----------



## hukadan (Feb 25, 2018)

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).


----------



## balanga (Feb 25, 2018)

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...


----------



## hukadan (Feb 26, 2018)

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.


----------



## balanga (Feb 26, 2018)

I decided to start from scratch, although I'm still trying to add in all the customisations I made.


----------



## SirDice (Feb 28, 2018)

hukadan said:


> 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.


----------

