I'm confused. Running Fedora Linux, lscpu
yields:
Architecture: i686
CPU op-mode(s): 32-bit, 64-bit
...
But when I try to install a 64-bit program (Chrome) I get error like:
Package /….x86_64.rpm has incompatible architecture x86_64. Valid architectures are ['i686', 'i586', 'i486', i386']
I'm less interested in being able to install Chrome and more interested in why lscpu
says that my CPU can run in 64-bit mode; clearly this can't mean I can run 64-bit programs. Can anyone clarify?
Best Answer
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.
/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:
Here's what the first 3 lines of each section for a core looks like:
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: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
32-bit kernel
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
32-bit
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 asuname -m
. You can read more about thearch
command in the coreutils documentation.excerpt
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.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.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.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: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:
If on the other hand you want to know the CPU's architecture use these commands:
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 modeThe 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.
References
man pages
articles: