1 1

BananaPi M2+, how to Overlayfs ?

Recommended Posts

Hi all,

I've been struggling with the issue in the topic for a few days now. Actually the ideal solution would be a read-only root file system (with a writable overlayfs on top), so that I can just turn the power off, without risking any SD-card/filesystem corruption. There seems to be an easy solution for that according to this page:


section "How to freeze your filesystem?". But the package "overlayroot" that is mentioned there does not seem to be available for Debian (Armbian Stretch).

A quick attempt to adopt the overlayfs-startup scripts to Debian failed, because Debian is using systemd and the script that I found was obviously for sysv-init.

Anyway, next best solution that I searched for was using the on-board power button to shut down the system. I found two posts that seemed like a solution: using acpid and adding a udev-rule to detect the onboard power button as acpi-power-button. But neither of the two worked on my BananaPi M2+ board.



I've not been able to see any events in acpid (acpi_listen or in the acpi-log files) when pressing the power button. And in the meantime, I doubt, that it can work on the BananaPi M2+, as the power button is connected to one of the GPIO-Pins here.


What I did manage to do so far, after inspecting the circuit diagrams of the board and thus finding out which GPIO-pin the power button is connected to, is to write a little python program that estabilshes an interrupt when that GPIO shows a fallig edge (i. e. when the power button is pressed) and then shuts down the system. This python script I have installed as a systemd service. So currently, I managed to shut down the BananaPi by pressing the power button.

(For anyone who is interested: I uploaded the source code to GitLab here:



Anyway, I am still interested in the readonly-root / overlayfs / overlayroot solution for Debian stretch, as this is safer in the long run. Does anyone have any pointers for me there? Has anyone tried that already or is there a solution for the u-boot / systemd combination that would be easy to adopt?

Edited by Tido
I changed the title as you look for Overlay, not shutdown

Share this post

Link to post
Share on other sites

@yam1: thanks for the link. After reading it, I still think, that overlayfs is the best way to go. Well, as there doesn't seem to be a ready-to-use solution, it looks like I'll have to do some porting of the "overlayroot"-package solution to systemd ... 

Will surely take a while, but when I have something, I'll report it here - for anyone else, who might be looking for such a solution.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1