Make RPi.GPIO work on arm64

Bug #1814118 reported by Dave Jones on 2019-01-31
This bug affects 2 people
Affects Status Importance Assigned to Milestone
rpi.gpio (Ubuntu)

Bug Description


 * RPi.GPIO currently does not work under arm64 kernels, simply due to hardware revision detection being slightly different.
 * The patched version operates as expected under both armhf and arm64 kernels by querying /proc/device-tree/system/linux,revision (a file that exists on modern armhf and arm64 kernels), falling back to /proc/cpuinfo (the former detection method, primarily to continue supporting any older armhf kernels).
 * This will also bump the version from 0.6.3 to 0.6.5 on bionic/cosmic. This fixes several nasty bugs around PWM handling and event detection. These issues didn't affect short-term experimentation with the library, but do affect long-running deployments (memory leak in PWM allocation, and a race-condition in setting up pin event detection).

[Test Case]

 * On an arm64 kernel:
 * Install present version of python3-rpi.gpio (0.6.3-1ubuntu4)
 * Under python3 "from RPi import GPIO"
 * Present version returns RuntimeError: This module can only be run on a Raspberry Pi
 * Upgrade to proposed version (0.6.5-1ubuntu1)
 * Under python3 "from RPi import GPIO"
 * This should succeed
 * Run test cases under test/ (note: external wiring/components required; check source header for requirements)
 * Repeat procedure with armhf kernel to ensure no regression

[Regression Potential]

 * On armhf kernels: low; the existing detection pathway is maintained for ancient kernels lacking /proc/device-tree/system/linux but modern armhf kernels appear to have this file anyway and work with the new detection code. The new version is also operating happily upstream in Raspbian stretch.
 * On arm64 kernels: none; the existing version simply fails to import anyway

Mathew Hodson (mhodson) on 2019-02-02
Changed in rpi.gpio (Ubuntu):
importance: Undecided → Low
Łukasz Zemczak (sil2100) wrote :

The package looks good and I guess I'll just sponsor it as is. For a moment I was wondering about proposing a small change to the relevant patch: since currently when we're able to open /proc/device-tree/system/linux,revision but are not able to read the contents, the patch forces an error. Was thinking that maybe we should fall-back to the cpuinfo check in this case as well. But then, I suppose that if the linux,revision is openable but unreadable, that's actually a bug and maybe one should actually error out. Besides, this might make the code less clean as for handling an edge-case. Might be worth considering, but I now lean towards just releasing this to disco as-is.

Łukasz Zemczak (sil2100) wrote :


Changed in rpi.gpio (Ubuntu):
status: New → Fix Committed
Dave Jones (waveform) on 2019-03-14
description: updated
Dave Jones (waveform) wrote :

SRU: debdiff from current bionic (0.6.3-1ubuntu5) to disco (0.6.5-1ubuntu1) attached.

Simon Quigley (tsimonq2) wrote :

Subscribing Łukasz, he sponsored this the last time and is also on the SRU Team (so he can examine its suitability for a stable release).

Thanks for your work on this!

Mathew Hodson (mhodson) on 2019-03-19
Changed in rpi.gpio (Ubuntu Bionic):
importance: Undecided → Low
Changed in rpi.gpio (Ubuntu Cosmic):
importance: Undecided → Low
Mathew Hodson (mhodson) on 2019-04-26
Changed in rpi.gpio (Ubuntu):
status: Fix Committed → Fix Released
Changed in rpi.gpio (Ubuntu Bionic):
importance: Low → Medium
Changed in rpi.gpio (Ubuntu Cosmic):
status: New → Won't Fix
Changed in rpi.gpio (Ubuntu Bionic):
status: New → In Progress
Łukasz Zemczak (sil2100) wrote :

I have sponsored the backport to bionic, since even though this is certainly not a priority, we do support arm64 on Pi3 officially for this series - so it would be good to have things working there.

I'm setting the cosmic task as invalid because we do not provide cosmic arm64 pi3 images (at all).

Hello Dave, or anyone else affected,

Accepted rpi.gpio into bionic-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in rpi.gpio (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic

The fix for this bug has been awaiting testing feedback in the -proposed repository for bionic for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
Andres A (andresa007) wrote :

These two packages were tested on Ubuntu 18.04 for armhf in a Raspberry Pi 3b


They solved the issue presented when testing with rpi.gpio and gpiozero.

Łukasz Zemczak (sil2100) wrote :

Excellent, thank you for the verification. Let me adjust the tags and release (the tags need to be set as otherwise we could not see that the fix has been verified).

tags: added: verification-done verification-done-bionic
removed: removal-candidate verification-needed verification-needed-bionic

The verification of the Stable Release Update for rpi.gpio has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rpi.gpio - 0.6.5-1ubuntu0.18.04.1

rpi.gpio (0.6.5-1ubuntu0.18.04.1) bionic; urgency=medium

  * Added d/p/fix-revision-on-aarch64.patch to permit usage of the module
    on aarch64 based distros.
  * Fix filename on d/
  * Backport to bionic (LP: #1814118)

 -- Dave Jones <email address hidden> Tue, 22 Jan 2019 15:26:28 +0000

Changed in rpi.gpio (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers