As you might know, Raspberry Pi 3/3+/4 all have a 64bit CPU but Raspbian (the official and default system for the Raspberry Pi) is 32-bit.
In this guide I will show you how to switch the kernel to 64-bit, however I only recommend doing this with the latest Rasbian Lite (the one without desktop) and you should take a look at the “known issues” at the bottom of this article before proceeding.
Why Raspbian is 32-bit
This is because the old Raspberry Pis are still supported (which is good) but have a 32-bit CPU, which means they couldn’t run a 64-bit OS, however 64-bit CPUs can run a 32-bit OS. So, it kind of makes sense to make the OS 32-bit for everyone by default. However, there are some performance benefits of using a 64-bit OS on a 64-bit CPU, to leverage the capabilities of the CPU.
64-bit can run 32-bit
There is a compromise, though! It is possible to have a 64-bit CPU with 32-bit OS but having a 64-bit kernel to leverage the CPU capabilities.
This is possible because in the same way a 64-bit CPU can run a 32-bit OS, a 64-bit Linux kernel can run 32-bit applications.
However, the kernel is 32-bit by default on Raspbian. We can change that! We will switch the kernel to 64-bit so it will be able to leverage the 64-bit CPU capabilities.
We will go 64-64-32!
This means we will be running Raspbian on a 64-bit CPU, with a 64-bit Linux kernel, and the rest of the OS 32-bit. This basically means the applications that make up the OS will remain 32-bit, but we will be able to leverage the 64-bit CPU capabilities thanks to the new 64-bit Linux kernel which can give us a performance boost in some situations.
Switching the kernel to 64-bit
Prerequisites
This assumes you are on the latest Raspbian Buster with all the updates installed.
You can check whether you’re on Buster or not with:
lsb_release -a
Which will output something like:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
And you want to install all updates with:
sudo apt update
sudo apt upgrade
Now to verify the 64-bit kernel exists:
ls /boot/kernel8.img
If it exists, it will simply print out the path to it. Otherwise, it will tell you: No such file or directory
.
Switching
Now that we made sure we’re up to date and the 64-bit kernel exists, let’s switch to it!
Edit /boot/config.txt
with your favorite editor, for example nano:
sudo nano /boot/config.txt
Go to the very end of the file and add this line:
arm_64bit=1
Hit CTRL + X, confirm to save with Y, and hit enter twice.
Now reboot to boot with the new, 64-bit kernel!
sudo systemctl reboot
Verifying
Verify you are running the 64-bit kernel with:
uname -a
Which will output something like:
Linux raspberrypi 4.19.97-v8+ #1294 SMP PREEMPT Thu Jan 30 13:27:08 GMT 2020 aarch64 GNU/Linux
As you can see, the kernel version now outputs “v8” at the end, and the architecture is now set to aarch64. This means we’re running the 64-bit kernel!
That’s all there is to it!
Known issues
- vcsm driver doesn’t work with 64-bit (only the cma version) which will break software decode with Kodi.
- Mathematica and Wolfram fail to run. Workaround here
- Java 8 doesn’t work but OpenJDK 11 does.
I don’t need Mathematica or Wolfram and don’t need video functionality on a server and I can live with OpenJDK 11 if I need Java. So, I’m happily running a 64-bit kernel on my Pi!
[…] it should spice up my life and make better use of the limited system resources. I attempted to upgrade to 64 bit on my own and it took a while but Iām pretty sure I did so successfully. From what I understand, […]
uname show 64 bit but python and dpkg show 32bit
Thanks, love the article. I needed some further information on the 64 bit and it was helpful.
Yes, I got it this time and confirmed it.
Sean Parry
I can get the changes in. But I cannot get them to save and make the changes requested.
Sindastra, all was going well until I rebooted. I have a screen shot of what happened. Send me an email: [redacted email address] and I’ll forward it for your comment.
Hi, to get back up you can turn off your Pi, insert the SD card into your computer, edit config.txt and remove the line arm_64bit=1 to undo the changes (don’t forget to save and put the SD card back in your Pi).
Is this the same as installing the 64 bit version of Raspberry Pi OS 64 bit?
In other words does it mean I do not need to install the 64 bit version as this is the same or is this just an easy way to run 64 bit apps if installed?
What do I do if I don’t have a kernal8.img?
Hi, make sure you’re on the latest “Raspberry Pi OS” (formerly “Raspbian”), and make sure you’re up to date.
Hi,
I am pretty much up to date, ran all update commands, and there is still no kernel8.img
I’m pretty much fed up with raspian anyway, would arch be a better choice ?
Brilliant! Solved a problem for me. Cheers, mate!
Thanks! Solved my problem with a high CPU load on Raspberry PI 4.
Very helpful. Many thanks!
awesome. Thank you.
Thank you for the helpful instructions. My Architecture has been successfully upgraded to AARCH64 but upon running a bash install code requiring 64-bit OS, the install was not successful due to it being a 32-bit OS, as the splash screen after reboot also confirms. Any suggestions?