Is raspbian for the Raspberry Pi 2 B 32 bit or a 64 bit OS? Just wondering because I am unable to find this information online.
4 Answers
It is a 32 bit OS, as all current Raspberry Pi hardware (except the new Raspberry Pi 3) uses 32 bit ARM CPUs.
The statement that the distinction between 32 bit and 64 bit is really only pertinent to x86 OS's is pure nonsense - as goldilocks points out there are both 32 and 64 bit ARM CPUs, and thus both 32 and 64 bit ARM OSes. Just like there are both 32 and 64 bit OSes for PowerPC, Sparc, MIPS and a number of less common ISAs.
September 2020 Update
Beta versions are now available that install 64-bit versions of applications. Not all applications or libraries work.
2020 Answer
By default, Raspbian uses the 32-bit kernel, but all recent versions of Raspbian include a 64-bit version (kernel8.img).
Note, you will need a CPU that is capable of ARMv8 for the 64-bit kernel to boot. Currently this is only available on Raspberry Pi 3 or higher (with one exception: Raspberry Pi 2 Model B v1.2).
The "official" way to have your Pi boot in 64-bit mode is to add a line arm_64bit=1 to /boot/config.txt. (Just make sure /boot/kernel8.img exists first).
There are a couple other "official" ways that are, imho, sub-par. For completeness:
- Delete the 32-bit kernel images (in which case it will "fall back" to 64-bit)
- Explicitly set
kernel=to the 64-bit kernel
However, once running the kernel in 64-bit (confirmed with uname -m == 'aarch64'), you won't be able to really take advantages of the possible speed improvements (which, contrary to some popular belief, is real) unless you also install 64-bit binaries of the programs that you want to run.
For instance, to check if python is compiled to run on a 64-bit kernel or 32-bit:
python -c 'import struct;print(8*struct.calcsize("P"))'
I'm still looking for the official way to install 64-bit python (et. al) on 64-bit Raspbian.
If you do manage to replace all your userland binaries with 64-bit versions, using one of the other ways of setting the kernel might be a better choice as that will ensure you don't try to run 64-bit binaries in 32-bit kernel.
- 535
- 6
- 13
The distinction between 32 bit and 64 bit is really only pertinent to x86 OS's. I expect you are asking in regards to installing software, all software you use on the Pi must be compiled for the ARM processor (ARM 7). Having said that the ARM instructions are 32 bits. You can read more in this forum post
- 34,988
- 18
- 106
- 110