Please guard against bricking the Pinebook Pro
I have successfully used this script to create a manjaro-i3 installation with encrypted root fs on my new PBP. Thanks for all your work that went into it!
Unfortunately, there is a gotcha that tripped me up, and seeing that this has already happened before to someone else, I would like to raise this in the hope of a possible fix and also to warn other users.
So, first of all, I am a careful guy, and I wanted to test that this script works without risking the eMMC in my device. So I have done a test install to an SD card while running the default OS from eMMC boot. This worked well enough, so then I booted from the newly created SD card and having checked out that I generally like how things are, I decided to do the "real" install, this time to the eMMC. So now I was already in the OS created by this installer, having booted from the SD card, and I ran this installer again, directed at the eMMC.
Then, the same thing happened as described here: https://forum.manjaro.org/t/pinebook-pro-install-with-encryption/47821
Specifically: at an early stage, I also got the printout
Device ROOT_MNJRO already exists. but then everything continued and things looked OK. Until, they suddenly did not. My wifi connection broke down, downloads failed, and I was left with a broken system. I still had a root shell, so having already found the above forum entry, I ran
fdisk and removed the partition entries on the eMMC in the hope that this would allow the PBP to boot through the (empty) eMMC to the SD, sparing me the "unbricking" that lay ahead. Alas, that did not work out (as explained below).
The script apparently corrupted the contents of the filesystem it was running from (SD card, /dev/mmcblk1) while it was explicitly directed to install to the eMMC (/dev/mmcblk2). Although the script had warned me that the existing contents of the target (eMMC) would be destroyed, it destroyed the SD partition as well, which I consider as a critical failure. Unfortunately, the eMMC content was also destroyed so that my PBP would not boot again (the power on button did not have any effect). Not with a freshly minted known-good SD image, not without an SD in the slot. This despite the fact that I wiped the eMMC partition table before powering off the PBP at the end of the broken install, as pointed out above.
The root cause of this has nothing to do with having SSH'd into the box as described by the above linked forum entry (I was not doing that; I ran the installer from the PBP directly!). Rather, the problem is that the partition image label(?)
ROOT_MNJRO is hardcoded somewhere and the script gets tripped up if it is run from an OS that was created with the script itself.
Please fix this, at the very least by clearly documenting this as a limitation, and also detecting and aborting on this condition so that people careful enough to create a throwaway OS on their SD (hoping to protect their eMMC from getting bricked) and then using that SD to run the same script to install onto the eMMC do not brick their devices.
If you are reading this after having landed in the same situation: DO NOT PANIC. Write a new SD card with a vanilla manjaro factory image (whichever one you prefer; I used the manjaro-i3 image). Carefully read the hardware disassembly instructions on the Pinebook wiki. Remove the bottom plate of your PBP and flip the eMMC disable switch. Now you will be able to boot from the SD. Flip the switch back again to re-enable the eMMC. Reboot, this will now go through the eMMC stage and boot from the SD (seems the boot gets stuck on the eMMC the first time, but gets repaired by the above procedure to the point that it can be re-added to the boot sequence, at least this happened in my case). Now you are running from the SD and the OS will see the eMMC (verify the existence of
fdisk -l). You may now re-install the OS using the manjaro-arm-installer directly to the eMMC (and it will work, since you are not running from an image created with this same installer).