32-bit, 64-bit CPU op-mode on Linux

lscpu is telling you that your architecture is i686 (an Intel 32-bit CPU), and that your CPU supports both 32-bit and 64-bit operating modes. You won't be able to install x64 built applications since they're built specifically for x64 architectures.

Your particular CPU can handle either the i386 or i686 built packages. There are a number of ways to verify your architecture & OS preferences.

lscpu

As you're already aware, you can use the command lscpu. It works well at giving you a rough idea of what you're CPU is capable of.

$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
CPU(s):                4
Thread(s) per core:    2
Core(s) per socket:    2
CPU socket(s):         1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 37
Stepping:              5
CPU MHz:               1199.000
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0-3

/proc/cpuinfo

This is actually the data provided by the kernel that most of the tools such as lscpu use to display. I find this output a little nice in the fact that it shows you some model number info about your particular CPU. Also it will show you a section for each core that your CPU may have.

Here's output for a single core:

$ cat /proc/cpuinfo 
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
model name  : Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
stepping    : 5
cpu MHz     : 1466.000
cache size  : 3072 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow vnmi flexpriority ept vpid
bogomips    : 5319.74
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

Here's what the first 3 lines of each section for a core looks like:

$ grep processor -A 3 /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
--
processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
--
processor   : 2
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
--
processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37

The output from /proc/cpuinfo can also tell you the type of architecture your CPU is providing through the various flags that it shows. Notice these lines from the above command:

$ grep /proc/cpuinfo | head -1
    flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow vnmi flexpriority ept vpid

The flags that end in _lm tell you that your processor support "long mode". Long mode is another name for 64-bit.

uname

This command can be used to determine what platform your kernel was built to support. For example:

64-bit kernel

$ uname -a
Linux grinchy 2.6.35.14-106.fc14.x86_64 #1 SMP Wed Nov 23 13:07:52 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

32-bit kernel

$ uname -a
Linux skinner.bubba.net 2.6.18-238.19.1.el5.centos.plus #1 SMP Mon Jul 18 10:07:01 EDT 2011 i686 i686 i386 GNU/Linux

This output can be refined a bit further using the switches, [-m|--machine], [-p|--processor], and [-i|--hardware-platform].

Here's that output for the same above systems.

64-bit

$ uname -m; uname -p; uname -i
x86_64
x86_64
x86_64

32-bit

$ uname -m; uname -p; uname -i
i686
i686
i386

NOTE: There's also a short-form version of uname -m that you can run as a stand alone command, arch. It returns exactly the same thing as uname -m. You can read more about the arch command in the coreutils documentation.

excerpt

arch prints the machine hardware name, and is equivalent to ‘uname -m’.

hwinfo

Probably the best tool for analyzing your hardware has got to be hwinfo. This package can show you pretty much anything that you'd want/need to know about any of your hardware, right from the terminal. It's save me dozens of times when I'd need some info off of a chip on a system's motherboard or needed to know the revision of a board in a PCI slot.

You can query it against the different subsystems of a computer. In our case we'll be looking at the cpu subsystem.

$ hwinfo --cpu
01: None 00.0: 10103 CPU                                        
  [Created at cpu.301]
  Unique ID: rdCR.a2KaNXABdY4
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.37.5 "Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz"
  Features: fpu,vme,de,pse,tsc,msr,pae,mce,cx8,apic,sep,mtrr,pge,mca,cmov,pat,pse36,clflush,dts,acpi,mmx,fxsr,sse,sse2,ss,ht,tm,pbe,syscall,nx,rdtscp,lm,constant_tsc,arch_perfmon,pebs,bts,rep_good,xtopology,nonstop_tsc,aperfmperf,pni,pclmulqdq,dtes64,monitor,ds_cpl,vmx,smx,est,tm2,ssse3,cx16,xtpr,pdcm,sse4_1,sse4_2,popcnt,aes,lahf_lm,ida,arat,tpr_shadow,vnmi,flexpriority,ept,vpid
  Clock: 2666 MHz
  BogoMips: 5319.74
  Cache: 3072 kb
  Units/Processor: 16
  Config Status: cfg=new, avail=yes, need=no, active=unknown

Again, similar to /proc/cpuinfo this command shows you the makeup of each individual core in a multi-core system. Here's the first line from each section of a core, just to give you an idea.

$ hwinfo --cpu | grep CPU
01: None 00.0: 10103 CPU
  Model: 6.37.5 "Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz"
02: None 01.0: 10103 CPU
  Model: 6.37.5 "Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz"
03: None 02.0: 10103 CPU
  Model: 6.37.5 "Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz"
04: None 03.0: 10103 CPU
  Model: 6.37.5 "Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz"

getconf

