Showing posts with label Raspbian. Show all posts
Showing posts with label Raspbian. Show all posts

Friday, April 3, 2020

Do something useful with your Pi4

You can now run Rosetta@home on the Pi4. They released a new app called "Rosetta for Portable devices" that will run under Raspbian but its for the ARM64 architecture.

Link to Rosetta@home: http://boinc.bakerlab.org/rosetta/

For those that don't know Rosetta is searching for proteins in relation to the Covid-19 virus. Its a BOINC-based project so you'll need to install that first. There are a few catches though.
  • You'll have to put the kernel into 64 bit mode.
  • You have to tell BOINC its an aarch64 platform (ARM64).
  • Some tasks can use up to 1.3GB of memory each so you need to limit how many run at the same time.

Most BOINC projects don't have aarch64 apps, particularly Einstein which gave me an incompatible app and then all the work units failed. You can go back to armhf (32 bit) mode later by reversing these steps.

Before somebody asks, yes you could theoretically do this on a Pi3B or a Pi3B+ but they only have 1GB of memory so its not worthwhile.

Assuming you still want to proceed this is the process.


1. Install BOINC
If you already have it installed then skip this step.If not install it and sign up to any projects you want to run. I won't go into detail here but if there is interest I can cover it in another blog post.

Set it to No New Tasks for all projects. If it has any work in progress let it finish and report it before proceeding.


2. Put the kernel into 64 bit mode
This tells the kernel to use 64 bit mode also known as ARM64 or aarch64. By default the kernel runs in 32 bit mode for compatibility with the older Pi software. You'll need the 4.19.75 or later kernel. To find out what you have currently type the following in a terminal or ssh session:
uname -a

If you have an older one then you'd better upgrade it to the latest packages and then come back to this step.

Make a copy of the config.txt first. Type:
cd /boot
sudo cp config.txt config.old

Edit the config.txt. Type:
sudo nano config.txt

Once in nano (its a text editor) scroll to the very end and add "arm_64bit=1" (without the quotes) on a new line.

Press Control-O to save the file.

Press Control-X to exit from nano.

Now reboot it by typing:
sudo reboot


3. Tell BOINC to use aarch64
Back in a terminal or ssh session type:
uname -a

You should see it says "aarch64" on the end of the line. If not then you need to fix that up first. If it does we now need to edit the cc_config.xml file that BOINC uses. Type:
cd /etc/boinc-client
sudo nano cc_config.xml

Blank out the contents using the delete or backspace keys and then paste or type this in:
<cc_config>
  <log_flags>
    <task>1</task>
    <file_xfer>1</file_xfer>
    <sched_ops>1</sched_ops>
  </log_flags>
  <options>
    <alt_platform>aarch64-unknown-linux-gnu</alt_platform>
  </options>
</cc_config>

Press Control-O to save the file.

Press Control-X to exit from nano.

We need to restart BOINC to pick up this change so type the following command:
sudo systemctl restart boinc-client

Now you can allow BOINC to accept tasks.


Why do we need to this?
When you install Raspbian on your Pi its all 32 bit, all the add-on programs and so on. Its known as armhf (ARM hard float). The Raspberry Pi Foundation made kernel changes to allow it to run in 64 bit mode. That's the kernel taken care of but the apps are still 32 bit.

When you install BOINC you get the armhf version. That is because the Foundation don't have aarch64 repositories. We then need to tell BOINC to use aarch64 as an alternative to armhf in order get 64 bit apps.

Saturday, December 14, 2019

Add buster-backports to a Raspberry Pi

Lets assume you wanted some app from buster-backports, usually because its more up to date than the version in buster. The Raspberry Pi foundation doesn't have a backports repo so you have to use the Debian one instead. This is how to add it.

Update: March 2021

The Raspberry Pi OS 64 bit already has the necessary signing keys. I haven't used the 32 bit one for a while but it may also have the necessary signing keys. You only need to do point 2 if you get an error telling you you don't have the GPG keys.

As mentioned in the comments the GPG keyservers disappear. The kfwebs.net listed below is no longer available but there are others listed in the comments that can be used instead.

 


1. Add to /etc/apt/sources.list
This adds the Debian buster-backports repo to our list of repositories to use. To edit the list of repositories:

sudo nano /etc/apt/sources.list

Add the following line to the end

deb http://deb.debian.org/debian buster-backports main


2. Add Debian Buster keys
This adds the signing keys so we can trust the Debian repos.

gpg --keyserver hkp://keys2.kfwebs.net:80 --recv-keys 04EE7237B7D453EC
gpg --keyserver hkp://keys2.kfwebs.net:80 --recv-keys 648ACFD622F3D138

gpg --export 04EE7237B7D453EC | sudo apt-key add -
gpg --export 648ACFD622F3D138 | sudo apt-key add -



3. Tell apt to update
Tell apt to get the latest list of packages.

sudo apt update


4. See if there is an updated package
If you want to see if there is an updated package called xxx use the following command:

sudo apt list xxx -a


5. Get a package from the backports repo
By default apt won't install packages from the backports repo, you need to tell it. If we want to install package xxx from buster-backports use the following command:

sudo apt install -t buster-backports xxx

Thursday, December 12, 2019

ARM64 on Raspberry Pi 4

It doesn't work. Well bits of it do. If you have got an up to date kernel, I am on 4.19.75, you can simply put it into 64 bit mode by adding "arm_64bit=1" (without the quotes) to the end of /boot/config.txt and reboot it. The kernel will now be an aarch64 kernel.

The Raspberry Pi foundation doesn’t currently have an arm64 repository so all of the programs are 32 bit (armhf) apart from the kernel. I had BOINC installed from the foundation repo (ie armhf version) and then switched the kernel to 64 bit mode and it continued to work. Not everything will. I wanted to get the arm64 version of BOINC. It kept choosing the foundation repo. I tried specifying I wanted the 64 bit version and it complained about dependencies. I commented out the foundation repos so it only knew about Debian and then I removed the armhf version of BOINC and tried installing the 64 bit version - it still complained. In the end I gave up.

My next step will be to try a 64 bit Ubuntu on it. Until then I have put it back to 32 bit mode and reinstalled the armhf apps.