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.

  • possible duplicate of How do I check if I have a 32-bit or a 64-bit OS?
    – Panther
    Jun 23, 2015 at 22:34
  • 1
    This is not a duplicate since the architecture of the currently running kernel is not being determined. The OP is trying to determine the architecture of the kernel on another disk without booting it. Jun 24, 2015 at 0:00

3 Answers 3


It is trivial to determine whether the host operating system has a 32-bit or 64-bit kernel by running:

uname --machine

An output of i386 means 32-bit and x86_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 vmlinuz-3.19.0-21-generic present in /boot on my machine. Now, assuming you have the qemu-system-x86 Install qemu-system-x86 package installed, run the following command, substituting the filename where appropriate:

qemu-system-i386 -kernel <path_to_kernel>

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

enter image description here


I agree that in general the mere presence of a certain kind of executable or library isn't useful because it's possible to have objects of more than one architecture installed, but there are some executables that you can only have one of. file /mnt/usr/bin/dpkg (replacing /mnt with wherever you mounted your filesystem) will tell you whether the core package manager is 32-bit or 64-bit, which is an accurate indicator of the rest of the system unless you're in the middle of an in-place migration from one to the other - you'd certainly know if you were!

  • 4
    There's also the init file at /sbin/init (which may be a symlink, so see the output of file on the target of the symlink). Jun 23, 2015 at 23:14

Look at the directories organization from the root of your old hard disk, this method is analogous to look for the "Program Files" and "Program Files (x86)" directories if it where a Windows OS.

In Linux, if 64 bit, you will see "lib32" and "lib64" directories, while if 32 bit you will only encounter the lib directory (I don't remember now if there would be a lib32 directory too).

If you do not trust in the suggested method, or need more guaranties, the "file" command looks promising. Looking at @ColinWatson answer, personally, I think that /sbin/init is a better candidate, but any of those files (dpkg or init) will match the Kernel arch.

For example, the execution of file /sbin/init will provide an output like this:

/sbin/init: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24

Just replace the path to /sbin/init with the proper mount point of your old root partition, if it is now /media/oldroot, the full path becomes /media/oldroot/sbin/init

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .