Access eMMC install from second storage medium
This article explains step-by-step how you can get into a broken postmarketOS install from a second storage medium, and recover data from there or fix the installation. One use case is fixing postmarketOS on the eMMC of the PinePhone with an SD card.
Boot postmarketOS from second storage medium
Download a postmarketOS image and put it on the second storage medium. If there are no pre-built images for your device, build one yourself with pmbootstrap. Boot from the storage medium (in case of the PinePhone, it will automatically boot from the SD card once inserted.)
Get shell access
- Attach a serial cable (remember to set killswitches accordingly), or
- Attach an USB cable and use SSH, or
- Connect to Wi-Fi and use SSH
Mount the eMMC's root partition
Use lsblk
to figure out which storage device is eMMC (if there are only two, it's the one where nothing is mounted). In this example, it is /dev/mmcblk2
.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 59.5G 0 disk
├─mmcblk0p1 179:1 0 243M 0 part /boot
└─mmcblk0p2 179:2 0 59.2G 0 part /
mmcblk2 179:32 0 29.1G 0 disk
├─mmcblk2p1 179:33 0 121M 0 part
└─mmcblk2p2 179:34 0 29G 0 part
mmcblk2boot0 179:64 0 4M 1 disk
mmcblk2boot1 179:96 0 4M 1 disk
a) Encrypted
$ sudo cryptsetup luksOpen /dev/mmcblk2p2 emmc
Enter passphrase for /dev/mmcblk2p2:
$ sudo mount /dev/mapper/emmc /mnt
b) Not Encrypted
$ sudo mount /dev/mmcblk2p2 /mnt
Access your data
$ cd /mnt
$ ls
bin boot dev etc home lib lost+found media mnt opt proc root run sbin srv sys tmp usr var
See also
- Jumpdrive allows similar access by exposing storage devices over USB to your PC