Sadly my mobo went bad and I have to build a new machine from scratch. I don't recall if I originally loaded the 32 or the 64 bit version of the OS, (K)ubuntu 14.04.
If I mount the existing HDD is there a file I can examine to determine the OS architecture? Needs to be something more than the presence of a 64bit executable or library as these are not reliable ways to determine the running OS.
I cannot run uname -a
as this is a mounted disk, not a running OS.
Best Answer
It is trivial to determine whether the host operating system has a 32-bit or 64-bit kernel by running:
An output of
i386
means 32-bit andx86_64
means 64-bit.It is less trivial, but still feasible to determine whether an application is compiled for the i386 or amd64 architecture but neither of these will indicate the architecture of the kernel. Even checking
/sbin/init
is not technically sufficient since the init program can be customized at boot time.The only foolproof way to determine the architecture of the kernel is to actually boot it. Luckily this can easily be done using
qemu
.Begin by opening a terminal and navigating to
/boot
on the hard drive. You will find one or more compressed kernel images in the form:For example, I have
package installed, run the following command, substituting the filename where appropriate:
vmlinuz-3.19.0-21-generic
present in/boot
on my machine. Now, assuming you have the qemu-system-x86If you see a wall of text scroll by and eventually panic (because the root FS is missing), you have installed a 32-bit kernel. If instead you receive an error similar to the one displayed below, you have a 64-bit kernel (which will not boot on an x86 CPU).