22

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.

20

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.

| improve this answer | |
  • 1
    @Bex, the question specifically asks about Raspbian for the Raspberry Pi 2 B, and that will always have to be a 32 bit OS as the Pi 2 used a 32 bit CPU. The Pi 3 using a 64 bit CPU is already mentioned in the answer. – Marcus May 29 '17 at 16:20
24

With following command, you can determine if your OS is 32 or 64 bit:

getconf LONG_BIT
| improve this answer | |
  • 2
    Handy command. Answers the question perfectly. – SDsolar Nov 25 '17 at 22:33
  • 1
    Should be the accepted answer and nothing else... – GeertVc Jun 29 '19 at 8:23
9

September 2020 Update

Beta versions are now available that install 64-bit versions of applications. Not all applications or libraries work.

Official forum post.

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.

| improve this answer | |
  • "all recent versions of Raspbian support 64-bit" NO they don't! The closest is an experimental 64bit kernel in testing. – Milliways Jan 29 at 8:00
  • 2
    @Milliways Your comment is WRONG! Indeed there is a 64bit kernel in all recent stable images. You should have a look at the /boot/ directory. There you will find /boot/kernel8.img. – Ingo Jan 29 at 12:21
  • 1
    @Milliways While I think the distinction you're trying to make is pretty minor, I updated the wording to be more clear. Hope this meets your standards. – Cameron Tacklind Jan 29 at 21:50
  • 1
    @CameronTacklind: Thanks for the update - it's good to see these old questions refreshed with current information. – Seamus Oct 13 at 3:40
4

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

| improve this answer | |
  • 2
    There's a 64-bit ARMv8; Apple and some other smartphones use it. But there are no raspberry pis in this category, yet... – goldilocks Aug 23 '15 at 18:19
  • 6
    And now, with the Pi 3, there is a 64-bit Pi. – armb Feb 29 '16 at 13:18
  • 1
    @armb give it a try " getconf LONG_BIT " ... it works fine :) – kris Dec 2 '17 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.