Find out OS version and plattform?

Polytropon freebsd at edvax.de
Fri Jun 12 09:26:23 UTC 2020


On Fri, 12 Jun 2020 10:15:00 +0100, Steve O'Hara-Smith wrote:
> On Fri, 12 Jun 2020 11:03:22 +0200
> Ede Wolf <listac at nebelschwaden.de> wrote:
> 
> > Hi,
> > 
> > is there a way to find out which version of FreeBSD was installed - and 
> > for what architecture, simply by  mounting the disk?
> 
> 	If you mount it on FreeBSD then you can do something like this
> (taken from man freebsd-version).
> 
> mount -rt ufs /dev/ada0p2 /mnt
> env ROOT=/mnt /mnt/bin/freebsd-version -ku
> 
> 	You could inspect the sources of freebsd-version to find out how
> this is done.

This does work for the same (or compatible) arch.



> > I am not talking about uname, where you have to be inside the os, but if 
> > you simply mount the root partition to another computer, where to look 
> > for these information?
> 
> 	The kernel version is pulled from the kernel, I'm not sure where
> the userland version is stored.

The kernel version could be "binary-grepped" from /boot/kernel/kernel,
it starts with "@(#)FreeBSD", but freebsd-version uses a much more
elegant approach, see /usr/src/bin/freebsd-version/freebsd-version.sh.in.
Further magic happens in /usr/src/sys/conf/newvers.sh at build time.
If, and only if, the installed source tree matches the OS version
installed, the information can be found in that particular file
(search for TYPE, REVISION, BRANCH at the top).


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list