You need to enable JavaScript to run this website.

Installing Mobian on PinePhone

Related pages

Installing mobian

I assume that we have Manjaro running on our PinePhone and we have connected it to a normal computer so we can use normal keyboard and normal screen. Also I assume that we have an SDHC card installed in the phone, and we want to install mobian onto this SDHC card.

In order to install mobian, we need to copy one of pre-built images to the SDHC card inside PinePhone.

shell
time bmaptool copy https://mobian-image.img.gz /dev/mmcblk0

where mobian-image.img.gz should be replaced by the actual (long) address of the image. After that, if we are lucky, we can reboot from Manjaro into Mobian.

Mobian creators (used to) produce daily images, and not all of them are going to work. In case the image does not work, I pull the SDHC card out of the PinePhone, insert it into my desktop and run

shell
dd if=/dev/zero of=/dev/sdX bs=8k seek=1 count=4

where /dev/sdX is the name of the SDHC card on the desktop.

Small SDHC card

Suppose we use a 16gb SDHC card. Before running bmaptool its partition table was

shell
fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 14.73 GiB, 15819866112 bytes, 30898176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *     2048 30898175 30896128 14.7G  c W95 FAT32 (LBA)

Then, after running bmaptool it was changed to

shell
fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 14.73 GiB, 15819866112 bytes, 30898176 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3b1d2aeb

Device         Boot   Start     End Sectors  Size Id Type
/dev/mmcblk0p1 *      16384 1048575 1032192  504M 83 Linux
/dev/mmcblk0p2      1048576 7421874 6373299    3G 83 Linux

We see that most part of the SDHC is now unused. I do not remember how did I fix this problem, probably I've just extended the second partition, please share your experience.

Problem with large SDHC card

In 2021 I had problems with starting Mobian on a larger (256gb) SDHC card.

When booting into fresh-new Mobian, first I saw a message "resizing file system during initial boot".

Then I got thousands of messages like

shell
[migrate_block: 56] Migrate node block XXXX -> YYYYY

for about 2 minutes.

After that:

shell
Not enough spase to migrate blocks Try to do defragment: Skip
[migrate_main: 199] Info: Done to migrate main area: main_blkaddr = 0x2200 -> 0x2d400
[migrate_ssa: ...] ...
[migrate_nat: ...] ...
[migrate_sit: ...] ...
....
mounting /dev/mmcblk0p2 on /root failed: Structure needs cleaning

Then I receive several more alarming (at the level of panic) messages, and the system freezes.

Vague: how did I fix it

Preparing SDHC card on desktop:

shell
wget https://mobian-image.img.gz
time ( zcat mobian-image.img.gz | dd bs=64k of=/dev/sdX status=progress )

After that the partition table is

shell
fdisk -l /dev/sdX
Disk /dev/sdX: 238.8 GiB, 256355860480 bytes, 500695040 sectors
Disk model: Card  Reader    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x72b2302e

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdX1  *      16384 1048575 1032192  504M 83 Linux
/dev/sdX2       1048576 7421874 6373299    3G 83 Linux

where (ext4-formatted) /dev/sdX1 contains

shell
System.map-5.10-sunxi64  config-5.10-sunxi64  dtb-5.10-sunxi64
extlinux  initrd.img-5.10-sunxi64  lost+found  vmlinuz-5.10-sunxi64

and /dev/sdX2 is almost (96%) full.

As far as I remember, I followed this advice doing "resizepart 2 50%", "resizepart 2 90%". "resizepart 2 100%" in parted.

First steps in fresh-new Mobian

shell
apt-get --no-install-recommends -y install aptitude
aptitude install screen