This is probably the most obvious way to tell what architecture your CPU is presenting to the OS. Making use of getconf, your querying the system variable LONG_BIT. This isn't an environment variable.

# 64-bit system
$ getconf LONG_BIT
64

# 32-bit system
$ getconf LONG_BIT
32

lshw

Yet another tool, similar in capabilities to hwinfo. You can query pretty much anything you want to know about the underlying hardware. For example:

# 64-bit Kernel
$ lshw -class cpu
  *-cpu                   
   description: CPU
   product: Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
   vendor: Intel Corp.
   physical id: 6
   bus info: cpu@0
   version: Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz
   slot: None
   size: 1199MHz
   capacity: 1199MHz
   width: 64 bits
   clock: 133MHz
   capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp x86-64 constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes lahf_lm ida arat tpr_shadow vnmi flexpriority ept vpid cpufreq
   configuration: cores=2 enabledcores=2 threads=4


# 32-bit Kernel
$ lshw -class cpu
  *-cpu:0
   description: CPU
   product: Intel(R) Core(TM)2 CPU          4300  @ 1.80GHz
   vendor: Intel Corp.
   physical id: 400
   bus info: cpu@0
   version: 6.15.2
   serial: 0000-06F2-0000-0000-0000-0000
   slot: Microprocessor
   size: 1800MHz
   width: 64 bits
   clock: 800MHz
   capabilities: boot fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe x86-64 constant_tsc pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
   configuration: id=1
 *-logicalcpu:0
      description: Logical CPU
      physical id: 1.1
      width: 64 bits
      capabilities: logical
 *-logicalcpu:1
      description: Logical CPU
      physical id: 1.2
      width: 64 bits
      capabilities: logical

CPU op-mode(s)?

Several of the commands report that what looks to be a 32-bit CPU as supporting 32-bit & 64-bit modes. This can be a little confusing and misleading, but if you understand the history of CPU's, Intel specifically, you'll know that they have a history of playing games with their products where a CPU might have an instruction set that supports 16-bits, but can address more RAM that 2^16.

The same thing is going on with these CPUs. Most people know that a 32-bit CPU can address only 2^32 = 4GB of RAM. But there are versions of CPUs that can address more. These CPUs would often make use of a Linux kernel with the suffix PAE - Physical Address Extension. Using a PAE enabled kernel along with this hardware would allow you to address up to 64GB on a 32-bit system.

You might think well then why do I need a 64-bit architecture? The problem with these CPUs is that a single processes space is limited to 2^32, so if you have a large simulation or computational program that needed more than the 2^32 of addressable space in RAM, then this wouldn't have helped you with that.

Take a look at the wikipedia page on the P6 microarchitecture (i686) for more info.

TL;DR - So what the heck is my CPU's architecture?

In general it can get confusing because a number of the commands and methodologies above are using the term "architecture" loosely. If you're interested in whether the underlying OS is 32-bit or 64-bit use these commands:

  • lscpu
  • getconf LONG_BIT
  • uname

If on the other hand you want to know the CPU's architecture use these commands:

  • /proc/cpuinfo
  • hwinfo
  • lshw

Specifically you want to look for fields where it says things like "width: 64" or "width: 32" if you're using a tool like lshw, or look for the flags:

  • lm: Long Mode (x86-64: amd64, also known as Intel 64, i.e. 64-bit capable)
  • lahf_lm: LAHF/SAHF in long mode

The presents of these 2 flags tells you that the CPU is 64-bit. Their absences tells you that it's 32-bit.

See these URLs for additional information on the CPU flags.

  • What do the flags in /proc/cpuinfo mean?
  • CPU feature flags and their meanings

References

man pages

  • lscpu man page
  • /proc/cpuinfo reference page
  • uname man page
  • hwinfo man page
  • getconf man page

articles:

  • Check if a machine runs on 64 bit or 32 bit Processor/Linux OS?
  • Find out if processor is 32bit or 64 (Linux)
  • Need Help : 32 bit / 64 bit check for Linux

If your kernel is a 32 bit linux kernel, you won't be able to run 64 bit programs, even if your processor supports it.

Install a 64 bit kernel (and whole OS of course) to run 64 bit


For completeness: since on most 64-bit architectures it is possible to run 32-bit code, in both kernel space and user space, one should not forget that there are actually 4 possible combinations:

  • 32-bit user space on a 32-bit kernel
  • 64-bit user space on a 64-bit kernel
  • 32-bit user space on a 64-bit kernel
  • both 64-bit and 32-bit user space(s) on a 64-bit kernel

uname is the usual way for determining kernel variant. For user-space, file is quite good at recognising executables: file $SHELL or file /sbin/init are convenient idioms. Just the existence of both /lib/*.so and /lib64/*.so is usually good indication, that the system sports both user space variants.

Tags:

Linux

Cpu

X86

64Bit